Repository navigation
fix(discuss): charge a timed-out call its estimate and show incomplete rounds in the audit - #805
Merged
Merged
Conversation
…e rounds in the audit (#804) A call that fails with no reported usage after the request may have left settles at its reserved estimate (bounded by its carve) with a charged note, instead of 0. Only a failure before the request left stays free. tole audit --discussion lists rounds that never completed with their retries and charged calls.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
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
A discussion call that fails with no reported usage after the request may have left (a transport timeout above all) is charged its reserved estimate instead of 0.
tole audit --discussionnow also lists rounds that never completed, with their retries and charged calls.Why
A timed-out call settled at 0 tokens, so the discussion budget (a hard cap) could be exceeded without the ledger knowing, and the retry of #791 doubled the exposure. The live E2E of #756 showed
tokens_used0 after two real provider calls. A timeout is the same kind of unknown as a crash, which is already charged the whole carve.Changes
tole_core::failover::request_may_have_been_sent: closed list of anchored prefixes for failures that provably came before the request left (refused connection, DNS,timeout: connect/resolve, bad URL, TLS handshake). Anything else, an unknown text included, and any failover chain is charged.DiscussionLog::settle_charged: settles at the call's own estimate (never more) and recordscharged(timeoutorunreported) on thesettleevent. The field is optional and skipped when absent, so old ledgers and readers are unaffected. The settle stays final, so a resume never charges a call twice.attempt: reported usage wins as before; no usage plus a possibly-sent failure is charged to the ledger and the goal's pot. The retry still goes throughadmit: two timeouts cost two estimates and the budget stops the discussion with the existing escalation.--json): rounds with only reservations are listed;charged: [{call, why, tokens}]added.docs/automation-design.md, threat model row, CHANGELOG under Unreleased.Testing
unreported, goal-pot charged, classifier table, ledger format compatibility, incomplete-round audit output.cargo fmt,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspacepass locally.Closes #804