Skip to content

fix(core): fail empty provider output - #37843

Open
H-TTTTT wants to merge 1 commit into
anomalyco:devfrom
H-TTTTT:fix/reasoning-only-empty-completion
Open

fix(core): fail empty provider output#37843
H-TTTTT wants to merge 1 commit into
anomalyco:devfrom
H-TTTTT:fix/reasoning-only-empty-completion

Conversation

@H-TTTTT

@H-TTTTT H-TTTTT commented Jul 20, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #37372

Type of change

  • Bug fix

What does this PR do?

A successful provider step that reached step-finish with 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 to dev'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 typecheck in packages/core.
  • oxlint on the changed files (0 errors).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v2: empty reasoning-only response is recorded as successful completion

1 participant