Skip to content

feat(review): schedule fleet escalation sweep with Discord notify#6584

Merged
loopover-orb[bot] merged 8 commits into
JSONbored:mainfrom
RealDiligent:feat/critical-issue-loop-escalation-sweep-6349
Jul 16, 2026
Merged

feat(review): schedule fleet escalation sweep with Discord notify#6584
loopover-orb[bot] merged 8 commits into
JSONbored:mainfrom
RealDiligent:feat/critical-issue-loop-escalation-sweep-6349

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Add flag-gated hourly loop-escalation-sweep job (LOOPOVER_LOOP_ESCALATION, default OFF) that runs buildActiveLoopFleetSummary / evaluateEscalation.
  • When needingAttention is non-empty: emit structured loop_escalation_needs_attention log and post a Discord embed (via DISCORD_WEBHOOK_URL), throttled by audit cooldown.
  • Active loops load from LOOPOVER_ACTIVE_LOOPS_JSON so a simulated escalation-worthy loop can notify without a rented-loop D1 store yet.

Closes #6349

Test plan

  • Unit: flag OFF/ON parsing
  • Unit: JSON loader accepts good rows / drops bad
  • Unit: escalate → Discord once; cooldown suppresses repeat
  • Unit: cron enqueues job only when flag ON (hourly)
  • Unit: job-dispatch no-ops when flag OFF; runs when ON
  • CI + codecov/patch ≥ 99%

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 16, 2026 15:31
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

RealDiligent and others added 2 commits July 16, 2026 23:35
Hourly, flag-gated LOOPOVER_LOOP_ESCALATION job runs buildActiveLoopFleetSummary
and notifies (structured log + Discord) when needingAttention is non-empty.
Active loops load from LOOPOVER_ACTIVE_LOOPS_JSON until a store lands.

Closes JSONbored#6349

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.64%. Comparing base (7a275c7) to head (051ba5c).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6584   +/-   ##
=======================================
  Coverage   93.64%   93.64%           
=======================================
  Files         678      678           
  Lines       67964    67967    +3     
  Branches    18678    18680    +2     
=======================================
+ Hits        63642    63645    +3     
  Misses       3347     3347           
  Partials      975      975           
Flag Coverage Δ
shard-1 43.79% <0.00%> (-0.08%) ⬇️
shard-2 37.05% <66.66%> (+0.12%) ⬆️
shard-3 32.56% <0.00%> (+0.12%) ⬆️
shard-4 34.68% <0.00%> (-0.14%) ⬇️
shard-5 30.97% <0.00%> (-0.60%) ⬇️
shard-6 45.82% <33.33%> (+0.36%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/index.ts 95.95% <100.00%> (+0.04%) ⬆️
src/queue/job-dispatch.ts 100.00% <100.00%> (ø)
src/selfhost/maintenance-admission.ts 100.00% <ø> (ø)
src/selfhost/queue-common.ts 98.65% <ø> (ø)
src/selfhost/review-runtime.ts 100.00% <ø> (ø)
src/types.ts 100.00% <ø> (ø)

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 16, 2026
RealDiligent and others added 3 commits July 16, 2026 23:47
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-16 16:19:26 UTC

13 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Adds a flag-gated hourly cron job that loads a simulated active-loop snapshot from an env-var JSON array, runs the existing pure buildActiveLoopFleetSummary/evaluateEscalation logic, and on non-empty needingAttention emits a structured log plus a cooldown-throttled Discord webhook notification. The implementation is fail-safe (catches audit/fetch errors, defaults OFF, validates the Discord webhook URL/host/path), and wiring is threaded consistently through job-dispatch, types, cron enqueue, self-host admission/coalesce/runtime sets, and env typings. The most notable risk is that this ships as a simulation surface (LOOPOVER_ACTIVE_LOOPS_JSON) ahead of the real rented-loop D1 store per the PR description, so the linked issue #6349 is only partially closed by a live/production data source.

Nits — 5 non-blocking
  • src/review/loop-escalation-wire.ts: the cooldown check (countRecentAuditEventsForActorAndTarget) keys only on eventType+targetKey, not on which loops are attention-worthy — a resolved-and-different escalation within the same 60min window is suppressed just like a repeat of the same one; confirm that's intended.
  • src/review/loop-escalation-wire.ts:180 truncates the Discord embed description at 1800 chars without indicating truncation to the reader — consider appending a '…N more' marker when summary.needingAttention.length rows get cut off.
  • Several magic numbers (60min cooldown, 1800/200/160 char slices, 0xcf222e color) are inlined rather than named constants — minor readability nit, not worth blocking on.
  • codecov/patch failed at 77.50%/98.70% vs 99% target per CI status — worth checking which branch is uncovered before merge, though this is a CI result, not a code defect I'm asserting independently.
  • Consider keying the cooldown audit lookup on the specific loopId set (or a hash of it) rather than a single global targetKey, so a newly escalating loop isn't silently suppressed by an unrelated recent notification.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #6349
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 357 registered-repo PR(s), 174 merged, 32 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 357 PR(s), 32 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 357 PR(s), 32 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

RealDiligent and others added 3 commits July 17, 2026 00:04
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit f1c62e1 into JSONbored:main Jul 16, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire a live, scheduled trigger for evaluateEscalation so an escalation reaches a human automatically

1 participant