fix(session): fail empty assistant responses instead of recording success - #41804
fix(session): fail empty assistant responses instead of recording success#41804patil2001 wants to merge 1 commit into
Conversation
…cess A terminal assistant step that produces no usable output (no text, no tool calls, no non-empty reasoning) was recorded as a successful execution. This surfaced as a silent no-op turn for the user. Treat a settled step with no usable output as a typed empty-response failure so clients can surface the error instead of stopping silently.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found a potential duplicate: PR #37843:
This is likely related to the same problem space (handling empty provider responses) and may have been a previous attempt or partial fix. You should verify whether #37843 already resolves issue #37372 or if the current PR #41804 is addressing a remaining gap or different aspect of the problem. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Summary
V2 recorded a reasoning-only assistant response with no visible text and no tool calls as a successful execution. When a provider settled a step with an empty completion (six output tokens, no publishable content), the runner emitted
session.step.ended.1withfinish: "stop"followed bysession.execution.succeeded.1, leaving the user with neither an answer nor a surfaced failure.Changes
packages/core/src/session/runner/publish-llm-event.ts: track whether a step produced usable assistant output (non-empty text, non-empty reasoning, or a tool call).packages/core/src/session/runner/llm.ts: when a step settles without usable output, publishStep.Failedwith a typed"Provider returned an empty response"error instead of a successfulStep.Ended.Test plan
bun test --timeout 30000inpackages/corepasses (1080 pass / 0 fail);tsgo --noEmitclean.Fixes #37372