fix(agent): continue unattended turns after transient upstream stream failures#3395
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Reviews (1): Last reviewed commit: "fix(agent): continue unattended turns af..." | Re-trigger Greptile |
9845016 to
8fb35f0
Compare
There was a problem hiding this comment.
Well-bounded retry wrapper with correct per-turn counter scoping, session null-guard on every attempt, and proper differentiation between mid-stream deaths (continuation) and pre-stream failures (re-send original prompt). All three bot-identified concerns are demonstrably resolved in the code, with test coverage for each scenario.
… failures Initial and resume turns run unattended in cloud sandboxes — there is no user watching who could retry — yet handleTurnFailure only treats follow-up turns in interactive mode as recoverable. A single transient upstream stream death during the initial or resume turn therefore failed the whole task run and tore down the sandbox. Give those turns a bounded (2 per turn) number of automatic retries when the failure classifies as a transient upstream failure. A stream that died mid-response already delivered the original prompt into the session history, so that case retries with a hidden continuation prompt; failures where the request may never have been processed re-send the original prompt instead. The session is re-read on every attempt so a teardown or re-initialization during the retry delay cannot route the retry to a stale session. Non-upstream errors and exhausted budgets fail exactly as before.
8fb35f0 to
cac7efd
Compare
New commits pushed (delta classified non_linear_history) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
Well-scoped resilience fix with per-turn-local retry counter, session re-read on each attempt, and correct differentiation between mid-stream deaths (continuation) and pre-stream failures (original prompt re-send). All three bot-flagged concerns were addressed and the implementation is backed by good test coverage.
Problem
handleTurnFailureonly treats follow-up turns in interactive mode as recoverable, so a single transient upstream stream death during the initial or resume turn fails the entire run, tears down the sandbox, and throws away the whole turn's work (and its token spend)Changes
promptWithUpstreamRetryfor initial and resumed turns. On transient upstream failures, wait 5 seconds and retry automatically: stream interruptions resume with a hidden "continue from where you left off" prompt, while connection, timeout, and provider failures re-send the original prompt