Skip to content

feat(review): config-as-code manifest override for the loop-escalation sweep cron - #8059

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-loop-escalation-manifest-override-8018
Jul 22, 2026
Merged

feat(review): config-as-code manifest override for the loop-escalation sweep cron#8059
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-loop-escalation-manifest-override-8018

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Closes loop-escalation-sweep is the only flag-gated cron job in job-dispatch's switch without a config-as-code manifest-override re-check #8018
  • loop-escalation-sweep was the only flag-gated cron job in processJob's switch without a config-as-code manifest-override re-check: its six siblings resolve a resolveXManifestOverride(env) and pass it into isXEnabled(env, override) so a stale in-flight job that lands after a .loopover.yml-based flag flip still no-ops — but an operator disabling Rent-a-Loop escalation via .loopover.yml (rather than LOOPOVER_LOOP_ESCALATION) could not stop an already-enqueued sweep job. The capability was never built when Wire a live, scheduled trigger for evaluateEscalation so an escalation reaches a human automatically #6349 added the sweep.
  • Mirrors the siblings end to end (the issue's required pattern): a top-level loopEscalation: manifest block ({present, enabled}, parse/serialize/known-field allowlist shaped exactly like prReconciliation's, wired through the engine parser, validation normalizer, loader snapshot, and the empty-manifest/present computation), resolveLoopEscalationManifestOverride in loop-escalation-wire.ts (60s single-slot TTL cache + fail-safe degrade to present: false, mirroring pr-reconciliation.ts), isLoopEscalationSweepEnabled(env, override) honoring the override (a present block wins outright, else env fallback), and the loop-escalation-sweep dispatch case resolving + passing it like its six siblings.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • Ran the targeted suites for every file this change touches: focus-manifest (full parse/round-trip suite for the new block, mirroring activeReviewReconciliation's), focus-manifest-validation, selfhost-config-lint, loop-escalation-wire (resolver present/absent/failure/TTL cases + override-precedence), and queue-5 (both dispatch directions: manifest disables despite env ON; manifest enables despite env OFF) — 1,046 tests green — plus npm run build --workspace @loopover/engine and the full root npm run typecheck. Verified per-diff-line coverage via lcov intersection: every changed line and branch across all 6 instrumented source files is covered, and simulated the scoped-CI shard condition with the exact CI invocation (--changed=origin/main --coverage.all=false): the per-shard lcov.info is non-empty and contains exactly the changed instrumented files. actionlint/workers/mcp/ui checks are untouched surfaces; CI runs them all.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable — backend/engine-only change (no UI, docs, or extension surface touched).

Notes

  • The root .loopover.yml / bundled fallback manifest are intentionally untouched: an absent loopEscalation: block parses to {present: false} and falls through to the env var, byte-identical to today — the manifest-drift check stays green and no operator behavior changes until a block is actually configured.
  • pickIssueTimestamp-style duplication was avoided entirely: the parser, serializer, and known-top-level-field allowlist additions are single-definition mirrors of the prReconciliation block, and the wire resolver mirrors resolvePrReconciliationManifestOverride including its test-only cache-clear hook (wired into queue-5's shared beforeEach alongside clearOpsManifestOverrideCacheForTest).

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 22, 2026 17:27
@superagent-security

Copy link
Copy Markdown
Contributor

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

…n sweep cron (JSONbored#8018)

loop-escalation-sweep was the only flag-gated cron job in job-dispatch's switch
without a manifest-override re-check: six siblings (ops-alerts,
sweep-liveness-watchdog, reconcile-open-prs, reconcile-active-review-tracking,
generate-maintainer-recap, rag-index-repo) resolve a
resolveXManifestOverride(env) and pass it into isXEnabled(env, override) so a
stale in-flight job that lands after a .loopover.yml-based flag flip still
no-ops -- but an operator disabling Rent-a-Loop escalation via .loopover.yml
(rather than LOOPOVER_LOOP_ESCALATION) could not stop an already-enqueued
sweep job. The capability was never built when JSONbored#6349 added the sweep.

Mirror the siblings end to end: a top-level `loopEscalation:` manifest block
({present, enabled}, parse/serialize/allowlist shaped exactly like
prReconciliation's), resolveLoopEscalationManifestOverride in
loop-escalation-wire.ts (60s single-slot TTL cache + fail-safe degrade to
present:false, mirroring pr-reconciliation.ts), isLoopEscalationSweepEnabled
honoring the override (present wins outright, else env fallback), and the
dispatch case resolving + passing it like its six siblings.

Tests mirror each sibling's: the full parse/round-trip suite for the new
manifest block, resolver present/absent/failure/TTL cases, override-precedence
on isLoopEscalationSweepEnabled, and both dispatch directions (manifest
disables despite env ON; manifest enables despite env OFF).
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 22, 2026
@loopover-orb

loopover-orb Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-22 17:45:23 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR closes #8018 by giving loop-escalation-sweep the same config-as-code manifest-override treatment its six siblings already have: a new `FocusManifestLoopEscalationConfig` (parse/serialize/empty-manifest wiring in focus-manifest.ts), `resolveLoopEscalationManifestOverride` with a 60s TTL cache and fail-safe degrade in loop-escalation-wire.ts, and the dispatch case in job-dispatch.ts now resolving the override and passing it into `isLoopEscalationSweepEnabled`. The pattern is copied faithfully from `pr-reconciliation.ts` (same cache shape, same fail-closed-to-`present:false` catch, same override-wins-outright-else-env-fallback precedence in `isLoopEscalationSweepEnabled`), and it's wired through every site a new top-level manifest field needs: parser, validation normalizer, loader snapshot, config-lint allowlist, and the empty-manifest `present` computation. Tests exercise both override directions, the TTL boundary, and the manifest-load-failure fallback via a poisoned DB.prepare + stubbed fetch, which is real coverage of the actual code path rather than a fabricated scenario.

Nits — 5 non-blocking
  • The `console.warn` in `resolveLoopEscalationManifestOverride` (loop-escalation-wire.ts:71) mirrors the sibling pattern (e.g. pr-reconciliation.ts) so it's consistent, but it's worth confirming this is the intended production log level for a degrade-to-safe path.
  • The 200-char truncation constant in the warn message (loop-escalation-wire.ts:71) is an inline magic number, same as the sibling files — a shared constant would avoid repeating it seven times across the codebase, though this PR isn't the place to fix that broadly.
  • focus-manifest.ts continues to grow as a single ~4000-line file with each new manifest field; not a regression introduced by this PR, but worth flagging as this pattern keeps repeating.
  • Consider extracting the repeated `{present, enabled}`-shaped config parse/serialize boilerplate (identical across prReconciliation, activeReviewReconciliation, loopEscalation, federatedIntelligence) into a small shared helper to cut the per-field diff size for the next sibling that needs this pattern.
  • The manifest-override cache TTL constant (60_000ms) is duplicated per-module (ops-wire, pr-reconciliation, sweep-watchdog, now loop-escalation-wire) — a shared cache utility would reduce this copy-paste surface.

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 #8018
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: 371 registered-repo PR(s), 151 merged, 34 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 371 PR(s), 34 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
The diff adds resolveLoopEscalationManifestOverride (with TTL cache and fail-safe degrade) to loop-escalation-wire.ts, wires it into isLoopEscalationSweepEnabled to honor a present manifest block over the env var, and updates the loop-escalation-sweep case in job-dispatch.ts to resolve and pass the override exactly like its six siblings, matching all stated requirements.

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: Python, Ruby, JavaScript, Svelte, TypeScript, Markdown, MDX
  • Official Gittensor activity: 371 PR(s), 34 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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

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 f3cb090 into JSONbored:main Jul 22, 2026
10 checks passed
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.04%. Comparing base (0cd7dc4) to head (6ef7912).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8059      +/-   ##
==========================================
+ Coverage   91.93%   93.04%   +1.10%     
==========================================
  Files         742      648      -94     
  Lines       76071    54219   -21852     
  Branches    23093    19337    -3756     
==========================================
- Hits        69939    50448   -19491     
+ Misses       5037     2850    -2187     
+ Partials     1095      921     -174     
Flag Coverage Δ
control-plane ?
rees ?
shard-1 59.06% <92.85%> (+<0.01%) ⬆️
shard-2 48.42% <28.57%> (-0.05%) ⬇️
shard-3 54.56% <57.14%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
packages/loopover-engine/src/config-lint.ts 100.00% <ø> (ø)
...s/loopover-engine/src/focus-manifest-validation.ts 100.00% <100.00%> (ø)
packages/loopover-engine/src/focus-manifest.ts 98.45% <100.00%> (+0.01%) ⬆️
src/queue/job-dispatch.ts 99.29% <100.00%> (+<0.01%) ⬆️
src/signals/focus-manifest-loader.ts 95.79% <ø> (ø)
src/signals/focus-manifest.ts 99.58% <ø> (ø)

... and 95 files with indirect coverage changes

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.

loop-escalation-sweep is the only flag-gated cron job in job-dispatch's switch without a config-as-code manifest-override re-check

1 participant