Repository navigation
feat(discuss): retry a participant turn or scribe call once after a provider timeout - #791
Merged
Merged
Conversation
…rovider timeout (#756) A timeout cost a whole resume cycle for a participant turn and the scribe digest was refused at the first one. The driver now repeats such a call once when the provider failed with its own timeout and nothing else (not 4xx/5xx, not other errors). The retry is reserved and settled like any call, so the discussion budget and the goal pot still hard-stop it, and the ledger records it as a reservation with retry_of naming the timed-out call; the ledger refuses a second retry of a call and a retry of a retry. A second timeout fails the turn as before. The checker is unchanged.
Threat-model row and changelog entry for the one retry of a timed-out participant or scribe call.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Nov 15, 2026
ajianaz
added a commit
that referenced
this pull request
Nov 15, 2026
…s estimate when no usage is reported (#804) (#805) A call that failed with no reported usage settled at 0 tokens, so a discussion budget (a hard cap) could be exceeded without the ledger knowing, and the retry of #791 doubled the exposure. A call that fails with no reported usage after the request may have left now settles at its reserved estimate, never more than its own carve, and the settle record carries charged: timeout or charged: unreported. Reported usage still wins and a successful call without usage keeps its estimate. The classifier request_may_have_been_sent is a closed list of anchored prefixes for failures before the send (host not found, connection failed, timeout: connect and timeout: resolve, bad uri, invalid proxy url, TLS handshake errors, the image-input pre-check); anything else, unknown text included, and any failover chain is charged. charged is an optional field of the settle event, skipped when absent, so old ledgers and readers still work, and a settle is final so a resume never charges a call twice. The driver charges both the ledger and the goal pot, the retry still goes through admit (two timeouts cost two estimates and the budget stops the discussion at the cap), and tole audit --discussion now lists rounds that only have reservations, with retries and the charged calls in text and --json. Closes #804
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
In the discussion driver, a participant turn or scribe call that fails with the provider's own timeout is made once more before the turn fails. Second ask of #756 (the knob itself is #786).
Why
A timeout cost a whole resume cycle for a participant turn, and the scribe's digest was refused at the first timeout (round passed on as written). One retry absorbs the occasional slow generation without changing what the discussion may spend or decide.
Changes
failover::is_timeout_error:timeout: <phase>, or the same after thejson:prefix of a reply cut while read). Anchored: anhttp status: 4xx/5xx(whatever its body says),io:,malformed, stream and capability errors never retry.Driver::calltakes aretryflag: true for participant turns and the scribe, false for the checker. At most one retry per call, a bounded loop with no recursion. A second timeout fails the turn exactly as before (resumable ledger).admit, so the discussion budget and the goal pot still hard-stop it (a retry that does not fit records the budget escalation and no second call runs), it is settled, and charged to the pot. A timed-out call keeps the existing accounting (what the provider reported, nothing when it reported nothing).Event::Reservegains an optionalretry_of(the audit note), skipped when absent, so ordinary reservations are written exactly as before and older readers ignore the field.DiscussionLog::reserve_retryenforces the rules in the ledger itself: the original must be settled, of the same round and kind, not itself a retry, and not retried before. The gate,max_rounds, rosters and the dissent rules are untouched.tole audit --discussionshows how many calls of a round were retried; the outcome carries a note per retry.Testing
retry_of; a second timeout fails the turn with exactly two calls and a resume goes on; no retry for 500,http status: 504 ... timeout, 429, 400, io, malformed, stream-read and thread-died errors (while the body-readjson: timeout: globalform is one); scribe retried once (digest used) and a second timeout falls back as before with dissent passed on; the checker is not retried; a retry that does not fit the discussion budget or the goal pot is the hard stop with a single call.is_timeout_error.cargo fmt,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace.Closes #756