fix: blank assistant text - finish-reason regression after AI SDK v6 migration#20467
fix: blank assistant text - finish-reason regression after AI SDK v6 migration#20467kkugot wants to merge 2 commits intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Related PRs Found:
|
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
df65986 to
bf4dbc9
Compare
5d6eef9 to
49cc60e
Compare
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
8c1272b to
36d92e3
Compare
a060a89 to
4e4878b
Compare
|
I am keeping this branch up-to date with dev, would be thankful if this can be merged. engineers using Oracle Code Assist could not use opencode with Open AI models with responses API because of this bug. This is since version 1.3.4 |
|
@kkugot let me look over this |
Im not sure this is accurate |
111ecaa to
73eb998
Compare
|
Addressed both review comments:
The PR now has two commits:
|
|
Why does your provider not send valid stop reasons, we cant just continue on all others i dont think, there are many cases that can trigger this afaik |
It does, we use OpenAI (@ai-sdk/openai) via responses API through enterprise layer and it works well in Codex and other harnesses. But your question is valid and I am taking it to discuss if there is any modification to stop reasons. |
|
The AI SDK 6 upgrade dropped support of "unknown" but has not added support of "other" in full (which is valid reason in V6) |
73eb998 to
c6193db
Compare
The v6 upgrade changed the default unmapped finish reason from "unknown" to "other", but the prompt loop continue sets were not updated to match. This caused premature loop exit after MCP tool calls, before the model produced final assistant text. Fixes anomalyco#20050 Fixes anomalyco#20465
When using the Responses API, intermediate assistant messages with finish reason "other" were rendering empty footer bars and blank space. Two changes: 1. Add "other" to the excluded finish reasons in final() to align with the prompt loop logic that treats "other" as non-terminal. 2. Add a reactive visible() memo that hides the entire AssistantMessage when no parts would render and no footer/error is shown.
c6193db to
1b9e698
Compare
Issue for this PR
Closes #20465
Type of change
What does this PR do?
Fixes blank assistant text in TUI when MCP servers are enabled, a regression introduced in v1.3.4 by the AI SDK 5 -> 6 upgrade.
Root cause: The v6 finish-reason adapter changed the default unmapped reason from
unknowntoother. The prompt loop continue sets inprompt.tshadunknownremoved butotherwas never added as a replacement. This causes the loop to exit after MCP tool calls before the model produces final text. MCP amplifies this because tool-enabled requests hit this code path far more often.Additional fix: The TUI
AssistantMessagecomponent rendered empty space for intermediate assistant messages whose parts were all hidden (completed tools with details off, empty text). Added a reactivevisiblememo that hides the entire message when no parts would render.How did you verify your code works?
bun typecheck— no new errors (only pre-existing ripgrep.ts errors on dev)Checklist