Skip to content

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

Open
akirarat wants to merge 2 commits into
anomalyco:v2from
akirarat:missing-response-recovery
Open

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

Conversation

@akirarat

@akirarat akirarat 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 stop or fail after producing only reasoning or whitespace, leaving the session with no answer or tool call. OpenCode currently treats some of these attempts as successful and ends the run silently.

This change tracks whether an attempt produced a non-whitespace answer or any tool activity. A normal stop that reports output tokens but no usable content gets one bounded continuation. A provider failure after reasoning or whitespace uses the existing bounded incomplete-stream recovery path. Failures after visible text or tool activity remain terminal so completed work is not replayed.

How did you verify your code works?

  • bun test test/session-runner.test.ts --timeout 30000 in packages/core (Bun 1.3.14; 178 pass)
  • bun run typecheck in packages/core
  • Prettier check on all four changed files

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-actions github-actions Bot 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-actions github-actions Bot 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. 👍

@akirarat
akirarat force-pushed the missing-response-recovery branch from 2b3fc45 to 0e960a3 Compare August 26, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant