fix(bedrock): retry Converse Streaming on transient connection drops (#87876)#95641
fix(bedrock): retry Converse Streaming on transient connection drops (#87876)#95641jincheng-xydt wants to merge 1 commit into
Conversation
…penclaw#87876) Bedrock Converse Streaming silently drops the connection after ~6 minutes on large prompts, leaving no transcript, no retry, and no fallback model attempt. This adds one automatic retry for transient stream failures. - Wrap client.send() + stream iteration in a retry loop (max 1 retry) - Classify errors with isTransientBedrockStreamError(): - Transient: InternalServerException, ServiceUnavailableException, ModelStreamErrorException, AbortError, socket/network errors - Permanent: ValidationException, ThrottlingException, auth errors - Create a fresh BedrockRuntimeClient on retry for clean TCP connection - Reset output content and usage on retry - Add regression tests for retry behavior and error classification Fixes openclaw#87876 Co-Authored-By: Claude <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed June 22, 2026, 12:34 AM ET / 04:34 UTC. Summary PR surface: Source +79, Tests +191. Total +270 across 2 files. Reproducibility: yes. at source level for the review blockers and the reported issue shape. The linked production issue supplies live failure evidence, current main has no Bedrock stream retry, and the PR head shows retry can occur after visible events; I did not run a fresh live AWS Bedrock reproduction. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the Bedrock-local recovery direction, but make retry event-safe, align classifier/tests with real AWS exception shapes, add stream-consumer regression coverage, and require redacted live Bedrock proof or a maintainer-stated proof blocker. Do we have a high-confidence way to reproduce the issue? Yes, at source level for the review blockers and the reported issue shape. The linked production issue supplies live failure evidence, current main has no Bedrock stream retry, and the PR head shows retry can occur after visible events; I did not run a fresh live AWS Bedrock reproduction. Is this the best way to solve the issue? No, not as proposed. Bedrock-local retry is the right owner boundary, but this implementation must avoid retrying after visible stream events and must make the classifier/tests match the actual AWS and runtime error contracts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a594d2ce7325. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +79, Tests +191. Total +270 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Real behavior proof (live test output)Behavior or issue addressed: Real environment tested:
Exact steps or command run after the patch: After-fix evidence: Observed result after fix:
What was not tested:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Closing — cleaning up open PRs. |
Summary
"This operation was aborted"and all work is lost (Bug: Bedrock Converse Streaming silently aborts on long-context agent sessions (~6 min timeout, no retry, no fallback) #87876).client.send()+ stream iteration in a retry loop that retries once on transient stream failures. Create a freshBedrockRuntimeClienton retry to re-establish TCP connection.isTransientBedrockStreamError()classifier that treatsInternalServerException,ServiceUnavailableException,ModelStreamErrorException,AbortError, and socket/network errors as transient.ValidationException,ThrottlingException, and auth errors are permanent (no retry).Real behavior proof
Behavior or issue addressed:
Bedrock Converse Streaming silently drops the connection after ~6 minutes on large-context prompts, causing total session loss with no retry or fallback.
Real environment tested:
Node.js v22.x, vitest test runner with mocked BedrockRuntimeClient.send().
Exact steps or command run after the patch:
After-fix evidence:
All 11 new tests pass:
Bedrock stream retrydescribe block (5 tests): retry on InternalServerException, ServiceUnavailableException, ModelStreamErrorException; no retry on ValidationException, ThrottlingExceptionisTransientBedrockStreamErrordescribe block (6 tests): proper classification of transient vs permanent errorsObserved result after fix:
On a transient stream failure (internal server error, service unavailable, network abort), the Bedrock adapter retries the request once with a fresh client, providing a second chance before letting the failure propagate to the model fallback engine. Permanent errors (validation, throttling, auth) fail immediately without retry.
What was not tested: