Skip to content

fix: stop empty unknown provider response loop - #51289

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

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 #

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 and never reports a useful error to the user.

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 are left on the existing continuation path, so this change is limited to genuinely empty provider responses.

I also added a deterministic test-provider response and a CLI regression test covering the empty-response case.

How did you verify your code works?

I verified the change 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 empty-response regression now exits promptly with a nonzero status and reports the expected provider 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 github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No issue referenced. Please add Closes #<number> linking to the relevant issue.

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.

@github-actions

Copy link
Copy Markdown
Contributor

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

@tita-n tita-n closed this Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant