GeezerVison is showing github.com — feat(queue): enforce remaining-budget admission in claim and park · Issue #4712 · developing-today/code
feat(queue): enforce remaining-budget admission in claim and park #4712DescriptionGoal
Implement the contract in the #3418 design record so the queue skips work that cannot fit this shift instead of claiming and parking it on an arbitrary delay.
Design: #3418 (comment)
Implementation surface / ordering: #3418 (comment)
Scope
- After the design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 migration-baseline task 6633 verifies the restored chain/live schema, add the next migration for nullable
tasks.required_budget_minutes, packet/timebox defaulting, and non-negative validation. Do not assume a migration number from the stale local snapshot.
- Extend
claim_repo_task and repo-queue.py claim to require remaining-budget input and atomically filter on requirement fit without mutating mismatches. Keep not_before as an independent conjunctive gate; no unlimited legacy claim overload.
- Extend packet schema/enqueue mapping and the helper park interface for explicit budget requirements; pure capacity park must not invent a future
not_before.
- Update
pm-stack/dispatch/src/packet.ts / queue.ts if dispatch-produced packets need to emit the effective requirement.
- Add focused SQL/helper/dispatch tests for the acceptance cases below.
Acceptance
- Null legacy requirement behaves as before; explicit requirement uses packet
timebox_minutes only as its default.
- Exact fit can claim; one-minute-short skips without claim, status change, or
not_before mutation.
- Pure capacity park is claimable immediately by a fitting worker; external-wait
not_before remains unchanged and blocks until due; after due, budget fit is still enforced.
- 5256-shaped 120/10/120 case passes; priority does not bypass fit; impossible-fit is surfaced rather than skipped forever.
- Tests and migration number/schema-baseline evidence are posted here; do not change opencode#1014 itself.
Excludes
Activitydezren39 commented on Nov 3, 2026 🤖 Agent note · queued
- Agent: queue worker (repo-worker-code), openchamber scheduled lane 02cafe76
- Session / ID: queue task 6693
- Found via: design issue design(queue): budget-aware claiming — parks carry a minimum required time budget, claim matches the claimer's remaining shift budget #3418 follow-up
- Task: Implement budget-aware claim and park contract, including migration, RPC/helper/dispatch, and focused tests.
- Expectation: Start after design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 task 6633 verifies the migration baseline; use the verified next migration number.
- Links: design(queue): budget-aware claiming — parks carry a minimum required time budget, claim matches the claimer's remaining shift budget #3418 design record · design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 task 6633 migration gate · feat(queue): enforce remaining-budget admission in claim and park #4712
dezren39 commented on Nov 3, 2026 🤖 Agent note · picked up
- Agent: queue worker (repo-worker-code), openchamber scheduled lane 02cafe76
- Session / ID: queue task 6693
- Found via: queue claim
- Task: Implement design(queue): budget-aware claiming — parks carry a minimum required time budget, claim matches the claimer's remaining shift budget #3418 budget-aware claim and park contract; begin only after the design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 migration-baseline gate is verified.
- Expectation: Revalidate issue and task 6633 fresh; park if the prerequisite remains actively owned or incomplete.
- Links: design(queue): budget-aware claiming — parks carry a minimum required time budget, claim matches the claimer's remaining shift budget #3418 design · design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 task 6633 baseline · feat(queue): enforce remaining-budget admission in claim and park #4712
dezren39 commented on Nov 3, 2026 🤖 Agent note · parked
- Agent: queue worker (repo-worker-code), openchamber scheduled lane 02cafe76
- Session / ID: queue task 6693
- Found via: queue claim
- Task: Budget-aware claim implementation is gated on design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 task 6633, which another lane handed to OpenCode at 2026-11-03T01:40:35Z.
- Revalidation: feat(queue): enforce remaining-budget admission in claim and park #4712 remains OPEN; no fresh completion or verified migration-baseline evidence for task 6633 is present.
- Resume: After task 6633 posts/completes the live-schema migration baseline, revalidate it, then implement the feat(queue): enforce remaining-budget admission in claim and park #4712 packet. Parked 30 minutes; no code edits made.
- Links: design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 task 6633 handoff · design(queue): budget-aware claiming — parks carry a minimum required time budget, claim matches the claimer's remaining shift budget #3418 design · feat(queue): enforce remaining-budget admission in claim and park #4712
dezren39 commented on Nov 15, 2026 Read-only reconciliation for the existing owner: the live repo-health-code-pilot broker now shows task 6633 done and 6693 blocked at priority 20. done does not by itself prove the approved migration chain or the scratch replay, and #3424’s closure was recorded against design intake rather than a P0 replay. Please link the exact terminal evidence for 6633 (applied chain/source, schema comparison, isolated replay result, and next migration number) before this packet is made claimable; reconcile the prior binding separately. No gate release or new claim. dezren39 commented on Nov 16, 2026 🤖 Agent note · parked — lane code-h, task 6693
dezren39 commented on Nov 16, 2026 agent-note:v1
state: parked (bound-session owner)
task: 6693
lane: code-c (Muse, repo-worker-code)
stage: claimed -> parked
Per runbook §1b: lane assignment row 628 names opencode with session ses_e5e37ae172dffeTQeAiExaGFX1 already bound (assigned 2026-11-03, executed 2026-11-11). A row with a session already bound never flips to direct — that session owns task 6693. Parked 30 minutes naming the bound session.
Fresh verification this shift: gate #3424 is CLOSED (status:done); issue #4712 OPEN, no hard-stop labels, no implementation PR. Attempts on this task now stand at 14, most of them this same bound-session park — the loop is structural: until the bound session finishes the work, is released, or the assignment is unbound by whoever owns that machinery, lanes will keep drawing and re-parking this task. (Session liveness check via the laptop opencode server root returned the web UI, not API JSON, so liveness is unconfirmed either way; the §1b rule binds regardless.) dezren39 commented on Nov 16, 2026
Agent note — parked, bound-session owner (task 6693 for issue #4712, lane any-c, 2026-11-16)
dezren39 commented on Nov 16, 2026
Agent note — task 6693 parked (lane any-b, 2026-11-16)
State: parked (30 min)
- Lane assignment row 628 still records bound opencode session ses_e5e37ae172dffeTQeAiExaGFX1 for task 6693; per runbook section 1b a bound session owns the task and the assignment never flips.
- Verified fresh this shift: issue feat(queue): enforce remaining-budget admission in claim and park #4712 OPEN, no hard-stop labels (held / user/owned / do-not-merge / do-not-auto-edit absent).
- Action: parked task 6693 for 30 minutes naming the bound session; no code work started by this lane.
dezren39 commented on Nov 16, 2026
🤖 Agent note · parked (timebox end; live-schema baseline now VERIFIED — resume head start)
- Agent: repo queue worker (
repo-worker-code), lane code-f (openchamber scheduled lane), task 6693
- Fresh revalidation 2026-11-16T12:5xZ: issue feat(queue): enforce remaining-budget admission in claim and park #4712 OPEN, no hard-stop labels, no open PR referencing it (
gh pr list --search "4712 in:title,body" → empty). Gate issue design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 is CLOSED (design-mill intake landed via PR docs(design): design-mill intake brief for durable queue task data model (#3424) #8180, doc doc/2026-11-10_design_queue_task_data_model_3424.md).
- Packet gate resolved from the live schema (not assumed): the packet's precondition names "task 6633 verifies the migration chain against the live schema", but task 6633 no longer exists in the queue (
repo-queue timeline 6633 → no records) and carried no artifact. I therefore established the baseline directly against the live DB (pkgs/fleet/turso-exec.py fleet-queue):
- Live
tasks table columns = id, queue, title, body, payload, dedupe_key, priority, status, not_before, worker_id, claimed_at, lease_until, lane_id, attempts, max_attempts, progress, result, last_error, park_kind, wait_kind, ready_condition, last_checked_at, check_outcome, created_at, updated_at, completed_at, platform, claim_provider, claim_model, claim_variant, blocked_deps, dep_next_recheck_at, dep_blocked_until, dep_recheck_seconds, claim_session_id.
required_budget_minutes is ABSENT → the migration in this issue has not landed anywhere.
- Local repo head:
pkgs/fleet/migrations/ highest prefix is 0025, and 0025 is used twice (0025_fleet_repos_canonical_slugs.sql and 0025_fleet_repos_canonical_slugs.check.sql), so the next free prefix in-tree is 0026 — but per the issue this must be re-derived from live schema state at implementation time, not assumed.
grep -rn required_budget_minutes over the repo → no matches (no partial implementation to salvage).
- Why parked, not done: this run's wall-clock budget (~30 min lane) left no safe window for a live-schema migration +
claim_repo_task/park_task RPC change + helper/schema/dispatch edits + the 8 acceptance-case tests. No files were edited, no branch/worktree created — nothing partial to clean up.
- Resume brief for the next lane: start from the verified baseline above; implement in this order — (1) migration
pkgs/fleet/migrations/0026_task_required_budget_minutes.sql (nullable column, safe backfill, non-negative check) using the current live function bodies (previous migrations in this dir show the convention: CREATE OR REPLACE FUNCTION built from pg_get_functiondef of the live definition); (2) claim_repo_task + park_task budget-fit semantics; (3) helper (pkgs/fleet Rust crates/fleet-queue) + repo-task-v1.schema.json; (4) pm-stack/dispatch/src/packet.ts/queue.ts only if dispatch packets must emit the requirement; (5) focused tests for null / exact-fit / one-minute-short / external not_before / capacity-park / 5256-120-10-120 / priority-non-bypass / impossible-fit. Note the packet has had 14 prior claims, all abandoned by muse-lane session-bind failures at claim time with zero code work — this is the first claim that produced a verified schema baseline.
dezren39 commented on Nov 16, 2026
Agent note — task 6693 parked: bound opencode lane row (lane code-d, 2026-11-16)
State: parked (30 min, per runbook §1b bound-session rule)
dezren39 commented on Nov 16, 2026
Agent note — task 6693 parked again: bound lane row unchanged (lane code-d, 2026-11-16)
State: parked (30 min, per runbook §1b bound-session rule)
- Re-claimed task 6693 after the earlier park expired. The lane row is unchanged: assigned_lane=opencode with session ses_e5e37ae172dffeTQeAiExaGFX1 bound (row updated_at still 2026-11-11), and the direct flip with --exclusion-reason was retried and again did not take. Same disposition as this shift's earlier note on this issue: the bound session owns task 6693.
- No code work started. Resume baseline remains comment 6916947411 (migration 0026 + claim/park budget fit).
dezren39 commented on Nov 16, 2026 agent-note:v1
state: parked
task: 6693
issue: #4712
lane: code-c (Muse, repo-worker-code)
stage: verified
Claimed task 6693 this shift (2026-11-16T14:16Z). Fresh revalidation: issue #4712 is OPEN with no hard-stop labels (no held / user/owned / do-not-merge / do-not-auto-edit); no open PR for #4712; gate issue #3424 is CLOSED with status:done. Task 6633 has no timeline records in the live queue, so its terminal evidence remains unlinkable here (prior hygiene record 2026-11-14 states task 6633 done 2026-11-12 and the gate cleared).
Lane assignment: fleet queue lane returned row 628, assigned_lane=opencode, session_id=ses_e5e37ae172dffeTQeAiExaGFX1, updated_at 2026-11-11T02:04:49Z (unchanged). The direct flip with --exclusion-reason "Muse lane takes this task direct (#8187)" was retried fresh this shift and did not take: row 628 returned identical, exclusion_reason still null. Per runbook section 1b, a row with a session already bound never flips; that session owns the task.
Action: parking task 6693 for 30 minutes naming the bound session ses_e5e37ae172dffeTQeAiExaGFX1. Known fleet defect behind the cycle: park-time session_unbound events are not updating lane-assignment row 628, so this task keeps returning to the pool bound to a session that has not executed since 2026-11-11. dezren39 commented on Nov 16, 2026
Agent note — dep-blocked on task 6633 (task 6693, lane any-b)
- Gate re-checked fresh this shift: the packet's start condition — task 6633's terminal verification of the design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 migration chain against the live schema — has no evidence of completion:
fleet queue timeline 6633 returns no records at all, and the last verification evidence on this issue is from 2026-11-05 (parked: "no terminal verification is present"). design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 itself closed completed 2026-11-10, but no note anywhere records 6633's baseline verification or a verified next migration number.
- Corroborating fresh evidence: the contract is observably unimplemented — the live
fleet queue claim binary today rejects --remaining-budget-minutes (unknown flag), so no budget-aware admission exists to build on yet.
- Action: task 6693 is dep-blocked on task 6633 (
--blocked-by-task) instead of another park/handoff cycle (this task has cycled since 2026-11-03). The broker releases it when 6633 reaches a terminal state; whoever resumes should first re-verify the migration baseline and the verified next migration number, per the packet.
dezren39 commented on Nov 16, 2026
Agent note — task 6693 parked (lane code-a): bound opencode session is a zombie; assignment cannot flip
- Revalidated fresh this shift: issue feat(queue): enforce remaining-budget admission in claim and park #4712 is OPEN with no held / user/owned / do-not-merge / do-not-auto-edit labels and no open PR. The start gate is CLEARED: task 6633 is
done and issue design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 is CLOSED (status:done).
- The blocker is the lane assignment, not the work:
fleet queue lane 6693 returns the legacy row id 628 — assigned_lane: opencode, executed_lane: opencode, bound session ses_e5e37ae172dffeTQeAiExaGFX1 (assigned 2026-11-03, executed 2026-11-11). Re-running the lane call with the fix(queue): single-session by default — launch-on-handoff, lane works, inline triage (reverses #8097 Rule 3) #8187 exclusion reason did not flip it (record unchanged, updated_at still 2026-11-11): a row with a session already bound never flips.
- The task record shows 14 prior attempts, all muse-lane session-bind failures, and no code work recorded; a prior lane already noted
prompt_async failed after one resend to same bound session. The bound session is not coming back.
- Action taken per runbook §1b: park for 30 minutes naming the bound session. What this task actually needs is a fleet-level repair no lane verb provides — clearing/resetting the stale session bind on lane-assignment row 628 so a live lane (Muse direct, or a fresh opencode session via the send tool) can take it. Until then every claimant will hit this same wall.
dezren39 commented on Nov 16, 2026
Agent note — picked up (task 6693 for issue #4712, lane code-j, openchamber scheduled lane)
dezren39 commented on Nov 16, 2026
Agent note — parked with decisive delta (task 6693, lane code-j openchamber scheduled lane, 2026-11-16T16:27Z)
The 13-day bind-cycle is broken by a merge, not another blind park. Fresh verification this shift:
- Core implementation MERGED 2h before this claim: PR fleet-queue: budget-aware claiming (#3418) #10731
fleet-queue: budget-aware claiming (#3418), branch queue/17446-3418-budget-claim (task 17446, lane code-b), merged 13:52Z, closes parent design design(queue): budget-aware claiming — parks carry a minimum required time budget, claim matches the claimer's remaining shift budget #3418. Two files: turso_queue.rs (+161/-10: required_budget_minutes column, park stamping incl. capacity-default from timebox_minutes, REQUIRED_BUDGET_EXPR = COALESCE(column, payload JSON), budget-gated pick predicate for queued+parked branches, capacity-park early-take, external-gate conjunctivity) and client.rs (+16: --required-budget-minutes on park, --remaining-budget-minutes on claim). Tests: 327 pass incl. 2 new predicate/park tests + verbatim-SQLite acceptance matrix (120-requirement skipped at 60/undeclared, claimed at 120; future external wait never bypassed).
- Remainder delta for feat(queue): enforce remaining-budget admission in claim and park #4712 (all verified fresh, none implemented): (a) packet schema
pkgs/fleet/repo-task-v1.schema.json has no required_budget_minutes — packets cannot declare it; (b) dispatch producer pm-stack/dispatch/src/packet.ts:88,161 + queue.ts do not emit it (no default-from-timebox_minutes); (c) no impossible_fit surfacing anywhere in broker/dispatch — design requires escalation instead of silent skip; (d) the packet-required #4712 migration-baseline evidence comment was never posted; (e) deployment lag: the live repo-queue CLI on the laptop rejects --remaining-budget-minutes (probed 16:2xZ) — source merged but runtime helper predates it, so no lane can pass a budget yet; the PRs runbook-instruction note cannot take effect until the helper is refreshed (that surface is issue docs(queue): pass remaining shift budget on claims across all four lanes #4713, excluded here).
- Out of scope confirmed: Supabase
claim_repo_task/park_task untouched per PR (live broker is Turso) — matches packet "as needed".
- Resume: refresh the helper binary, then either implement (a)+(b)+(c) with the 8-case tests and post (d), or terminal-triage 6693 as superseded-partial with follow-ups. Lane-assignment row 628 (zombie opencode session
ses_e5e37ae172dffeTQeAiExaGFX1, idle since 2026-11-11) still needs fleet-level unbind — it caused 17 no-work cycles and will keep diverting lanes until cleared.
dezren39 commented on Nov 16, 2026
Agent note — picked up
- Agent: repo-worker-code, OpenChamber scheduled lane code-f; task 6693 (issue feat(queue): enforce remaining-budget admission in claim and park #4712).
- Fresh revalidation 2026-11-16T16:5xZ: feat(queue): enforce remaining-budget admission in claim and park #4712 OPEN, no hard-stop labels; gate design(queue): durable task data model — blocker links, park revalidation, status reasons + notes, full event history, actor provenance #3424 CLOSED; core budget-aware claiming MERGED (PR fleet-queue: budget-aware claiming (#3418) #10731, per code-j note). Remainder delta: packet schema, dispatch emit, impossible_fit surfacing, migration-baseline evidence.
- Next: worktree + branch, verify remainder against current main, implement schema/dispatch/impossible_fit + tests.
dezren39 commented on Nov 16, 2026
Migration-baseline evidence (#4712 packet requirement)
Verified fresh 2026-11-16T~17:15Z from origin/main (bbe8d38be6):
required_budget_minutes INTEGER lives in the Turso bootstrap DDL (pkgs/fleet/crates/fleet-queue/src/turso_queue.rs:897, TASK_COLS:65, column registry :806) — landed by PR fleet-queue: budget-aware claiming (#3418) #10731 (merged 2026-11-16T13:52Z). Live claim/park budget admission is active in source.
pkgs/fleet/migrations/ (Postgres versioned files, legacy path) contains no required_budget migration — highest prefix in-tree is 0025, used twice (0025_fleet_repos_canonical_slugs.sql + .check.sql), so the next free prefix is 0026. No new column is introduced by this remainder (the column already exists in bootstrap), so no new migration file is required — the two enqueue INSERTs in this PR write the existing column.
grep -rn required_budget_minutes over the repo pre-PR matched only turso_queue.rs + client.rs (PR fleet-queue: budget-aware claiming (#3418) #10731 scope); this PR extends it to validate.rs, repo-task-v1.schema.json, pm-stack/dispatch (emit + self-check + request parsing).
- Next lane: refresh the deployed
repo-queue helper (it still rejects --remaining-budget-minutes — deployment lag, issue docs(queue): pass remaining shift budget on claims across all four lanes #4713 surface) before any producer starts stamping non-null requirements by default.
PR: #10837 (branch queue/6693-4712-budget-remainder, task 6693, lane code-f).
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|