Repository navigation
fix(queue): make the #8176 claim-model stamp land on the real claim paths - #9025
Conversation
…aths
The broker + CLI stamp machinery shipped 2026-11-10 was complete,
but no production claim surface passed the flags: of 12,684 claimed
events since, exactly 4 carried a stamp (3 by the acceptance worker
proof-8176). The high-volume paths named sessions but never models.
- fleet-queue client: a claim that names --session-id with no
explicit --model-* flags now derives the stamp from that
session's own record on the OpenCode server (GET
/api/session/<id>, Basic auth from the server state file),
fail-soft — derivation failure never fails the claim. Variant
stamps only when the session carries a real effort variant
("default" is the absence of one). Covers dispatch_batch
batch claims and every other --session-id claim form.
- dispatch_batch: Muse-family batch claims carry the design's
muse-lane marker stamp.
- claimant: the sink handoff-collection claim stamps the launch
model (opencode-route/workhorse), now a named constant shared
with the session-create body.
- launch_one: the sink by-id claim stamps the route the session
will be created under (route_for on the row in hand).
Broker untouched — no broker restart needed or taken. The stamp
activates per surface: CLI derivation with the client binary swap,
python surfaces on the primary checkout's next sync, Muse lanes
via the runbook claim form (companion change, flags already
accepted by the deployed CLI).
Tests: fleet-queue lib 282 green (new session_model_stamp + b64
oracles); claimant python suites 143 green (new stamp argv
coverage in all three touched modules).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea19e981fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let model = inner.get("model")?; | ||
| let provider = model | ||
| .get("providerID") |
There was a problem hiding this comment.
Derive the stamp from the serving leaf rather than the route
For routed sessions such as opencode-route/workhorse, the session's model identifies the configured route, not the provider/model/effort that actually served the claim. Reading this field therefore permanently records the route alias and loses the serving-leaf attribution required by doc/fleet/queue-turso-cutover.md and pm-stack/opencode-claimant/prompt.md, which explicitly distinguishes route_usage.lastServing from the declared route. The new Python collection stamps have the same problem because they record the future session's route before it has served anything. Use the actual serving-leaf readout when available and leave the claim unstamped otherwise.
Useful? React with 👍 / 👎.
| let base = std::env::var("OPENCODE_SERVER_URL") | ||
| .ok() | ||
| .map(|s| s.trim().trim_end_matches('/').to_string()) | ||
| .filter(|s| !s.is_empty()) | ||
| .unwrap_or_else(|| "http://127.0.0.1:13420".to_string()); |
There was a problem hiding this comment.
Honor the existing OpenCode connection overrides
When the claimant tooling is configured with OPENCODE_URL or OPENCODE_AUTH_FILE, this lookup ignores both overrides: it reads a different URL variable and always loads the production credential file. claimant.py and poll.py use those existing overrides for their session operations, so the new queue-client lookup can contact a different server or authenticate with the wrong credentials. Its fail-soft return then silently leaves claims unstamped despite the configured server being available. Resolve the URL and credential file consistently with those callers.
Useful? React with 👍 / 👎.
Closes #8176 (again — this time verified live; the issue was reopened 2026-11-12 with the evidence below).
Root cause
The #8176 machinery shipped 2026-11-10 was complete and correct — broker
parse_claim_model/stamp_claim_model, CLI--model-provider/--model-id/--model-variant, DB columns — but no production claim surface ever passed the flags. Live evidence (fleet-queue DB, 2026-11-12): 12,684claimedevents since 2026-11-10, exactly 4 carrying a model stamp; 3 of the 4 were the implementer's own acceptance claims (worker literally namedproof-8176). Of 3,820 tasks completed Nov 6–12 exactly one was stamped. The one wired production path wassend_to_opencode.py's transfer claim — the lowest-volume path in the fleet. The paths that carry the volume named sessions but never models:dispatch_batch.py::claim_batch— passes--session-idof the dispatching session, no model flags.claimant.py::_collect_handed_offs— sink collection claim, no model flags.launch_one.py::collect_sink_claim— sink by-id claim, no model flags.Fix
fleet-queueclient (client.rs): a claim that names--session-idwith no explicit--model-*flags now derives the stamp from that session's own record on the OpenCode server (GET /api/session/<id>— the same recordroute_usagereads; Basic auth from the server's state file, claimant.py's route). Provider = the session'sproviderID, model = itsid, variant only when the session carries a real effort variant (the server reports"default"when none was chosen — that is stamped as no variant, never as a literal). Fail-soft by design: any failure (no state file, server down, unknown session, malformed record) leaves the claim unstamped and otherwise untouched. Explicit flags always win. This one change covers dispatch_batch's batch claims (opencode + Muse targets both name the dispatching session) and every other--session-idclaim form.dispatch_batch.py: Muse-family batch claims additionally carry the design's non-session marker (muse-lane/muse-lane) for lane-attribution queries.claimant.py: the sink handoff-collection claim stamps the launch model — the model every session this claimant creates runs (opencode-route/workhorse), now a named constant (LAUNCH_MODEL_*) shared with the session-create body so the stamp cannot drift from the launch.launch_one.py: the sink by-id claim stamps the route the session will be created under (route_foron the row in hand — the same route the create step uses).--model-provider muse-lane --model-id muse-lane, activating Muse lane shift claims immediately (the deployed CLI already accepts the flags).Paths deliberately unchanged:
send_to_opencode.pytransfers (already stamped), bind claims insideclaimant.py(bind semantics — broker stamps at claim, not bind; the claim that created the holding already stamps), and claims that name no session and no dispatch context (they stay unstamped rather than fabricate a model).Broker / deploy
Broker untouched — no broker restart needed or taken (the standing broker-restart boundary is respected; the running broker already stamps any claim that carries the fields). Activation per surface:
~/.local/bin/fleeton the laptop (user-owned file; the broker's libexec binary is a different file and is not touched).Tests
fleet-queuelib suite: 282 passed (--features queue-broker), incl. new oraclessession_model_stamp_reads_the_session_record(enveloped/bare records,default-variant normalization, half-model rejection) andb64_encode_matches_the_standard_alphabet.test_claimant,test_dispatch_batch,test_launch_one,test_send_to_opencode,test_poll), incl. new stamp-argv coverage in all three touched modules.End-to-end verification
Performed against the production queue with the rebuilt client before merge (task ids + stamped values are in the closing comment on #8176): a dispatch-style claim (real queued task,
--session-idof a live workhorse session, no model flags) read back stamped from the session's own record; a lane-style claim with the runbook form read back stampedmuse-lane; both tasks released after read-back.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.