fix(backend): log the call warnings a Provider raises - #425
Merged
Conversation
The AI SDK reports, per call, that a setting it was handed was not honoured — Bedrock drops seed, presencePenalty and frequencyPenalty and clamps temperature into 0-1; Anthropic strips temperature, topP and topK on the models that reject sampling parameters; both warn on a model id they don't recognise. Nothing read the array, so an Operator tuning an Agent's Temperature had no way to learn the control was disconnected at the far end. Point the SDK's warning hook at pino. The hook is a process global, so one call at startup covers every generation path there is — the streaming Chat turn, the unattended run, sub-agent runs, title generation and memory extraction — and a call site added later needs no wiring. Attribution is provider and model only, which is what the hook carries; correlating a warning back to a run would mean threading async context through every path, and that is the cost the global avoids. Closes #411 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
willdady
force-pushed
the
fix/411-provider-call-warnings
branch
from
August 6, 2026 11:08
caa0c1f to
61e93b1
Compare
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.
Closes #411
The problem
The AI SDK reports, per call, that a setting it was handed was not honoured. Nothing in Platypus read the array, so an Operator who set Temperature on an Agent running Bedrock — or on a model that rejects sampling parameters via Anthropic direct — was adjusting a control disconnected at the far end. No error, no log line, nothing in the UI.
Concretely, against the pinned versions: Bedrock drops
seed,presencePenaltyandfrequencyPenaltyand clampstemperatureinto 0–1; Anthropic stripstemperature,topPandtopKon the models that reject sampling parameters; both warn on a model id they don't recognise.The change
installProviderWarningLogger()points the SDK's warning hook at pino. Each warning becomes onewarnline carrying structured fields —provider,model,warningType,feature/setting,details/message— plus a sentence that stands on its own:The hook is a process global, which is the reason to use it: one call at startup covers the streaming Chat turn, the unattended run, sub-agent runs, title generation and memory extraction, and a generation call site added later needs no wiring. Assigning it displaces the SDK's own
process.emitWarningdefault, so nothing is logged twice — there's a test for that.Attribution is provider and model only, which is all the hook carries. Correlating a warning back to a run would mean threading async context through every path, and that is the cost the global avoids.
Notes for review
feature: "did anything drop my temperature?" is the question this exists to answer.unsupportedtype it uses for a parameter it drops, so "does not support temperature: … clamped to 1.0" would contradict itself. A warning carryingdetailsreads "did not use X as given", and a test pins that.Testing
14 new tests covering each warning variant, a clamped
temperaturecarryingdetails, several warnings from one call, a call with no provider or model, and silence when there are no warnings — plus SDK-driven cases throughgenerateTextand through a streamedToolLoopAgent(the sub-agent construction).pnpm typecheck,pnpm lintandpnpm testall pass.🤖 Generated with Claude Code