Repository navigation
fix(fleet-queue): max_attempts single source of truth + quarantine recheck (#10648) - #10652
Conversation
…check (#10648) The #5444 claim guard required the two max_attempts copies (task row + payload) to agree. The #8973 creation-default alignment (d67e7bf) bulk-updated row copies to 1000 while payload copies kept 3/4/6, and the guard quarantined 449 tasks for the split (2026-11-16 blocked-pile audit, root cause #1). - validate_packet: drop the copy-agreement error. The packet/row copy is the single source of truth; the payload copy is a mirror, still range-checked, never compared. - task_from_packet: normalize the stored payload copy to the selected row value at enqueue (skipped only if the mirror would breach the payload size ceiling), so new tasks are born aligned. - Blocked-row re-validation: rows fossilized in blocked because nothing re-validated them (99 audit rows already had agreeing copies). run_quarantine_rechecks re-runs blocked, dep-free, quarantine-errored rows through the claim guard and requeues the ones whose error no longer reproduces; it rides /sweep beside the dep rechecker and is exposed as /quarantine-recheck + repo-queue quarantine-recheck, mirroring #8276's shapes. - Regression tests: the audit's split shapes (1000 vs 2/3/4/6) at the validator, a proptest that any two in-range copies validate clean, the claim-guard fossil verdicts, and wiring oracles for the new verb/sweep ride/client surface. Refs #8973, #5444, #6448. Fixes #10648.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ❌ FailedThis 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. |
|
Review of |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 804ad7934e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let recorded = row.get("last_error").and_then(|v| v.as_str()).unwrap_or(""); | ||
| if !recorded.starts_with("quarantined by claim path") { | ||
| return QuarantineRecheck::NotApplicable; |
There was a problem hiding this comment.
Verify that the current block originated from quarantine
If an operator repairs a quarantined task and manually unblocks it, verb_unblock preserves its quarantine last_error. Both claim paths also preserve that field, and verb_block records a new blocker in progress/result without replacing last_error. Consequently, if the worker subsequently blocks that valid task for an unrelated dependency-free reason, this check mistakes the historical quarantine error for the current block reason, and the next sweep silently releases the intentional block. Check current transition provenance, or clear/replace stale quarantine errors on those intervening transitions.
Useful? React with 👍 / 👎.
| "SELECT {TASK_COLS} FROM tasks WHERE status = 'blocked' \ | ||
| AND last_error LIKE 'quarantined by claim path%' \ | ||
| ORDER BY updated_at ASC LIMIT {limit}" |
There was a problem hiding this comment.
Advance the batch past unchanged quarantined rows
When at least 200 older matching rows remain invalid, the default sweep repeatedly selects those same rows: quarantine_recheck_one deliberately leaves updated_at unchanged when the validation reason has not changed. Any later repaired row therefore remains outside the batch indefinitely, defeating automatic recovery even though its claim guard now passes. Record a separate recheck timestamp or use a rotating cursor so unchanged invalid rows cannot permanently starve later candidates.
Useful? React with 👍 / 👎.
| // #10648: NO agreement check against payload.max_attempts. | ||
| // The packet copy (which becomes the task row) is the single | ||
| // source of truth; the payload copy is a mirror that | ||
| // task_from_packet normalizes at enqueue. A mirror that | ||
| // disagrees is stale data, not an invalid packet — under the |
There was a problem hiding this comment.
Preserve the authoritative retry limit in triage follow-ons
For a legacy triage row with max_attempts = 1000 and payload.max_attempts = 3, accepting the split and automatically releasing its quarantine now lets it reach completion without normalizing the stored mirror. However, verb_complete in turso_queue.rs still initializes a new fix follow-on's row limit from fpayload.max_attempts, promoting the stale value back into the authoritative column. The follow-on therefore receives only three attempts instead of 1000 and can fail prematurely. Update that consumer to use the source row's limit, or normalize stored mirrors before releasing these tasks.
Useful? React with 👍 / 👎.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Fixes #10648. Refs #8973 (the order), #5444 (the claim guard), #6448 (the validation contract this amends), #9609 (the ceiling half of the same accident). Neither #8973 nor #5444 is closed by this PR — both carry scope beyond this defect.
The defect
Every task carries
max_attemptstwice: the row column andpayload.max_attempts. The #5444 claim guard required the copies to agree. The #8973 creation-default alignment (d67e7bfbf, 2026-11-14) bulk-set row copies to 1000 while payload copies kept 3/4/6, and the guard quarantined tasks at claim for the split — 311 on Nov 14, 23 on Nov 15, 114 on Nov 16; 449 of the 655 blocked tasks in the 2026-11-16 blocked-pile audit trace to this one cause. Separately, 99 blocked rows already had agreeing copies again yet sat blocked forever: nothing ever re-validates a blocked row (the dep rechecker only watches dep-blocked rows; a quarantine block has no deps).The change
One source of truth (validate.rs)
validate_packetno longer compares the copies. The packet/row copy governs; the payload copy is a mirror — still range-checked (1..=1000), never compared. The contract header and ceiling comment record the doctrine change and why: the Validate what you forward — one validation contract for the fleet queue's packets and verb values #6448 agreement rule assumed both copies are written once at creation, a premise the bulk row update broke.task_from_packetnormalizes the stored payload copy to the selected row value at enqueue, so new tasks are born aligned (skipped only if the mirror would breach the payload size ceiling — a stale mirror is harmless now, an over-ceiling payload is not).Blocked-row re-validation (turso_queue.rs, client.rs)
run_quarantine_rechecks: blocked, dep-free rows whose recorded error is a claim-path quarantine are re-run throughclaim_guard_reason. A row whose error no longer reproduces is requeued (claim/lease cleared, recorded error discarded into an auditableunblockedevent). A row still failing keeps its block, withlast_errorrefreshed only when the current reason actually changed (no per-minute event spam)./sweepbeside the dep rechecker (same expire timer, opt out withquarantine_recheck=false,quarantine_limitfor the batch size) — chosen because the sweep is the broker's existing maintenance cadence and the dep rechecker is the direct precedent; a claim-time recheck could never see blocked rows, since claims only pick queued ones./quarantine-recheckverb +repo-queue quarantine-recheckCLI mirror the/dep-recheckshapes, including--taskfor a forced single-row recheck.Tests
dep_wiring_oracles_8276.Live data repair (already done, ahead of this PR)
From the audit directory's repair ledger (
repair_ledger.jsonl): 213 non-terminal split-copy tasks aligned (payload := row), 0 failures; 6 blocked rows whose only current blocker was this quarantine requeued after port validation; rows blocked for any additional reason were aligned but not touched further. Post-repair census: 0 mismatched non-terminal tasks. Deploy of this PR (broker build from main, both locations, rollback kept) stops the defect minting new fossils; the observation window after deploy is reported on #10648.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.