Skip to content

fleet-queue(fallback): a contested claim never expires — the fold ignores the lease, the holder cannot heartbeat, and a dead holder bricks the issue for the whole outage #6660

Closed

Description

@dezren39

Problem

In the new GitHub-native queue fallback mode (pkgs/fleet/crates/fleet-queue/src/fallback.rs, merged in PR #6654 for #6619), a contested claim never expires. Once a second worker's claim marker lands while a claim is live, the issue is bricked in fallback mode:

  • fold_claim returns ClaimState::Contested whenever a contest was recorded and a holder exists (fallback.rs:448-455) — before and regardless of the lease-age check at :460. Lease expiry, the mode's only recovery mechanism ("If no marker from the holder lands for the lease window, the claim is stale and any other worker may claim the issue", module doc), never applies to a contested issue.
  • cmd_claim refuses a contested issue (reason: "contested", exit 5, fallback.rs:888), and the tool never posts a claim against one — so the fold's clean-supersede arm (a new claim arriving after the previous claim went stale) can never fire once a contest exists.
  • cmd_heartbeat refuses a contested issue too (fallback.rs:970), so even a live, working holder cannot renew after a single stray claim from a since-dead challenger; the holder's last_activity is frozen at its pre-contest value.
  • The only exit is a release from the holder — and if the holder is the dead worker (the exact failure fallback mode exists to survive), nobody can ever claim the issue through the tool again. cmd_release inconsistently has NO contested check, unlike cmd_heartbeat.

Evidence

Verified on the laptop against origin/main @5492f27e02 (probe ~/git/fleet/probe-fallback-contest, real fallback.rs included verbatim, fold_claim/parse_ts called directly; lease = 1800s):

  • Control: [claim a @T0] folded at T0 + 100 leases → stale, claimable = true.
  • Case 1: [claim a @T0, claim b @T0+60] folded at T0 + 100 leases (both workers silent for ~2 days) → contested, claimable = false.
  • Case 2: same + holder heartbeats at T0+120/T0+240, folded at T0+300 → still contested (and per :970 the real heartbeat verb would have refused to post them).
  • Case 3: same + challenger release at T0+120, folded at T0 + 100 leases → still contested, claimable = false.

Existing test fold_stale_supersede_and_live_contest only folds a contest inside the lease window (T0+120); no test covers a contest after lease expiry.

Why it matters

Fallback mode runs exactly when the queue backend is down (#6619 outage) — the fleet monitor / broker reconciliation that the "a human or the fleet monitor resolves" note relies on may be unavailable at the same time. One bypass-tool claim, one race the readback didn't catch, or one worker claiming with a skewed clock permanently removes an issue from the fallback work pool for the rest of the outage, silently (scan ranks contested last, claimable count excludes it).

Acceptance criteria

  • A contest whose holder (and challenger) have both been silent longer than the lease window no longer reports claimable: false forever: e.g. fold_claim ages a contest out to Stale (holder's last activity governs), or an equivalent documented rule lets a new worker supersede.
  • A live holder can heartbeat while a contest is younger than the lease (or the resolution rule above makes the heartbeat refusal unreachable in practice), and cmd_heartbeat / cmd_release treat Contested consistently.
  • New fold tests: contest folded after lease expiry; contest + holder heartbeats; contest where the challenger goes silent and the holder keeps working.
  • Existing behavior inside the lease window is unchanged: a claim against a live claim still contests, scan/status output shapes unchanged.

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/highImportant and time-sensitive
    app/fleetpkgs/fleet multicall binary + platform crates
    on Nov 7, 2026
  2. developing-today commented on Nov 7, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane B, new-issue-creator-code-b)
    • Session / ID: new-issue-creator-code-b run, 2026-11-06 19:20 CST
    • Found via: filed this run
    • Task: Triage the fallback-mode contested-claim deadlock: fold_claim never ages a contest out, cmd_claim/cmd_heartbeat refuse contested, and only a holder release can clear it.
    • Expectation: effort/m — done when a contest silent past the lease becomes supersede-able (or an equivalent documented rule lands), heartbeat/release treat Contested consistently, and the new fold tests pass.
    • Links: probe ~/git/fleet/probe-fallback-contest (laptop, real fallback.rs verbatim @5492f27e02)
  4. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-y (Lane Y queue worker shift, FALLBACK MODE — queue backend down: fleet queue health returns HTTP 503 PGRST002 and the fallback subcommand is not yet in the deployed fleet 0.1.0 binary, so this claim follows the fallback protocol in doc/fleet/queue-fallback-mode.md manually via the gh CLI).

    🤖 Agent note · picked up

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

    @dezren39
    MemberAuthor

    Progress from repo-worker-code-y: verified: finding confirmed against current main — posting triage findings and filing the follow-up fix issue next.

  7. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triage findings (issue #6660)

    Evidence, point by point against the issue's claims:

    1. fold_claim contested early-return at fallback.rs:448-455 fires whenever contested is set and a holder exists, BEFORE the lease-age check in the match holder block that follows it — lease expiry never applies to a contested issue. ✔
    2. cmd_claim contested refusal at fallback.rs:888 ("claimed": false, "reason": "contested", exit 5). ✔
    3. cmd_heartbeat contested refusal at fallback.rs:970 — even the holder cannot renew after a contest. ✔
    4. cmd_release (fallback.rs:994+) has NO contested check; it matches on state.holder(), which for ClaimState::Contested returns the holder (fallback.rs:350) — so a holder release is the only exit, exactly as filed. ✔
    5. Case 3 mechanism confirmed by reading the fold's Release arm: a release only clears contested when the releaser IS the holder, so a challenger's release leaves the contest in place. ✔
    6. Existing test fold_stale_supersede_and_live_contest only folds a contest at T0+120 (inside the lease); no post-expiry contest test exists. ✔

    Follow-up fix filed as issue #6668 (task/small-fix, queue/queued): fold the contest with the lease, accept holder heartbeats while contested, add the three post-expiry fold tests from this issue's Cases 1–3.

  8. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-code-y (outcome: done). Triage complete: issue #6660 CONFIRMED against main @207e61203b790c525edebd84c906b34df617e741 (findings comment with line-level evidence posted this run); follow-up fix filed as issue #6668 (queue/queued).

    🤖 Agent note · done

  9. added
    status/triagedTriaged and routed (see agent note)
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 7, 2026
  10. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    Triage verdict (task 11247): ALREADY DONE — fixed via issue #6668 / PR #6676; closing issue #6660

    This issue was first triaged in fallback mode by lane code-y on 2026-11-07 (findings comment 6700374390, CONFIRMED at main 207e61203b), which filed the follow-up fix as issue #6668. That fix has since landed, so no new work is owed here:

    Every acceptance criterion of issue #6660 is met by that merged change. Closing as completed — a duplicate fix packet for the same code would be manufactured work.

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/highImportant and time-sensitivesource/creatorFiled by the new-issue-creator jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions