GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(queue): handoff sink gets its own status (handed_off) and the fake expiry timer is deleted · Issue #8234 · developing-today/code

fix(queue): handoff sink gets its own status (handed_off) and the fake expiry timer is deleted #8234

New issue
Copy link
New issue
Copy link
Closed
#8263
Closed
fix(queue): handoff sink gets its own status (handed_off) and the fake expiry timer is deleted#8234
#8263
Copy link
Labels
status:done

Description

@dezren39
dezren39
opened on Nov 10, 2026
Issue body actions

Drew's order (2026-11-10, verbatim)

"Clean it up: sink gets its own status, drop the fake timer"

Problem

The status parked covers two unlike things:

  1. Genuine broker-owned timed waits — wait_kind + ready_condition + not_before with broker floors (triage 6h, CI/capacity 1h, fix(queue): broker-owned waits — claim eligibility, wait TTL floors, no attempt burn on bookkeeping cycles #8184/fix(queue): broker-owned waits — claim eligibility, wait TTL floors, wake verb, handoff expiry sink (#8184) #8185). The item is waiting on something real, and releases by timer or wake.
  2. The handoff sink — parked rows recorded as opencode handoffs (PARKED_HANDOFF_SQL: status='parked' AND progress.lane='opencode' AND progress.session_id IS NULL AND stage IN ('handed_off','launch_failed')). These are not waiting on time at all; they are recorded handoffs nobody has collected yet.

The overlap is what made the old handoff loop hard to see, and it still produces nonsense bookkeeping: expire_leases returns an expired claim on a sink-shaped row to parked and stamps a fresh not_before = now+1200s with a {"kind":"time"} ready_condition — a fake timer, because the sink branch of the default pick ignores not_before entirely. Either the timer matters (then the sink is a wait) or it doesn't (then stop stamping it).

Fix

Give the sink its own status: handed_off.

Name choice: handed_off is already the vocabulary of this state everywhere else — the checkpoint stage, the park classification, the audit events. As a status it reads as the state the task is in ("recorded handoff, not yet collected"), invents no second vocabulary, and leaves parked meaning exactly one thing: a genuine timed wait. (awaiting_collection was the alternative; rejected — longer, and a new term for a concept the fleet already calls a handoff.)

Scope

  • Park / handoff recording: a recorded opencode handoff lands in status handed_off, not parked.
  • Predicates: PARKED_HANDOFF_SQL, is_parked_handoff, handoff_shape match the new status (keeping the session-unbound condition; dropping what the status makes redundant).
  • Default pick: the timed-park branch no longer needs the NOT-sink exclusion (a sink row can't be parked by construction); the sink branch picks from handed_off. Claim UPDATE's parked case (+0 attempts) treats handed_off like parked for attempt purposes.
  • Claimant discovery (pm-stack/opencode-claimant/): collects from the new status instead of parked handoffs.
  • expire_leases sink return: returns to handed_off with not_before = NULL and no time ready_condition — the fake timer is deleted. Binding cleared as today; attempts untouched; lease_expired event records the new return target.
  • By-id claim: handed_off rows stay claimable by id; genuine wait-parks stay excluded.
  • Wake verb: stays parked-only; a handed_off row is already claimable, so wake refuses it explicitly (help + test).
  • Health: new status is its own count bucket; parked in health output means genuine waits only.
  • List verb / client / CLI help: status enumerations updated.
  • Labels (§9): checked — label sync stays coarse (queue/parked covers the wait family); the status split is a broker/queue distinction, recorded on this issue; no label change unless a consumer is found that needs one.

#8192 disposition — folded in

#8192: broker reads stage as COALESCE(progress.stage, last_checkpoint.stage) while claimant poll prefers last_checkpoint.stage; rows whose top-level stage was overwritten after the handed_off checkpoint are stranded in the gap. Once sink membership is a status, neither the broker predicate nor the claimant needs to reconstruct it from stage at all — the stage-source disagreement stops mattering for sink membership, and the migration classifier (below) uses the union reading (either stage source says handed_off/launch_failed, lane opencode, unbound) so stranded rows like task 10995 are collected into the new status instead of left behind. #8192 closes with credit when this lands.

#8191 disposition — reframed

#8191 (parked handoffs re-served to lanes ignoring not_before): the re-serves were the #8189 sink-drain working as designed (the sink branch deliberately ignores not_before) combined with lanes running the pre-#8187 re-handoff choreography. This change doesn't change who may collect a sink row, but it removes the ambiguity that made the report possible: a row in handed_off is visibly a sink row, a genuine wait-park can never be mistaken for one, and a lane that parks a collected item as a real wait puts it in parked where its timer is honored. Disposition comment to be posted on #8191 at landing.

Migration

After deploy, one auditable backend operation (event recorded, like the #8187 queue_reset event) moves existing sink-shaped parked rows to handed_off, per queue, with before/after counts. Genuine wait-parks must not move — proven by sampling a live CI/triage wait row before and after.

Sequencing

Lands third, behind #8210 (send/transfer — merged, PR #8223) and #8217 (batch claim + dispatch — in flight). No edits to turso_queue.rs or pm-stack/opencode-claimant/ until #8217 merges; this change rebases on final main.

Acceptance

  • Before/after fleet queue health for repo-health-code-pilot: parked drops to genuine waits only; new handed_off bucket holds the sink count.
  • One live sink row collected after migration (claimant bind or lane flip-to-direct) from the new status.
  • One forced lease expiry on a claimed sink row returns it to handed_off with not_before NULL — no fake timer.
  • The sampled genuine wait row unmoved.
  • Fleet-queue suite + claimant suites green, incl. updated fix(queue): broker-owned waits — claim eligibility, wait TTL floors, no attempt burn on bookkeeping cycles #8184/fix(queue): broker-owned waits — claim eligibility, wait TTL floors, wake verb, handoff expiry sink (#8184) #8185/fix(queue): single-session by default — launch-on-handoff, lane works, inline triage (reverses #8097 Rule 3) #8187 regression tests and new tests for the above.

Refs #8187, #8185, #8192, #8191, #8210, #8217.

Activity

  1. developing-today commented on Nov 10, 2026

    @developing-today
    developing-todayBot
    on Nov 10, 2026 – with developing.today
    Contributor
    More actions

    CODE-2444

  2. dezren39 commented on Nov 10, 2026

    @dezren39
    dezren39
    on Nov 10, 2026
    MemberAuthor
    More actions

    Design (from source audit of main @ 0ecd3f9, post-#8210)

    Status name: handed_off (as proposed in the issue body).

    Broker (turso_queue.rs) touch points

    • PARKED_HANDOFF_SQL → HANDOFF_SQL: status = 'handed_off' AND json_extract(progress,'$.session_id') IS NULL. The lane/stage reconstruction is dropped — status is now the single source of truth for sink membership (this is what folds fix(queue): parked-handoff stage source mismatch — broker reads progress.stage, claimant poll reads last_checkpoint.stage #8192 in: neither side reconstructs membership from stage anymore). The session-unbound condition stays as a guard.
    • is_parked_handoff → is_handed_off: status check + unbound check. handoff_shape (progress-only) stays unchanged — it classifies claimed rows in expire_leases and the park verb, where the row's status is not yet the sink status.
    • default_pick_predicate: third branch becomes the handed_off branch; the timed-park branch loses its NOT (…) sink exclusion (a sink row cannot be parked by construction). Placeholder count unchanged (2).
    • claim_update_sql + claim_by_id UPDATE: attempts CASE becomes status IN ('parked','handed_off') THEN 0 — collecting a sink row never burns an attempt, exactly as today.
    • Pick mode: broker accepts pick = "handed_off"; "parked_handoff" stays accepted as a deprecated alias (straggler callers fail soft, not hard). Client --handoff sends the new name.
    • verb_park: classification at write time — if the merged progress is handoff-shaped (lane opencode + stage handed_off/launch_failed + binding cleared) and the caller attached no genuine wait condition (ready_condition absent/defaulted, or kind time), the park lands in status handed_off with not_before/park_kind/wait_kind/ready_condition all NULL. A caller-attached real condition (ci, triage, task_*, …) always wins → genuine parked. The triage classification (awaiting_triage stage) is disjoint and unchanged. The park event records the resulting status.
    • expire_leases: sink return writes status handed_off, not_before = NULL, park_kind = NULL, wait_kind = NULL, ready_condition = NULL — fake timer deleted. lease_expired event's return field becomes "handed_off".
    • by_id_claimable: handed_off rows claimable by id (unbound); genuine wait-parks still refused.
    • wake_eligible: handed_off gets an explicit refusal — "already claimable; claim it, don't wake it" (test-pinned).
    • health_entry: new handed_off bucket; the client renders health from these keys, so the column appears with no client change beyond ordering.
    • Incidental status enumerations: LIVE_STATUSES (dedupe ownership), the coverage verb's live-status IN list, and quarantine_payload_missing all gain handed_off — a sink row owns its dedupe key and gets payload-quarantined exactly like a parked one.
    • revalidate_parked (daily sweeper): unchanged code; sink rows leave its population by construction (it selects status='parked'), ending the current behavior where it stamps check outcomes on sink rows' fake time conditions forever.

    Claimant (pm-stack/opencode-claimant/)

    • poll.py: fetch_parked_rows → fetches status handed_off; is_handoff_parked → is_handoff_waiting: status handed_off + lane opencode + unbound + non-UUID claiming lane, no stage test — for sink rows the status is the recorded yield (only the park classification and the expiry return write it, both shape-gated), so the fix(queue): parked-handoff stage source mismatch — broker reads progress.stage, claimant poll reads last_checkpoint.stage #8192 stage-source disagreement cannot strand a sink row on either side again. is_candidate for claimed rows is untouched (the recorded-yield check is the launch-safety contract there). Old names kept as aliases where other modules import them.
    • claimant.py (_collect_parked_handoffs, candidate status comparisons) and launch_one.py (fetch/explain/status branches): vocabulary + status comparisons updated to handed_off.
    • Tests: test_poll.py, test_claimant.py, test_launch_one.py updated + new cases (a handed_off row whose stage sources disagree is still a candidate — the fix(queue): parked-handoff stage source mismatch — broker reads progress.stage, claimant poll reads last_checkpoint.stage #8192 regression shape).

    Migration classifier (one auditable op, post-deploy)

    Move a parked row iff: progress.lane = 'opencode', unbound, stage from either source (top-level or last_checkpoint) in (handed_off, launch_failed), and it carries no genuine wait (wait_kind is NULL/timer and ready_condition.kind is NULL/time). Rows matching the shape but carrying a genuine wait (e.g. task 10995, #8192's example — a real triage wait: wait_kind='triage') stay parked and are listed by id in the migration event for lane disposition. Moved rows get not_before/wait fields nulled in the same UPDATE. Event kind handoff_status_migration with per-queue before/after counts.

    Docs / runbooks

    • pm-stack/opencode-claimant/README.md, prompt.md, doc/fleet/queue-turso-cutover.md: status vocabulary.
    • Lane runbook (§1b, sandbox instruction): the one status mention ("a parked handoff sink task the default pick now serves") now reads as a task arriving in status handed_off. §9 labels stay coarse (queue/parked) — no label change; the split is broker vocabulary, noted here per the issue.

    Sequencing status

    #8210 merged (PR #8223). #8217 (batch claim) is in flight — its worktree holds uncommitted turso_queue.rs edits as of this comment — so implementation here waits for its merge, then rebases on final main.

  3. developing-today
    added
    status:in-review
    on Nov 10, 2026
  4. dezren39
    added a commit that references this issue on Nov 10, 2026

    Merge pull request #8263 from developing-today/queue/8234-handoff-status

    eb97de1
  5. dezren39
    closed this as completedin #8263on Nov 10, 2026
  6. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 10, 2026
  7. dezren39 commented on Nov 10, 2026

    @dezren39
    dezren39
    on Nov 10, 2026
    MemberAuthor
    More actions

    Landed and live. PR #8263 merged (eb97de1), built and deployed 2026-11-10 (both fleet binaries, .bak-20261110-8234 kept, queue-broker.service restarted, MainPID 2685230). Status name: handed_off — the vocabulary the checkpoint stage, park classification, and audit events already used; 'parked' now means exactly one thing (a genuine timed wait).

    What changed (details in the PR): park verb classifies its landing (handoff shape + no caller-declared genuine wait -> handed_off, all wait fields NULL; a real condition always wins); HANDOFF_SQL / is_handed_off key on the status with lane+unbound guards and NO stage reconstruction (#8192 folded in); default pick sink branch on the new status, timed-park branch needs no sink exclusion; claims from handed_off cost +0 attempts; by-id claims take sink rows; wake refuses handed_off ('not a wait — already claimable'); health gained a handed_off bucket; LIVE_STATUSES/coverage/quarantine include the status; pick wire name 'handed_off' ('parked_handoff' kept as deprecated alias). Claimant poll/claimant/launch_one read the new status; is_handoff_waiting drops the stage test for sink rows. GitHub labels unchanged (queue/parked stays the coarse wait-family label, per the design note).

    Tests: cargo test -p fleet-queue --all-features: 163 lib + 2 integration passed. Claimant suites: 127 passed. New regression tests include the park classification matrix, the sink-return shape (no timer), and the #8192 stage-disagreement case on both sides.

    Migration (one auditable operation, event id 163402, kind handoff_status_migration): 41 rows moved, all in repo-health-code-pilot; ambiguous rows (handoff shape carrying a genuine wait): none existed at migration time; moved rows had all wait fields NULLed in the same UPDATE.

    Live acceptance receipts:

    • Health before/after (repo-health-code-pilot): parked 160 -> 117 (genuine waits only), handed_off 0 -> 41. Other queues' parked counts unchanged (nix 2, openchamber 3, opencode 4; classifier found 0 movable there).
    • Collection from the new status: claimant poll discovers all 41 sink candidates; task 14579 collected by opencode-claimant via the production handoff pick (claimed event pick='handed_off', 2026-11-10T21:23:21Z), then returned via the park verb, which classified it back into handed_off with NULL wait fields (parked event detail status='handed_off'). A full session launch for task 4858 was attempted through launch_one and refused only by cap_saturated (fleet at its 36-session cap) — the launch path itself is exercised by the claimant's normal fires.
    • Forced lease expiry: task 3692 claimed by-id from the sink (attempts stayed 12 — +0), lease forced past, sweep ran: row returned to handed_off with not_before/park_kind/wait_kind/ready_condition all NULL; lease_expired event return='handed_off'. No fake timer.
    • Genuine wait unmoved: task 6605 (wait_kind ci, ready_condition ci/workflow id) verified still 'parked' with all wait fields intact inside the migration run itself.
    • The sink is refilling through the NEW write path only: handed_off stands at 51 in the latest health read (post-migration handoffs land directly in the status; none pass through 'parked').

    Deploy note: the release binary was built from this PR's branch point (main 16432a1 + this change) because current main's fleet package does not compile — fleet-search initializers are missing new struct fields; filed separately as #8269. The broker/queue code in the deployed binary is identical to merged main; only unrelated search-domain code predates the break.

    Dispositions: #8192 closed (folded in, with credit). #8191 closed with the reframe (the re-serves were the #8187 sink drain working as designed plus pre-#8187 lane choreography; the status split removes the ambiguity).

  8. dezren39
    added a commit that references this issue on Nov 11, 2026

    fix(queue): expire_leases fails at-cap tasks instead of stranding the…

    edee5d6
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

    status:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.