Skip to content

fix(queue): repair main-red syntax error from #3998#4027

Closed
JSONbored wants to merge 1 commit into
mainfrom
fix/main-red-3998-regate-repair-syntax
Closed

fix(queue): repair main-red syntax error from #3998#4027
JSONbored wants to merge 1 commit into
mainfrom
fix/main-red-3998-regate-repair-syntax

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

main is currently broken (confirmed via direct GitHub API fetch of the file at HEAD, not a local artifact): #3998 (a sentry[bot] auto-fix PR, merged 2026-07-07T10:09 UTC) applied its diff hunks in the wrong positions, corrupting src/queue/processors.ts in 4 places:

  • sweepRepoRegate's job-builder: an inserted comment+spread split a ternary expression mid-statement.
  • A duplicate REGATE_REPAIR_MAX_ATTEMPTS_PER_SHA declaration (block-scoped redeclaration), with the new value (5) landing inside a split comment instead of replacing the old value (2).
  • regatePullRequest's signature: a required parameter placed after an optional one (invalid TS).
  • regatePullRequest's body: a stray } closed the JOBS.send payload early, orphaning the trailing spread lines.

Reconstructed the logic exactly as #3998's own PR description states the intent: move the REGATE_REPAIR_ATTEMPT_EVENT_TYPE audit recording from dispatch-time to execution-time (so a rate-limit-deferred dispatch no longer burns an attempt), thread repairHeadSha through the job payload as a trailing optional param, and keep the attempt cap bumped 2→5.

Also fixed, discovered while getting this file green:

  • Two queue.test.ts regression tests still asserted the old dispatch-time-records-immediately behavior and the old cap of 2 — updated to match the new execution-time/cap-5 semantics fix(queue): prevent regate repair exhaustion from premature attempt counting #3998 intended.
  • One stale gittensory_agent_disposition_total assertion missing the repo label that selfhost-metrics.test.ts's equivalent assertions already correctly include.

Validation

  • npm run typecheck — clean (was failing with TS1005/TS1128/TS1109/TS1136 parse errors before this fix).
  • npx vitest run test/unit/queue.test.ts — full file green after the fixes above (was 6 failing, now 0).

Notes

This blocks cutting a new self-host release from the current main tip, so treating as urgent.

PR #3998 landed with 4 corrupted regions in processors.ts (a botched
merge/patch-apply): a broken ternary in sweepRepoRegate's job builder,
a duplicate REGATE_REPAIR_MAX_ATTEMPTS_PER_SHA declaration split across
a comment block, and an invalid regatePullRequest signature (required
param after an optional one). Reconstructed the intended logic exactly
as described in #3998's own PR body: record the repair-attempt audit
event at execution time (inside regatePullRequest, after rate-limit
admission) instead of dispatch time, thread repairHeadSha through the
job payload, and keep the attempt cap bumped 2->5. Also fixed two
queue.test.ts assertions that still expected the old dispatch-time
semantics/cap and one stale gittensory_agent_disposition_total
assertion missing the repo label already used in
selfhost-metrics.test.ts.
@superagent-security

Copy link
Copy Markdown
Contributor

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

@JSONbored JSONbored self-assigned this Jul 7, 2026
@JSONbored

Copy link
Copy Markdown
Owner Author

Closing as redundant — another concurrent effort fixed this exact bug via #4023 (merged 10:46 UTC) plus additional pre-existing drift via #4019 (merged 10:47 UTC), both landing minutes before this PR was ready. Verified origin/main now typechecks cleanly. No need to carry this fix forward.

@JSONbored JSONbored closed this Jul 7, 2026
@JSONbored
JSONbored deleted the fix/main-red-3998-regate-repair-syntax branch July 19, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant