Repository navigation
fix(batch): scan only quarantined jobs for quarantine recovery dispatch - #24320
Merged
Merged
Conversation
Since #23932 (10-29), a quarantine-held projection marks its committed job recovery_state=held so the held-partial scan owns it. recovery_candidates() matched recovery_state in held/prepared/running without the job state, so those committed jobs (5,289 in prod at 00:47Z, against 120 real quarantined candidates) filled the dispatch page. prepare() refuses every one of them, the sweep logged ~75 outcome=held lines a minute, and real quarantined units waited a full scan cycle (~72 min, longer across leader changes) before their first recovery intent. Add state == 'quarantined' to the query. All filters are equalities, so Firestore serves it by single-field index merging (probed against prod, no composite index). prepare() already requires state == 'quarantined', so no dispatchable unit is dropped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Why
The prod quarantine-recovery sweep logs ~75
event=batch_quarantine_recovery outcome=heldlines a minute (backend-integration, 00:35–00:45Z 11-02: 744 held, 5 queued, 0action=dispatchexception lines). These lines are not dispatch exceptions. They are the sweep's per-candidate outcome summary.Cause: since #23932 (10-29),
ProjectionSession.persistmarks a committed job whose projection is quarantine-held withrecovery_state=held, so the held-partial scan owns it.recovery_candidates()selectsrecovery_state in [held, prepared, running]without the job state. Those committed jobs fill the dispatch page, andRecoveryStore.prepare()refuses each one becausestate != 'quarantined'.Measured at 00:47Z (Firestore COUNT, ro-prod, counts only):
recovery_state=heldstate=committedstate=quarantinedprepared/runningAt
BATCH_PIPELINE_RECOVERY_DISPATCH_BATCH_SIZE=64on the maintenance leader, one full scan takes about 72 minutes, and the cursor is per instance, so a leader change restarts it. Real quarantined units, including language-guarded ones, wait that long before getting their first recovery intent. None of the 111 has an intent today, and some have waited for up to a day. Their siblings' conversations wait with them (the T3 quarantine-held backlog). The committed-held stock grows by about 1.3k a day at the current batch share.What
Add
state == 'quarantined'torecovery_candidates().prepare()already requires that state, so no unit that could be dispatched is dropped. All filters are equalities, so Firestore serves the query by single-field index merging: probed against prod,state==quarantined AND recovery_state IN [...] ORDER BY __name__returned 120 rows with no index error. The sim model and the emulator sweep test now model the state.Risk
prepare()already refuses. The held-partial scan (held_candidates) is unchanged.Verification
test_recovery_candidates_skip_committed_units_held_by_projection: it fails before the fix (1 failed, 135 passed) and passes after.bin/omi-heavy, nice 19, with ambient GCP credentials unset,backend/test.shran 7 files: quarantine recovery, Firestore query shapes, outside-query contract, query contract, pipeline sim, characterization and owner drain. 824 passed, 0 failed. Layer: backend unit tests, hermetic.test_global_recovery_sweep_advances_past_held_pages_without_extra_querygains a committed-held row. It was not run locally (no emulator); CI runs it.Readout after deploy (backend-integration logs, counts only):
outcome=heldlines should fall from ~75/min to roughly the real held set per pass,queuedshould spike once as the 111 units get intents, and quarantinedrecovery_state=heldshould drain within minutes, except units held by design (cap or allowance, guarded zero-VAD).Failure-Class: FC-batch-fault-domain-head-of-line-poison
🤖 Generated with Claude Code