Skip to content

fix: stop empty unknown provider response loop - #51290

Open
tita-n wants to merge 1 commit into
anomalyco:devfrom
tita-n:stream-issue
Open

tita-n wants to merge 1 commit into
anomalyco:devfrom
tita-n:stream-issue

Conversation

@tita-n

@tita-n tita-n commented Sep 25, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #32366

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When a provider returns an empty response with an unknown finish reason, the session prompt loop can continue creating new assistant turns indefinitely. The session remains busy, leaving the UI stuck on “thinking” without displaying an error or recovering to an idle state.

This PR checks the completed assistant turn before continuing the prompt loop. If the finish reason is unknown and the turn contains no text, reasoning, or tool output, it records a Provider returned an empty response error, publishes the session error, and returns the session to an idle state.

Turns that contain output continue through the existing path, so the change is limited to genuinely empty provider responses.

A deterministic test-provider response and a CLI regression test were added for this case.

How did you verify your code works?

I tested the changes locally with:

  • bun typecheck
  • bun test --timeout 30000 test/session/processor-effect.test.ts
  • bun test --timeout 30000 test/cli/run/stream.transport.test.ts
  • The new empty-response CLI regression test

The regression test confirms that an empty unknown provider response exits promptly with a nonzero status and reports the expected error.

Screenshots / recordings

Not applicable; this is a backend/CLI behavior change.

Checklist

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

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

This branch has not been deployed

No deployments
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.

bug: UI stuck on 'thinking' indefinitely after stream error, no error displayed or state recovery

1 participant