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 1 commit 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) |
c6193db to
1b9e698
Compare
6f867f9 to
21636ab
Compare
|
this pr has so many unrelated changes, i thought it'd be a 2 line pr? |
|
@rekram1-node the rebase went wrong, fixing |
cb401dc to
c2caf33
Compare
fde96ac to
6ea89bd
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
6ea89bd to
d0971aa
Compare
Ready for your review |
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