Repository navigation
Description
Bug: fleet(dispatch-test) submit marks the job dispatched before the dispatch call — a failed dispatch leaves a permanently lying row
pkgs/fleet/crates/fleet-dispatch-test/src/lib.rs, verb_submit (verified at laptop origin/main 867c695518):
:947— INSERT the job row withstatus='queued'.:982— UPDATE the row:status = 'dispatched', with the chosentarget_repo.:990-1004— only afterwards: GET the repo'sdefault_branch(:992, errors if absent) and POST/repos/{repo}/actions/workflows/fleet-dispatch-test.yml/dispatches.
Every failure in step 3 — a workflow that lacks the workflow_dispatch trigger (422), a missing workflow file (404), a repo body with no default_branch, a transport error — returns Err to the caller, but the row already says dispatched, and nothing ever corrects it. There is no later writer for a job whose workflow never started: status (:1056) faithfully reports dispatched forever for a job that will never run.
The ordering was clearly considered for the other failure window: the no-eligible-scope error at :974 explicitly notes "(job {id} remains queued in the store)" — true and recoverable there, because step 2 has not run yet. The step-3 window has the opposite property and no such handling.
Verification (laptop probe, this run)
Probe crate ~/git/fleet/probe-dispatch-test on the laptop: the crate's real lib.rs with exactly two seams redirected — GITHUB_API_BASE pointed at a local stub GitHub, resolve_named returning a stub token (the Turso URL is config, pointed at a recording stub store). All submit logic byte-identical.
- Case A (dispatch POST returns 422 "Workflow does not have workflow_dispatch trigger"):
submitprintsfleet dispatch-test: HTTP 422: GitHub API: ...and exits 4. The recording Turso stub's write sequence for the job ends withUPDATE jobs SET target_repo = 'acme/fleet', status = 'dispatched', ... WHERE id = 'dt-mw5b5m76-4ac2'— and no corrective write of any kind follows. The store's final state claims the job was dispatched; no workflow run exists. - Case B (control, dispatch POST returns 204): exit 0, report JSON
status: "dispatched"— the same write sequence, this time truthful.
Why it matters
The jobs store is the tracking surface for this explicit-dispatch CI system (#6580): operators and agents read row status to know whether a test job ran. A dispatched row that never dispatched is indistinguishable from a real in-flight job — it will be waited on, and its missing results read as a hung run rather than a failed submit. The caller does see the submit error, but anyone (or any automation) consulting the store afterwards is misled, and there is no retry path that starts from the row's stated state.
Acceptance criteria
- A
submitwhose dispatch POST (or the precedingdefault_branchfetch) fails does not leave the row indispatched: either thedispatchedUPDATE moves after a successful dispatch response, or the failure path writes a truthful terminal/intermediate status (e.g. back toqueued, or adispatch_failedstatus carrying the error). - A regression test pins the ordering/state: with the dispatch call failing, the row's final stored status is not
dispatched(stub GitHub + stub store, as in the probe); the success control still endsdispatched. - The no-eligible-scope behavior (
:974, row remainsqueued) is unchanged.
Design reference: #6580.
Activity
developing-today commentedon Nov 6, 2026
CODE-2010
dezren39 commentedon Nov 6, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 7, 2026
Picked up by
repo-worker-code-k— working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live whilerepo-worker-code-kposts progress markers; after 30 minutes of silence any other worker may pick this up.)Lane K triage: verifying the verb_submit dispatched-before-dispatch ordering claim against current main (fleet-dispatch-test lib.rs).
dezren39 commentedon Nov 7, 2026
🤖 Agent note · picked up
repo-worker-code-k(issue fleet(dispatch-test): submit marks the job dispatched before the dispatch call — a failed dispatch leaves a permanently lying row #6598 is the task in fallback mode)verb_submitinpkgs/fleet/crates/fleet-dispatch-test/src/lib.rswritesstatus='dispatched'before the dispatch call, so any dispatch failure leaves a permanently lying row, against current main.task/small-fix+queue/queued), or an already-fixed verdict with evidence.25 remaining items
dezren39 commentedon Nov 7, 2026
🤖 Agent note · done
dezren39 commentedon Nov 7, 2026
Picked up by
repo-worker-code-i— working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live whilerepo-worker-code-iposts progress markers; after 30 minutes of silence any other worker may pick this up.)dezren39 commentedon Nov 7, 2026
🤖 Agent note · picked up
fleet queue healthHTTP 503 PGRST002, exit 4; outage tracked as issue infra: repo-queue PostgREST timeout: global failures lane-visible again — recurrence after #6450 closed (2026-11-06 21:15-21:31Z) #6619). Fallback claim on issue fleet(dispatch-test): submit marks the job dispatched before the dispatch call — a failed dispatch leaves a permanently lying row #6598.fleet dispatch-test submitordering inpkgs/fleet/crates/fleet-dispatch-test/src/lib.rs: the row is markeddispatchedbefore the dispatch call, so a failed dispatch leaves a permanently lying row. Dispatch first, mark after success (a failure leaves the rowqueued, like the existing no-eligible-scope path), with a regression test on stub GitHub + stub store.dispatch_and_mark+ stub-server regression tests, branch + PR, merge under the standing criteria if verified.queue/fallback-6598-dispatch-order, laptop worktree~/git/fleet/fb-6598dezren39 commentedon Nov 7, 2026
Progress from
repo-worker-code-i: picked up: verb_submit read on current main — UPDATE dispatched (step d) precedes default_branch fetch + dispatch POST (step e); fix reorders via dispatch_and_mark, regression test on stub servers; next: worktree + implementationdezren39 commentedon Nov 7, 2026
🤖 Agent note · done
already_done. PR #6721 "fix(fleet/dispatch-test): mark dispatched only after the dispatch succeeds (fleet(dispatch-test): submit marks the job dispatched before the dispatch call — a failed dispatch leaves a permanently lying row #6598)" merged 2026-11-07T03:17:44Z (commit 105207e). Checked against the issue's acceptance criteria on current main (700ed0e): the submit tail now recordstarget_repowith the row stillqueued, dispatches, and only then marksdispatched, sequenced throughrun_dispatch_sequence; three regression tests pin the contract (order target→dispatch→mark; a dispatch failure never reaches the mark step; a target-write failure stops before dispatch); the no-eligible-scope behavior is unchanged.status:doneby the fixing lane. My in-flight labels from this claim are removed with this note; nothing of mine was pushed (my draft worktree was deleted uncommitted).dezren39 commentedon Nov 7, 2026
Released by
repo-worker-code-i(outcome: done). already fixed by PR #6721 (merged 03:17Z, commit 105207e); verified against all acceptance criteria on current main — claim raced the fixing lane