Skip to content

queue: stamp the claiming session's own model on the task at claim time #8176

Description

@dezren39

Order

Drew, 2026-11-10 10:53 CST: "sessions should provide their own model to the queue when picking up an item. opencode should expose current model to the active session."

Part 1 (fork — DONE, pre-existing)

developing-today-forks/opencode#1891 (serving leaf invisible to the session) was implemented by fork PR #1929 (merged 2026-11-07, squash 03c8dc44): the in-session route_usage tool, given a session input, returns serving (per-step leaves) and lastServing (provider/model/variant of the leaf that served the last step, plus attemptedLeaf/failedOver), derived from route_attempt. Verified present on current fork main and in the deployed pin (ff9858ae, fork PR #2237's merge — ancestry confirmed via the compare API: the deployed pin descends from the #1929 merge). No new fork work needed; this issue covers the queue half.

Part 2 (this issue — queue claim stamp)

When a session picks up (claims) an item, the claim records the session's own current model on the task:

  • Additive columns on tasks (Turso backend, pkgs/fleet/crates/fleet-queue), existing rows NULL: claim_provider, claim_model, claim_variant — the claiming session's serving leaf at claim time, read from the Part 1 route_usage surface.
  • The broker claim verb (claim_repo_task, both the pick path and the by-id path) accepts optional model_provider / model_id / model_variant request fields and stamps them on the claimed row; the claimed event detail carries them too.
  • The repo-queue claim CLI gains --model-provider / --model-id / --model-variant flags (validated: provider and model required together; variant optional).
  • Claimant/lane surfaces pass the stamp on a normal claim without extra manual steps. Claims by non-session actors (Muse lanes) carry a distinct marker in the provider field (muse-lane) instead of a fabricated model.
  • Semantics: the stamp is the model at claim time. A later failover changes the serving leaf (visible via route_usage) but not the stamp.

Acceptance

  • One real claim through the production path on a scratch task reads back with claim_provider/claim_model/claim_variant matching the claiming session's route_attempt leaf.
  • Existing behavior unchanged for claims that carry no model fields (stamp stays NULL).

