Repository navigation
Resend a model step after a mid-stream gateway failure - #190
Merged
Merged
Conversation
With BCODE_STREAM_RETRY set by the Cloud V4 worker, mid-stream gateway errors in the Chat Completions (bare message), Anthropic (api_error, overloaded_error) and unprefixed Responses shapes now take the existing same-route transport recovery: at most two resends, never after a tool executed. Content policy refusals and request rejections stay terminal; without the variable nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Red-green (local test Red on main (3 production shapes not recognised): Green on this branch: |
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
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.
Cloud V4 BrowserCode runs fail when a provider error arrives after the reply started streaming (about 6 runs a day): the gateway sends it in shapes that
parseStreamErrordoes not recognise (the Chat Completions SDK passes only the message string, the Anthropic SDK passes{type: "api_error", message}, and Responses carriesupstream_stream_failedwithout a transport prefix), so it becomesUnknownErrorand the run ends. WithBCODE_STREAM_RETRYset (the Cloud worker sets it per project through thestream-retryrelease switch), those shapes map to the existingupstream_stream_failedtransport recovery: at most two resends of the same request on the same model, never after a tool executed, removing only the failed attempts parts. Only the gateways transport prefixes and its three generic failure messages qualify, so refusals, request rejections and context overflow stay terminal; without the variable nothing changes. Red-green: a local table test over the exact production error values (packages/opencode/test/zz_midstream_retry_local.test.ts, kept out of the repo) fails 3/7 on main and passes 7/7 here; the existing gateway transport recovery tests pass 7/7 and typecheck is clean. Codex review found two over-broad matches (Anthropic and Responses permanent errors), both fixed and re-verified.Changelog
🤖 Generated with Claude Code
Summary by cubic
Fixes Cloud V4 BrowserCode runs failing when a provider error arrives after the reply started streaming. The model step is now retried up to twice on the same model instead of ending the run.
Bug Fixes
api_error/overloaded_error), and Responses (unprefixedupstream_stream_failed) to the existingupstream_stream_failedrecovery.BCODE_STREAM_RETRYflag to gate the new behavior; without it, nothing changes.Written for commit 570d997. Summary will update on new commits.