Skip to content

fix(core): recover missing assistant responses - #44806

Open
akirarat wants to merge 1 commit into
anomalyco:v2from
akirarat:missing-response-recovery
Open

fix(core): recover missing assistant responses#44806
akirarat wants to merge 1 commit into
anomalyco:v2from
akirarat:missing-response-recovery

Conversation

@akirarat

@akiraratakirarat commented Aug 24, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#42677

Type of change

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

What does this PR do?

A provider can finish with stop after producing no non-whitespace answer or tool call. OpenCode currently records that attempt as successful and ends the session silently.

This change classifies that result as incomplete provider output. Completely empty attempts use the existing transparent retry path. Attempts that contain reasoning or whitespace but no answer use the existing incomplete-stream continuation path, preserving the partial context while asking the model to finish. Normal text and tool-call completions remain terminal.

How did you verify your code works?

  • bun test --only-failures test/session-runner.test.ts (164 pass)
  • bun test test/session-runner-tool-events.test.ts (17 pass)
  • bun typecheck (32 packages)

Screenshots / recordings

Not a UI change.

Checklist

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

@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-actionsgithub-actionsBot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Related PRs Found

The current PR (#44806) has several related PRs addressing similar issues with provider responses and session recovery:

  1. fix(ai): backfill terminal reasoning state #44605 - fix(ai): backfill terminal reasoning state - Related to handling reasoning state in responses
  2. fix(core): recover partial provider failures #44002 - fix(core): recover partial provider failures - Similar recovery mechanism for provider failures
  3. fix(session): fail empty assistant responses instead of recording success #41898 - fix(session): fail empty assistant responses instead of recording success - Directly related to handling empty responses
  4. fix(opencode): retry empty unknown responses #41466 - fix(opencode): retry empty unknown responses - Related to retrying empty responses
  5. fix(opencode): drop truncated reasoning from replayed history #40148 - fix(opencode): drop truncated reasoning from replayed history - Related to handling incomplete reasoning
  6. fix(opencode): fail runs when the model stream ends without a finish … #40061 - fix(opencode): fail runs when the model stream ends without a finish … - Related to incomplete provider output
  7. fix(opencode): make long-lived provider streams robust to silent SSE terminations #39970 - fix(opencode): make long-lived provider streams robust to silent SSE terminations - Related to stream reliability

Most notably, #41898 appears to be the most closely related, as it addresses the specific issue of failing on empty assistant responses rather than silently recording them as success.

@github-actionsgithub-actionsBot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@akirarat