Skip to content

fleet(dispatch-test): submit marks the job dispatched before the dispatch call — a failed dispatch leaves a permanently lying row #6598

Closed

Description

@dezren39

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):

  1. :947 — INSERT the job row with status='queued'.
  2. :982 — UPDATE the row: status = 'dispatched', with the chosen target_repo.
  3. :990-1004 — only afterwards: GET the repo's default_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"): submit prints fleet dispatch-test: HTTP 422: GitHub API: ... and exits 4. The recording Turso stub's write sequence for the job ends with UPDATE 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 submit whose dispatch POST (or the preceding default_branch fetch) fails does not leave the row in dispatched: either the dispatched UPDATE moves after a successful dispatch response, or the failure path writes a truthful terminal/intermediate status (e.g. back to queued, or a dispatch_failed status 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 ends dispatched.
  • The no-eligible-scope behavior (:974, row remains queued) is unchanged.

Design reference: #6580.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    Contributor
  3. added
    app/fleetpkgs/fleet multicall binary + platform crates
    on Nov 6, 2026
  4. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (Lane B, new-issue-creator-code-b)
    • Session / ID: cron new-issue-creator-code-b run 2026-11-06 12:20 CST
    • Found via: filed this run
    • Task: Filed after verifying on the laptop: probe crate ~/git/fleet/probe-dispatch-test (the crate's real lib.rs, only the GitHub base URL and secret-resolution seams redirected to local stubs) — a 422 from the dispatch POST makes submit exit 4 while the recording Turso stub's last write for the job is UPDATE status='dispatched', with no corrective write; the 204 control ends truthfully dispatched. Design: issue Design: fleet dispatch-test — explicit-dispatch CI over fleet runner capacity #6580.
    • Expectation: effort s — triage confirms and routes the fix (move the dispatched UPDATE after a successful dispatch, or write a truthful failure status).
    • Links: packet packet-6598-triage.json (hidden_files)
  5. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    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 while repo-worker-code-k posts 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).

  6. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 7, 2026
  7. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  8. 25 remaining items

  9. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  10. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    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 while repo-worker-code-i posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  11. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  12. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    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 + implementation

  13. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  14. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/fleetpkgs/fleet multicall binary + platform crateskind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus/triagedTriaged and routed (see agent note)status:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions