Skip to content

fix(review): tighten the regate-repair attempt cap to 2 and surface it to Sentry - #3760

Merged
JSONbored merged 1 commit into
mainfrom
fix/orb-repair-exhausted-sentry-log
Jul 6, 2026
Merged

fix(review): tighten the regate-repair attempt cap to 2 and surface it to Sentry#3760
JSONbored merged 1 commit into
mainfrom
fix/orb-repair-exhausted-sentry-log

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Follow-up to fix(review): stop the medium-effort retry storm burning tokens on zero output #3747. Two changes:
    1. Lower REGATE_REPAIR_MAX_ATTEMPTS_PER_SHA from 3 to 2 -- one fewer wasted repair attempt per stuck head SHA before the sweep falls back to ordinary staleness-gated cadence.
    2. Add a structured console.error at the moment a SHA exhausts its repair budget, so the event flows through the existing forwardStructuredLogToSentry pipeline. Previously this was a DB-only audit_events write with no operator visibility until someone queries the ledger directly (which is how today's incident was found) -- now it surfaces as a Sentry issue automatically, tagged by repo/pullNumber per the existing SENTRY_LOG_TAG_KEYS convention.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • 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.
  • No issue linked -- small follow-up to fix(review): stop the medium-effort retry storm burning tokens on zero output #3747, same live-incident context.

Validation

  • git diff --check
  • npm run actionlint -- not run (no workflow files touched)
  • npm run typecheck -- clean
  • npm run test:coverage (full/unsharded) -- not run locally; ran the full affected file directly instead (test/unit/queue.test.ts, 588/588 passed, including updated regression assertions for both changes)
  • 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 -- not run locally (no wrangler/MCP/UI/dependency surface touched); left to CI.
  • Both changes have updated/new assertions: the existing exhaustion regression test now also asserts the Sentry-visible log fires exactly once with the right fields; the cap value change is exercised by the same test (still passes at cap=2, seeded with 3 prior attempts).

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.
  • N/A -- no auth/cookie/CORS/GitHub App/Cloudflare/session changes.
  • N/A -- no API/OpenAPI/MCP surface changed.
  • N/A -- no UI changes.
  • N/A -- no docs/changelog changes needed.

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.29%. Comparing base (ede8961) to head (00535b9).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3760   +/-   ##
=======================================
  Coverage   93.29%   93.29%           
=======================================
  Files         317      317           
  Lines       32368    32369    +1     
  Branches    11872    11872           
=======================================
+ Hits        30199    30200    +1     
  Misses       1537     1537           
  Partials      632      632           
Files with missing lines Coverage Δ
src/queue/processors.ts 94.11% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 6, 2026
@loopover-orb

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - fixes required

Review updated: 2026-07-06 07:54:35 UTC

2 files · 1 AI reviewer · 2 blockers · readiness 93/100 · CI failing · blocked

🛑 Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.

Review summary
This is a narrow, well-scoped follow-up to #3747: it lowers REGATE_REPAIR_MAX_ATTEMPTS_PER_SHA from 3 to 2 and adds a structured console.error at the exhaustion point so it flows through the existing forwardStructuredLogToSentry pipeline instead of being DB-only. The change is correct and low-risk — the new log fires inside the same conditional block that already writes the repair_exhausted audit event, so it can't double-fire independently of that event. The test update appropriately spies on console.error, asserts the JSON payload shape/fields, and restores the spy in a finally block; the cap-lowering is exercised by the same test seeded with 3 prior attempts.

Nits — 5 non-blocking
  • src/queue/processors.ts:1443-1448 — the 4-line comment justifying the error-level log is verbose for a one-line log call; could be trimmed to a single sentence pointing at src/selfhost/ai.ts as precedent.
  • Confirm the 'repo'/'pullNumber' field names in the new console.error payload actually match the keys forwardStructuredLogToSentry/SENTRY_LOG_TAG_KEYS expects for auto-tagging (not visible in this diff).
  • test/unit/queue.test.ts — the exhaustedLogs filter matches on substring 'regate_repair_exhausted' in any console.error call; fine today but could false-match if another log later embeds that string incidentally.
  • Consider asserting errors.mock.calls.length overall (not just the filtered subset) to guard against unexpected extra console.error calls from unrelated code paths in the same test.
  • If forwardStructuredLogToSentry has its own unit tests, verify they cover a payload shape matching this new event (repo/pullNumber/headSha/attempts) rather than relying solely on the queue test.

Why this is blocked

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.

CI checks failing

  • validate
  • validate-code
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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 (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 54 registered-repo PR(s), 46 merged, 439 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 54 PR(s), 439 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 54 PR(s), 439 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
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.

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

…t to Sentry

Lower REGATE_REPAIR_MAX_ATTEMPTS_PER_SHA from 3 to 2 (#3747 follow-up) --
one fewer wasted attempt per stuck SHA before the sweep falls back to
ordinary staleness-gated cadence.

Also add a matching structured console.error at the moment a SHA exhausts
its repair budget, so it flows through the existing
forwardStructuredLogToSentry pipeline instead of being visible only via a
direct audit_events query (level:"error" is deliberate -- the line's own
existence IS the anomaly signal, same convention as selfhost_ai_provider_
failed / selfhost_ai_providers_exhausted).
@JSONbored
JSONbored force-pushed the fix/orb-repair-exhausted-sentry-log branch from 6db5f7e to 00535b9 Compare July 6, 2026 09:14
@JSONbored
JSONbored merged commit 5b5dbf0 into main Jul 6, 2026
10 checks passed
@JSONbored
JSONbored deleted the fix/orb-repair-exhausted-sentry-log branch July 6, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

1 participant