fix(scheduler): idle-fill must not out-race a repeated infra_error (AGT-4305) - #623
Merged
Merged
Conversation
…GT-4305) AGT-4257's idle_fill unconditionally cleared a task's infra_error backoff whenever a free slot was available, with no cap on how many times the SAME issue could be bypassed for the SAME recurring infra_error. On vela, AX-1272's reviewer stage died to the same OpenRouter 360s timeout 9 of ~13 attempts over 4h+, retried every ~90s instead of waiting the intended 1h backoff, because it was the only runnable candidate — burning a full worker+tester+reviewer cycle each time with no forward progress. Adds consecutiveInfraErrorCounts (issueId -> streak), incremented on every infra_error result and reset at every existing terminal/recovery site. Both idle-fill bypass points (legacy failedTaskRetryTimes gate, and the durable- ledger RETRY_AT idleLiftable check) now refuse to bypass once an issue's CURRENT infra_error streak reaches 3, honoring the real 1h backoff instead. The durable-ledger check is additionally scoped to durableRun.lastErrorCode === 'infra_error' so a later, unrelated RETRY_AT (e.g. an ordinary rejection) on the same issue keeps normal idle-fill treatment. Two related gaps found during review are tracked separately rather than expanding this fix's scope: AGT-4306 (idle-fill also un-parks an INFRA_CIRCUIT_PARK_REASON NEEDS_HUMAN with no operator action) and AGT-4307 (a thrown/rejected executor error surfaces via a separate scheduler 'error' event that this streak never sees, so it bypasses this protection entirely). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AGT-4257's idle-fill unconditionally cleared a task's infra_error backoff whenever a free slot was available, with no cap on how many times the same issue could be bypassed for the same recurring infra_error. On vela,AX-1272's reviewer stage died to the same OpenRouter 360s timeout 9 of ~13 attempts over 4h+, retried every ~90s instead of waiting the intended 1h backoff, because it was the only runnable candidate.consecutiveInfraErrorCounts(issueId → streak), incremented on everyinfra_errorresult and reset at every existing terminal/recovery site. Both idle-fill bypass points (legacyfailedTaskRetryTimesgate, and the durable-ledgerRETRY_ATidleLiftablecheck) now refuse to bypass once an issue's current infra_error streak reaches 3, honoring the real 1h backoff instead. The durable-ledger check is additionally scoped todurableRun.lastErrorCode === 'infra_error'so a later, unrelatedRETRY_AT(e.g. an ordinary rejection) on the same issue keeps normal idle-fill treatment.AGT-4306(idle-fill also un-parks anINFRA_CIRCUIT_PARK_REASONNEEDS_HUMANwith no operator action) andAGT-4307(a thrown/rejected executor error surfaces via a separate scheduler'error'event that this streak never sees).Review history
idleLiftable, plus a new test that seeds a realRunLedgerRETRY_ATrow.lastErrorCode === 'infra_error', so it over-applied to later unrelatedRETRY_ATrows on the same issue. Fixed. Also fixed a LOW test-hygiene nit (unclosed ledger handle).Test plan
npx tsc --noEmit -p tsconfig.check.jsoncleannpx oxlint src/automation/autonomousRunner.ts src/automation/autonomousRunner.infraError.test.ts→ 0 warnings/errorsnpx vitest run src/automation/autonomousRunner→ 139/139 passed (after rebase onto origin/main)🤖 Generated with Claude Code