Skip to content

fix(queue): prevent regate repair exhaustion from premature attempt counting#3998

Merged
JSONbored merged 1 commit into
mainfrom
seer/fix/regate-repair-attempts
Jul 7, 2026
Merged

fix(queue): prevent regate repair exhaustion from premature attempt counting#3998
JSONbored merged 1 commit into
mainfrom
seer/fix/regate-repair-attempts

Conversation

@sentry

@sentry sentry Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR addresses the premature triggering of the regate_repair_exhausted error. Previously, repair attempts were counted at job dispatch time, not at execution time. This meant that agent-regate-pr jobs, if deferred due to GitHub rate limiting or high installation concurrency, would still consume an attempt budget without any actual repair work being performed. With a cap of only 2 attempts, this led to PRs being abandoned from priority repair too easily.

This fix resolves the issue by:

  1. Moving the REGATE_REPAIR_ATTEMPT_EVENT_TYPE audit event recording from the sweep dispatcher (fanOutAgentRegateSweepJobs) to inside the regatePullRequest function.
  2. The agent-regate-pr job payload now includes repairHeadSha to facilitate this, ensuring attempts are only counted after the job successfully passes rate-limit admission and begins execution.
  3. Increasing REGATE_REPAIR_MAX_ATTEMPTS_PER_SHA from 2 to 5. This provides more resilience against genuine transient failures (e.g., a single AI provider timeout) without letting a truly broken PR spin indefinitely.

Suggested PR title: fix(regate): prevent premature repair exhaustion

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:

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

Required for visible UI, frontend, docs, or extension changes. Attach GitHub-hosted JPG/JPEG or PNG screenshots here; SVG screenshots are not accepted as review evidence. Use a compact table/grid of clickable thumbnails with a short state/title such as "Loaded state", "Empty state", "Error state", "Mobile layout", or "PR sidebar". Prefer annotated screenshots with a colored box, outline, arrow, or highlighter showing what changed. Recordings can be supplemental, but screenshots are still expected for visual review. Do not commit review-only screenshots, recordings, or docs/review-evidence/** files.

State / title JPG/PNG evidence
Loaded state <a href="FULL_URL.png"><img src="FULL_URL.png" alt="Loaded state" width="240"></a>
Empty/error/mobile state, if relevant

Notes

Fixes GITTENSORY-1E

@sentry
sentry Bot requested a review from JSONbored as a code owner July 7, 2026 10:01
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

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

loopover-orb Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-code); No linked issue detected). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 7, 2026
@JSONbored JSONbored self-assigned this Jul 7, 2026
@JSONbored JSONbored reopened this Jul 7, 2026
@JSONbored
JSONbored merged commit 276bdcc into main Jul 7, 2026
9 of 11 checks passed
@JSONbored
JSONbored deleted the seer/fix/regate-repair-attempts branch July 7, 2026 10:09
JSONbored added a commit that referenced this pull request Jul 7, 2026
…ck (#4023)

PR #3998 shipped a garbled hunk in sweepRepoRegate's job-dispatch block
and regatePullRequest's signature/body -- an object literal spliced with
a dangling recordAuditEvent's fields, no closing brace or JOBS.send call,
and a required parameter (repoFullName) following an optional one
(repairHeadSha). Reconstructed both regions from the parent commit plus
the PR's stated intent: move the repair-attempt audit event from
dispatch-time to execution-time (after rate-limit admission), so a
deferred/dropped job no longer burns an attempt against
REGATE_REPAIR_MAX_ATTEMPTS_PER_SHA. Also fixed a duplicate declaration of
that same constant (value 5 shadowing the original 2, introduced by the
same bad hunk) and an invalid "started" outcome literal that isn't part
of the audit-event outcome enum.
JSONbored added a commit that referenced this pull request Jul 7, 2026
… records

#3998 moved repair_attempt recording from dispatch time to execution time
(inside regatePullRequest, after rate-limit admission) so a deferred or
dropped fan-out no longer counts against the repair-attempt cap. This
test only asserted on what the sweep dispatched, never ran the fanned
per-PR job, so the attempt was never recorded.
JSONbored added a commit that referenced this pull request Jul 7, 2026
… records

#3998 moved repair_attempt recording from dispatch time to execution time
(inside regatePullRequest, after rate-limit admission) so a deferred or
dropped fan-out no longer counts against the repair-attempt cap. This
test only asserted on what the sweep dispatched, never ran the fanned
per-PR job, so the attempt was never recorded.
JSONbored added a commit that referenced this pull request Jul 7, 2026
)

#4023 fixed the syntax corruption #3998's own patch introduced and moved
repair_attempt recording to execution time, but left
REGATE_REPAIR_MAX_ATTEMPTS_PER_SHA at 2 -- #3998's stated intent was to
raise it to 5 for resilience against transient failures (a single AI
provider timeout no longer exhausts the budget). Bumps the constant and
updates both orb-retry-storm regression tests' attempt counts to match;
one of them was also still asserting the pre-#3998 dispatch-time
recording behavior, never executing the fanned per-PR job.
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant