Repository navigation
feat: record the side asked for and the side that answered on every model call - #1094
Merged
Merged
Conversation
A call through the OpenAI-compatible adapter now records the side abcd asked for (the prompt's SHA-256 and the field the adapter added) and the side that answered (the upstream provider, generation id, finish reason, prompt, completion, reasoning and cached token counts, and the cost) as the response names them, and lists every field of the fixed lists it could not pin with its reason. The request asks for usage in the stream unless the provider block sets stream_usage to false, and a refusal of such a request names that setting. The harness hand-off's receipt lists the payload's model as self-reported. Assisted-by: Claude:claude-opus-5-5
A run through the claude or opencode runner now records the model the runner passed and the prompt's hash beside what the harness reports: the claude runner reads the result event's token counts, cost, stop reason and per-model usage and the init event's version, from a fixture taken from a real stream; the opencode runner sums its step-finish events' tokens and cost. Each lists every field of the fixed lists it could not pin, its cost as computed by the harness. The opencode runner no longer stamps the asked model as the served one: run mode names no model, so the served model is empty and listed as not reported. Refs: iss-2610161709506207 Assisted-by: Claude:claude-opus-5-5
A runner's route record on a verified receipt or a validator's return now carries both sides of the run, which the drive passes through from the runner's answer. The run state moves to schema version 13: a version-12 file reads as a run whose routes recorded neither side and is written back at 13, and a file of version 12 or lower carrying either side is refused. The state's mask covers every new string and slice. Assisted-by: Claude:claude-opus-5-5
A runner's route line names the model the runner asked for and the cost when the route carries them, and a dispatched step's line names the upstream provider and the cost the call reported. The consistency answer's kept route file carries both sides of the call whole, with no new file beside it. The golden harness receipts list the hand-off's unpinned fields. Assisted-by: Claude:claude-opus-5-5
Assisted-by: Claude:claude-opus-5-5
Refs: iss-2610170934491794 Assisted-by: Claude:claude-opus-5-5
A 400 or 422 to a request that asked for usage in the stream now carries the stream_options hint only when its body names stream_options or include_usage; any other refusal reads as it did before. Every such refusal is told apart as ErrUsageRefused, which only a setup acts on. Assisted-by: Claude:claude-opus-5-5
The setup's verification call asks for usage in the stream; a server that refuses that request with HTTP 400 or 422 is now asked once more without it, and when that succeeds the block connect creates carries stream_usage false and the result says so in its text and JSON forms. --stream-usage sets the value outright. Ordinary calls are still never retried, and a refusal on the setup path names the flag, not a block the setup has not written. Resolves: iss-2610170934491794 Assisted-by: Claude:claude-opus-5-5
The adapter now reads the prompt, completion and total counts as pointers, so a count that is absent or of another type is listed in the call record's unpinned on its own, never recorded as a zero the provider did not report. A later usage chunk that reads fewer fields no longer replaces an earlier, fuller one, and a usage member with no readable field is no usage at all. Assisted-by: Claude:claude-opus-5-5
opencode's summed cost is dropped and listed as not reported once the sum stops being finite, so a run's state still writes, and a token sum that would overflow is unreadable rather than wrapping negative. claude's counts are read only when present and not negative. One cost rule, ReadableCost (zero or more, finite), now covers opencode's steps, claude's total_cost_usd and the adapter's usage cost. Assisted-by: Claude:claude-opus-5-5
Assisted-by: Claude:claude-opus-5-5
The test asserts two calls, a refusal and one retry, then no third; its old name said nothing was retried. Refs: iss-2610170934491794 Assisted-by: Claude:claude-opus-5-5
A setup whose first verification is refused for the usage field asks once more without it, so the brief and the command page no longer say one call, and the help sentence drops the count. Refs: iss-2610170934491794 Assisted-by: Claude:claude-opus-5-5
Closes spc-2610170652111963, which moves itd-166 to shipped, and resolves the opencode runner stamping the asked model as the served one. Delivers: itd-166 Resolves: iss-2610161709506207 Refs: iss-2610161734413178, iss-2610161734428291, iss-2608290811463906 Assisted-by: Claude:claude-opus-5-5
The intent audit met six criteria and met two with concerns. Decision 4 now says what was built: ordinary calls never retry, and connect asks its verification once more without the usage field. A runner on a local model listing no local fields is captured for the local pin to close. Refs: iss-2610171545099084, iss-2610161734428291 Assisted-by: Claude:claude-opus-5-5
encoding/json reads a null into a number as 0 with no error, so a provider answering null for a count it has none of was recorded as reporting zero. Refs: iss-2610161709506207 Assisted-by: Claude:claude-opus-5-5
Assisted-by: Claude:claude-opus-5-5
A shipped intent may name only resolved issues. The record itd-166 grew from was declined as its duplicate; itd-166 has now delivered it, so it is resolved. The OpenRouter and local pins refine itd-166 later and are not delivered by it, so their link moves to the typed-links prose only. Refs: iss-2608290811463906, iss-2610161734413178, iss-2610161734428291 Assisted-by: Claude:claude-opus-5-5
…resolved Refs: iss-2608290811463906 Assisted-by: Claude:claude-opus-5-5
Only the oracle's own receipt reaches it in production, so it is unexported, and the surface tests that build a harness receipt reach it through a ForTest seam, as the exported-reach audit requires. Assisted-by: Claude:claude-opus-5-5
REPPL
enabled auto-merge
October 18, 2026 10:41
Assisted-by: Claude:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ships itd-166: every model call abcd makes now records two sides, what it asked for and what actually answered, on the receipts that already exist.
stream_options.include_usage); a provider whose server refuses it can turn that off withstream_usage: false, andahoy connectasks its verification once more without the field after a 400 or 422 and writes that setting. Ordinary calls never retry.Delivers: itd-166
Resolves: iss-2610161709506207
Resolves: iss-2610170934491794
Resolves: iss-2608290811463906
Refs: iss-2610161734413178
Refs: iss-2610161734428291
Refs: iss-2610171545099084
Refs: iss-2610180052110870
Assisted-by: Claude:claude-opus-5-5