Repository navigation
record model attempts without changing selected turn usage - #437
Merged
Merged
Conversation
Persist terminal model.called facts for real dispatches, including retries, helpers, discarded completions and interrupted streams. Preserve actual model selections and unknown, partial or final reported usage while keeping selected run and turn totals unchanged. Keep recording durable through bootstrap and late helpers, retain one acknowledgment per attempt and stop replay after recording failures. Price the call ledger through turn-owned telemetry, add its conformance kit and readers, and advance the stored format to 9 while retaining released journal compatibility.
Name recordCompletion's TurnError through core's own session module so the emitted declaration does not infer an SDK dependency through its re-export. The annotation leaves the generated runtime code unchanged.
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.
What
Model-call accounting now retains retries, discarded responses, interrupted streams and helper completions with the actual invoked model and unknown, partial or final reported usage. Stored format 9 adds
model.called; the public APIs addCurrentModelCallRecorder,recordCompletion,turnModelCallsOfandturnBilledUsageOf. Selected run and turn usage keeps its existing meaning.The recorder flushes before retry or Agent tool admission, keeps one terminal acknowledgment per attempt, and preserves recording failures across SDK boundaries. Turn-owned telemetry includes bootstrap and late-finalizer helpers, reports coverage and unpriced calls, and avoids counting selected usage twice.
UtilityCompletion.modeloptionally exposes the actual selection. Released journal fixtures and golden prompts remain compatible; only the current unreleased fixture is refreshed.Checks
These key-free fixtures establish framework and protocol behavior. Reported subtotals, unknown usage and terminal-only crash gaps do not establish an exact provider invoice.