Repository navigation
fix(core): continue after an empty model response - #61530
kitlangton wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
The change works. On the base, a reasoning-only response that finishes with stop leaves the session idle with nothing but "Thought". With this PR, OpenCode sends one continuation request and shows the follow-up answer. If the model keeps returning nothing, the TUI shows "The model returned no answer or tool calls after one retry" after a single retry. I checked this by driving the TUI with the simulated model on both checkouts. The three runner test files pass (284), and tsc -b for packages/core is clean.
The public API is unchanged: the new Empty step outcome and the empty record field are internal to the runner.
One thing to be aware of, not blocking: on strict OpenAI-compatible providers (e.g. Kimi), the retry replays the reasoning-only assistant turn with empty content. That can get a 400 instead of continuing, the same failure as #60292. It is still a visible error rather than a silent stop.


Issue for this PR
Closes #55378
Type of change
What does this PR do?
An empty successful model reply gets one chance to continue instead of silently stopping the session. Seen with a Gemini model after compaction, but the recovery applies to every provider.
❌ Before
✅ After
👀 Read:
runner/step.tschecks for an empty response only after cancellation and errors have been handled.runner/llm.tsbounds recovery without resetting the agent's step allowance.How did you verify your code works?
The compaction regression failed before the fix. Existing completion fixtures now return a short answer instead of an empty stop.
Checks run
From
packages/core:bun run test test/session-runner.test.ts test/session-runner-tool-events.test.ts test/session-runner-recorded.test.ts: 284 pass, including cancellation, errors, and mixed-recovery coverage.bun typecheck: passed.From the repository root:
bun run check: passed, including the final pre-push hook; existing lint warnings, no errors; all 35 typecheck tasks passed.Visual
Checklist
Added by the opencode bot (AI-generated).
Fixes #59518
Fixes #46880
Related: #60292, #59051, #52015