fix(core): fail empty provider output - #37843
Open
H-TTTTT wants to merge 1 commit into
Open
Conversation
A successful provider step that finished (step-finish arrived) with no visible text and no tool calls was recorded as a successful completion, leaving clients with neither an answer nor a failure to surface. Track usable assistant output (non-whitespace text or a tool call) in the LLM event publisher and, when a finished step produced none, fail the assistant step instead of emitting step.ended. Reasoning and whitespace text are still preserved on the failed assistant message. Fixes anomalyco#37372
This was referenced Aug 4, 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.
Issue for this PR
Fixes #37372
Type of change
What does this PR do?
A successful provider step that reached
step-finishwith no visible text and no tool calls was recorded as a successful completion. Downstream clients received neither an answer nor a failure, so the user's turn was silently dropped even when the response reported nonzero output tokens.The LLM event publisher now tracks usable assistant output (non-whitespace text or a tool call). When a finished step produced none, the assistant step is failed (
session.next.step.failed) instead of ended (session.next.step.ended), and the run does not continue. Reasoning and whitespace-only text are still preserved on the failed assistant message.Ports the V2 fix (#37379) to
dev, adapted todev's error/event model.How did you verify your code works?
bun test test/session-runner.test.ts— 85 passed, including new regression tests for an empty finished step and a reasoning-only response with whitespace text and nonzero tokens.bun test test/session-projector.test.ts test/session-runner-message.test.ts test/session-runner-recorded.test.ts test/session-runner-tool-events.test.ts test/session-runner-model.test.ts test/session-runner-tool-registry.test.ts— 51 passed.bun run typecheckinpackages/core.oxlinton the changed files (0 errors).Checklist