Skip to content

fix(core): preserve raw unknown finish diagnostics - #56508

Open
rudycelekli wants to merge 1 commit into
anomalyco:devfrom
rudycelekli:finish-diagnostic
Open

rudycelekli wants to merge 1 commit into
anomalyco:devfrom
rudycelekli:finish-diagnostic

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 17, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #44092

Type of change

  • Bug fix

What does this PR do?

Include the JSON-escaped raw provider finish reason in unknown-finish errors when it is available. Keep the existing message when absent, and preserve classification and retry behavior.

How did you verify your code works?

  • Actual SessionRunner regression covers raw values, quotes/newlines, an empty string, and absent metadata; verifies the thrown error, stored assistant error, projection replay, and retry decision. Three failures before the fix; 40 repeated focused passes after.
  • Source-bound Linux qualification: strict baseline oracle, focused tests, full Core suite, Core typecheck, and root bun run check pass.

Screenshots / recordings

No visual UI change; errors and stored/replayed results are asserted directly.

Checklist

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

Added by the opencode bot (AI-generated).

Related: #34835, #44695

@github-actions

Copy link
Copy Markdown
Contributor

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

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct. The new tests fail on the base for the three cases with a raw finish reason and pass with this change. The full session-runner.test.ts (233 tests) and the packages/core typecheck pass. Classification (incomplete-stream) and retry behaviour are unchanged, and the test checks that the retry hook still sees retry: true.

Public API: unchanged (only the error message text changes).

One gap worth a follow-up or a small addition here: compaction builds the same InvalidProviderOutputError in packages/core/src/session/compaction.ts (around line 549) and still drops the raw value (event.reason.raw). An unknown finish during compaction will still show the generic message.

Also note that #54713 edits the same lines in step.ts, so whichever lands second will need a rebase. It formats its raw reason as (x) rather than : "x", so it would be good to settle on one format.

Related: #34835, #44695

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.

core(v2): "unknown finish reason" error omits raw provider finish_reason

1 participant