fix(opencode): retry empty reasoning turns - #140
Open
MagMueller wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
MagMueller
force-pushed
the
gemini-empty-retry
branch
from
August 3, 2026 02:38
abb3dd4 to
fcdfc9b
Compare
MagMueller
force-pushed
the
gemini-empty-retry
branch
from
August 3, 2026 02:39
fcdfc9b to
dccd374
Compare
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.
Root cause
Gemini can return a protocol-valid
stopafter reasoning without emitting text or a tool call. BrowserCode treated that semantically empty turn as complete, so Cloud later had no final response to surface.Fix
Retry the identical model request once when a text-mode
stop/unknownturn emits neither nonblank text nor a completed tool call. A second empty turn becomes an explicit non-retryable API error. Structured output, compaction, content filters, output limits, text, and tool calls keep their existing behavior.The retry is action-safe because the rejected attempt emitted no tool call. This is a surgical Yellow-zone change at the stream semantic boundary.
Validation
bun run typecheckinpackages/opencodeSummary by cubic
Retry empty reasoning turns in
packages/opencodeonce; if the model stops twice without text or a tool call, surface a non‑retryableSessionV1.APIError. This prevents silent “no final answer” states with Gemini.stop/unknownwith neither emitted andtoolChoicenotrequired, retry the identical request once. On a second empty turn, throwSessionV1.APIError(not retryable). Do not retry if any nonblank text was emitted.SessionV1.APIErrorinstances instead of wrapping them.Written for commit dccd374. Summary will update on new commits.