Activity

  1. developing-today commented on Nov 10, 2026

    @developing-today
    Contributor
  2. added a commit that references this issue on Nov 10, 2026
  3. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    Implemented and proven — PR #8178 merged (65621abf), broker + clients redeployed, production proof below.

    What a claimed task now records (tasks columns, additive; existing rows NULL): claim_provider, claim_model, claim_variant — the claiming session's serving leaf at claim time. claim_repo_task (pick and by-id paths) accepts model_provider/model_id/model_variant; provider+model must travel together (a half-stamp is a usage error on both the CLI and the broker); the claimed event detail carries the same fields; rich list rows include the stamp. repo-queue claim gained --model-provider/--model-id/--model-variant. The claimant instruction surface (pm-stack/opencode-claimant/prompt.md) now tells a self-claiming session to read its leaf from route_usage lastServing (opencode#1891) and pass it on the claim. Non-session claimants stamp the distinct marker muse-lane/muse-lane, never a fabricated model. Claim-time semantics: a later failover changes the serving leaf but never rewrites the stamp.

    The leaf used for the proof — a real production session's own records (route_attempt, session ses_e5e39c98a2cffeLCIf9QopUeWx, route workhorse): its last turn attempted _claude/claude-sonnet-5-5#medium four times (failures, Claude 5h window at 100%) and was served by opendesign/deepseek-v4.1-flash#high (success) — a genuine failover, exactly what #1891's lastServing reports (attemptedLeaf _claude/claude-sonnet-5-5, leaf opendesign/deepseek-v4.1-flash, failedOver true).

    Production proof (queue fleet-queue-proof, production broker + production client, no model calls):

    • Task 14647 claimed with --model-provider opendesign --model-id deepseek-v4.1-flash --model-variant high → claim output and independent rich-list read-back both show claim_provider=opendesign, claim_model=deepseek-v4.1-flash, claim_variant=high. Cancelled after read-back.
    • Task 14646 claimed with NO model flags → read-back claim_provider/claim_model/claim_variant all NULL (pre-queue: stamp the claiming session's own model on the task at claim time #8176 behavior unchanged). Cancelled.
    • A muse-lane marker claim stamps claim_provider=muse-lane, claim_model=muse-lane, claim_variant=NULL. Cancelled.
    • A half-stamp claim (--model-provider alone) is refused client-side, exit 2, with the pairing error.

    Deploy: PR #8178 merged to main; the fleet release binary was rebuilt from the merged tip and installed by atomic rename at both live paths (~/.local/bin/fleet, ~/.local/libexec/queue-coverage/fleet; previous binaries kept as .bak-20261110-8176); queue-broker.service restarted and healthy (Turso backend, health rc 0). The schema migration ran at broker start — the stamp columns are live (the read-backs above run through them). Tests: cargo test -p fleet-queue --features client,queue-broker,secrets-broker 139+2 passed, 0 failed, incl. 3 new #8176 tests. Note: the turso_queue.rs diff carries whole-file rustfmt reflow (the file was unformatted at base; cargo fmt normalized it) — behavior changes are the #8176 hunks only. Clippy could not run in this worktree: a pre-existing environment fault (E0514 clippy-driver/serde-rmeta mismatch) reproduces on unmodified dependency crates; plain cargo test compiles and passes the same code.

  4. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Reopened 2026-11-12 — the claim-time model stamp does not land on real claims.

    Live check of the fleet-queue DB (2026-11-12 14:31 CST), tasks completed 2026-11-06 → 2026-11-12:

    • 3,820 completions in the window; exactly 1 has claim_model set: task 14440, value workhorse, with claim_variant NULL.
    • Every other completion in the window has claim_model / claim_variant NULL.
    • 0 of 8 tasks in claimed state at check time carried any stamp.

    The columns exist and the one stamp that did land proves a write path exists somewhere — but the claim paths the fleet actually uses (lane shift claims, orchestration dispatch, by-id claims) are not stamping. Drew's order (2026-11-10) was that all tasks document the exact model; Drew re-ordered the fix today ("fix it", 2026-11-12).

    Acceptance for re-closing: a claim through the normal lane claim path reads back with claim_provider/claim_model/claim_variant populated from the claiming session, verified on the live task row — plus organic lane claims stamping without manual steps.

  5. added a commit that references this issue on Nov 12, 2026
  6. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Fixed and verified live — closing again, this time on evidence.

    Root cause (from the reopening comment): the broker/CLI stamp machinery was complete, but no production claim surface passed the flags — 4 stamped claims of 12,684 since 2026-11-10, 3 of them the acceptance worker proof-8176.

    Fix: PR #9025, merge commit 25d2a068fe03a4b26d00d6afc89f71cd1b80c385.

    • The queue client now derives the stamp from the claiming session's own server record whenever a claim names --session-id without explicit --model-* flags (fail-soft; variant only when the session carries a real effort variant). Covers dispatch_batch batch claims and every --session-id claim form.
    • dispatch_batch Muse-family claims carry the muse-lane marker; claimant's sink-collection claim stamps the launch model (opencode-route/workhorse, now a shared constant); launch_one's sink by-id claim stamps the session's route. The lane runbook's claim form carries the marker flags (companion change).
    • Broker untouched; no broker restart taken or needed.

    End-to-end verification (production queue, rebuilt client swapped into ~/.local/bin/fleet on the laptop at ~15:12 CST, backup fleet.bak-2026-11-12-8176):

    • Dispatch-style claim — fleet queue claim --worker verify-8176 --platform openchamber --session-id ses_e5e2e708de9ffeX7gG92oz7OdZ (that session's own record: opencode-route / workhorse / variant "default"), NO model flags passed. Task 15298 read back from the DB: claim_provider=opencode-route, claim_model=workhorse, claim_variant=NULL — exactly the session's model, with "default" correctly stamped as no variant. Released after read-back.
    • Lane-style claim — the runbook form (--worker repo-worker-code --lane any-a --model-provider muse-lane --model-id muse-lane). Task 15305 read back: claim_provider=muse-lane, claim_model=muse-lane, claim_variant=NULL. Released after read-back.

    Activation: CLI derivation is LIVE now (client swap; dispatch surfaces naming a session stamp automatically). The python surfaces (claimant collection, launch_one, dispatch marker) activate when the primary checkout syncs this merge — scripts are invoked per pass, nothing restarted. Muse lane shifts stamp via the runbook form immediately.

    Tests: fleet-queue lib 282 green; claimant python suites 143 green, with new stamp oracles in both.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions