Skip to content

fix(ai): enforce chat finish reasons - #44743

Merged
rekram1-node merged 4 commits into
v2from
finish-reason-parity
Aug 25, 2026
Merged

rekram1-node merged 4 commits into
v2from
finish-reason-parity

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

Summary

  • require non-empty Chat Completions finish reasons by default and honor requireFinishReason: false for compatible endpoints
  • infer stop or tool-calls only when finish reasons are explicitly optional
  • normalize end, preserve unknown/content-filter outcomes, and classify provider error reasons through typed AIError failures
  • make protocol halt finalization effectful so end-of-stream validation stays in the typed error channel

Testing

  • bun typecheck (packages/ai)
  • bun test test/route.test.ts test/provider/openai-chat.test.ts test/provider/openai-compatible-chat.test.ts test/provider/gemini.test.ts test/provider/bedrock-converse.test.ts test/provider/bedrock-mantle.test.ts (packages/ai)
  • full bun test replayed Chat provider recordings successfully; unrelated existing baseline failures remain

@rekram1-node
rekram1-node merged commit 6bb5200 into v2 Aug 25, 2026
7 checks passed
@rekram1-node
rekram1-node deleted the finish-reason-parity branch August 25, 2026 03:10
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
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.

1 participant