fix(coding-agent): reject empty advisor stop completions#5216
Merged
Conversation
Treat content-less advisor stop completions as failed turns so the advisor retry/drop path handles silent provider responses instead of accepting them as successful reviews. Fixes #5212
This was referenced Jul 11, 2026
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.
Repro
A focused advisor-runtime regression models a provider returning HTTP 200 with
finish_reason: stop,content: [], zero usage, noadvisetool call, and nostate.error. On the pre-fix HEAD worktree,bun test packages/coding-agent/src/advisor/__tests__/advisor.test.ts -t "treats an empty stop turn without advise as a failed advisor turn"failed withExpected length: 3, Received length: 1, showing the first empty stop was accepted as success instead of retried.Cause
packages/coding-agent/src/advisor/runtime.tsonly inspectedagent.state.errorafterAdvisorAgent.prompt(). Empty successful-looking assistant turns withstopReason: "stop"and no content/tool call leftstate.errorundefined, soAdvisorRuntime.#drain()marked the batch successful, reset consecutive failures, and decremented backlog.Fix
onTurnError, retry, and the three-failure backlog drop +notifyFailurewarning.stopresponse shape, retry count, failure hooks, rollback behavior, and no-advice output.Verification
bun test packages/coding-agent/src/advisor/__tests__/advisor.test.ts -t "treats an empty stop turn without advise as a failed advisor turn"passed with 1 test and 36 assertions.bun test packages/coding-agent/src/advisor/__tests__/advisor.test.tspassed with 73 tests and 299 assertions.bun run fixpassed after adding the exhaustive callback return. The pre-publish gate ingh_push_branchcompleted and pushed8608395eefb2. Fixes #5212