Repository navigation
fleet queue: add repair verb for quarantined/malformed task packets - #13218
Conversation
Broker-side `fleet queue repair <task-id> [--dry-run]`, sibling to `unblock`. Loads a task in a non-terminal state, runs the claim-path packet validators, and lists defects. Deterministic, semantics- preserving repairs are applied for known defect classes; the first class is the dedupe payload missing `checked_at`/`basis` (validation #5444), repaired by re-performing the dedupe check live — no other live task may hold the same work identity or dedupe key — and stamping the result. A duplicate refuses: the stamp cannot be honestly re-derived. Unrepairable defects fail with the defect list and mutate nothing. `--dry-run` reports without writing. On success the packet is re-validated clean, the quarantine is cleared, the task is restored claimable (queued, or blocked with deps intact), and a timeline entry names the verb, operator, defects and repairs. Also audits `unblock`: on its full-override path it now refuses a row that is still quarantined by the claim path, naming the quarantine and pointing at `fleet queue repair`. Wiring: broker dispatch route, CLI command + help surface, registry queue-verb inventory, operator docs test list, verbs.md.
|
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 4 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: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2aaadb82aa
ℹ️ 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".
| .and_then(|v| v.as_str()) | ||
| .unwrap_or("") | ||
| .to_string(); | ||
| if let Some(holder) = live_identity_holder(t, &identity, &kind)? { |
There was a problem hiding this comment.
Reject repairs that would re-serve completed work
If a quarantined malformed task was replaced by another task that has since completed, the live-only identity and dedupe-key checks ignore that replacement and allow the old task to become claimable again. Enqueue already prevents this by checking done_identity_holder and completed dedupe-key predecessors in turso_queue/claim.rs; its comments explain that claim-time staleness checks fail open during probe degradation. Apply the completed-work checks here as well so repairing a stale packet cannot cause completed work to execute again.
Useful? React with 👍 / 👎.
| let res = t.exec( | ||
| "UPDATE tasks SET payload = ?, status = ?, last_error = ?, \ | ||
| updated_at = ? WHERE id = ? AND status = ?", |
There was a problem hiding this comment.
Make the duplicate recheck atomic with the repair write
When two malformed rows share an identity or dedupe key, concurrent repair requests can both pass the duplicate queries because each still-invalid row is excluded by the claim guard. Both updates then succeed because they guard only their respective row's status, leaving two valid, claimable duplicates despite the successful dedupe attestations. The broker handles requests concurrently, and these backend calls are separate HTTP pipelines rather than one transaction. Serialize the duplicate checks and mutation, or enforce the absence of a valid holder atomically at write time.
Useful? React with 👍 / 👎.
# Conflicts: # pkgs/fleet/crates/fleet-queue/src/client/support.rs # pkgs/fleet/crates/fleet-queue/src/turso_queue.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8abe089ef
ℹ️ 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 restore_status = if status == "blocked" && !dep_block_active(&row) { | ||
| "queued" |
There was a problem hiding this comment.
Preserve lane-owned blocks when repairing packet metadata
For a dep-free task blocked by a lane, repairing a missing dedupe stamp also queues the task even though its operational blocker remains unresolved. The existing lane_blocked() and quarantine_recheck_verdict() in turso_queue/admin.rs explicitly preserve blocks recorded through progress/result blocker markers, but this transition checks only dependencies. Preserve those lane-owned blocks when repairing the payload, and limit automatic requeueing to claim-path quarantines so metadata repair does not inadvertently override an unrelated blocker.
Useful? React with 👍 / 👎.
What this adds
Broker-side
fleet queue repair <task-id> [--worker <id>] [--reason <text>] [--dry-run], sibling tounblock, for tasks quarantined by the claim path because their packet is malformed (worked example: task 18533, whosepayload.dedupelackedchecked_at/basis, validation #5444 — every claim re-quarantined it and no verb could fix the payload in place).Contract:
blocked,queued,parked,handed_off.claimedis refused (repair never mutates a task a worker holds);cancelled/failedpoint atrevive;doneis refused.validate_packetplus the claim-guard reason.(repo, issue, kind)or the samededupe_keyamong claim-guard-clean rows — and stampschecked_at+ abasisstating the re-check. If a duplicate holds either, repair refuses: the stamp cannot be honestly re-derived. If the packet carries neither identity nor key, it also refuses.--dry-runcomputes and reports everything, writes nothing.queued, orblockedwith its deps intact when dep-blocked), and arepairedtimeline entry names the verb, operator, defects and repairs.Unblock audit:
unblock's full-override path now refuses a row that is still quarantined by the claim path, naming the quarantine and pointing atfleet queue repair <id>. The--drop-deppath is unchanged (it leaves the row blocked).Docs-sync:
repairadded to the top-level queue help listing and its own usage entry, the registry queue-verb inventory, the operator-docs test list, anddocs/verbs.md.Tests (named oracles)
New in
turso_queue/repair.rs, all passing:repair_stamps_dedupe_and_requeues_13191repair_dry_run_writes_nothing_13191repair_refuses_duplicate_identity_13191repair_refuses_unrepairable_defect_13191repair_timeline_carries_the_repair_entry_13191unblock_refuses_a_still_quarantined_row_13191repair_wiring_is_complete_13191Full fleet-queue suite on the laptop (
cargo test -p fleet-queue --features client,queue-broker): 556 passed, 1 failed. The one failure is pre-existing on main and unrelated:closed_bound::tests::sweep_wiring_runs_the_detective_beside_the_recheckersasserts a whitespace-sensitive source shape incore.rs; both files are untouched by this PR. Filed as #13215.fleet-registry suite (incl.
pmo_operator_docs_match_registered_help_inventory): all green.Closes #13191
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-23T11:04:49Z", "session_id": null, "lane": null, "host": "amd", "worktree": "/home/user/wt-repair-13191", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/user/wt-repair-13191", "repo": "developing-today/code", "branch": "lane-repair-13191", "sha": "2aaadb82aa64d2c046b84b82af9696c9dc23d1a1" }, "auth_subject": "oc-code-01", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.