fix(tui): suppress AI SDK warnings before provider imports#20583
Open
aaron-he-zhu wants to merge 2 commits intoanomalyco:devfrom
Open
fix(tui): suppress AI SDK warnings before provider imports#20583aaron-he-zhu wants to merge 2 commits intoanomalyco:devfrom
aaron-he-zhu wants to merge 2 commits intoanomalyco:devfrom
Conversation
AI SDK warnings from providers like OpenRouter were appearing as raw text in the TUI because AI_SDK_LOG_WARNINGS was only set in server.ts and prompt.ts, which load after provider initialization. Move the flag to the top of the CLI entry point so it takes effect before any provider module is imported. Closes anomalyco#20047
Collaborator
|
Openrouter sdk doesnt respect AI_SDK_LOG_WARNINGS |
OpenRouter SDK calls console.warn directly and does not respect the AI_SDK_LOG_WARNINGS flag, so the previous approach of setting that global was insufficient. Instead, redirect console.warn and console.error to the Log service when the TUI starts. This catches warnings from all third-party SDKs, not just Vercel AI SDK. The originals are restored on exit. Closes anomalyco#20047
Contributor
Author
|
Good point — updated the approach. Instead of relying on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #20047
Type of change
What does this PR do?
AI SDK warnings from providers like OpenRouter appeared as raw text in the TUI because AI_SDK_LOG_WARNINGS was only set in server.ts and prompt.ts, which load after provider initialization. Moved the flag to the top of the CLI entry point so it takes effect before any provider module is imported.
The same pattern already exists in server.ts line 21.
How did you verify your code works?
Tested with OpenRouter provider configured. Warnings no longer appear as raw text in the TUI.
Checklist