Repository navigation
feat: retry a timeout-classified provider failure once per turn - #62
Merged
Merged
Conversation
A provider global timeout at turn start killed entire missions before any tool ran, while the same durable session completed end-to-end on a manual resume. Drive() now retries a timeout-classified provider error once per turn (not per step): the failed step commits nothing, so the transcript is unchanged; the retry decision is appended as a durable ERROR entry before the retry fires. Non-timeout errors and second timeouts keep the existing abort path. Closes #58
🔍 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 (description of the change)
The turn loop (
drive()) now retries a timeout-classified provider error once per turn before surfacingProviderFailed. Budget is per turn (PROVIDER_TIMEOUT_RETRIES = 1), not per step, so a flapping gateway gets at most one extra call per turn. The retry decision is recorded as a durable ERROR entry ("provider timeout, retrying") before the retry fires.MockProvider::scripted_with_failuresis added so provider failures are scriptable in tests.Why (the problem you're solving)
Issue #58: a provider global timeout at turn start killed entire missions before any tool ran (vetio 8-icon mission, 2026-09-11), while the same durable session completed end-to-end on a manual resume — proving the failure was transient, not fatal. Nuance vs the issue text: the upstream budget that actually binds is tole's own 120s default request timeout (gateway default is 300s); the retry protects the turn either way.
Testing (how you verified this works)
4 new regression tests in
turn_loop.rs(all pass, 21/21 in the suite):provider_timeout_retried_once_then_succeeds— timeout → retry → Final, exactly one durable retry record.provider_timeout_second_failure_aborts— second timeout aborts withProviderFailed(1 retry + 1 failure record).non_timeout_provider_error_not_retried— 401-class errors keep the immediate-abort path.flapping_timeout_retries_only_once_per_turn— timeout → success → timeout: no second retry.Full gate:
cargo fmt --checkclean,clippy -D warnings0 findings,cargo test --workspacegreen. Safe-by-construction: a failed provider step commits nothing, so the retried transcript is identical; turn-level ERROR entries are excluded from the wire request body (no parent intent → skipped), so the retry cannot poison the context.Closes #58