Repository navigation
fix(decisions): name the missing answers field when a provider response omits it - #47606
Closed
yuneng-berri wants to merge 2 commits into
Closed
yuneng-berri wants to merge 2 commits into
yuneng-berri wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Merging this PR will not alter performance
|
Contributor
Author
|
bugbot run |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8718033. Configure here.
Contributor
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.
Description
When a decisions provider answers 200 but leaves out the
answersfield, the gateway still fails the call with a 500, but since #46523 the error no longer says which field was missing. This puts the field name back in the error so an operator can tell what the upstream got wrong, and turns the integration guard for it green againDetails
TLDR
Problem this solves:
answersupstream gives "Input should be a valid dictionary"test_upstream_success_without_answers_is_a_gateway_side_server_errorred on mainHow it solves it:
answersanswers/Field required, status and spend row unchangedUser Flow
Before: an operator whose decisions upstream returns a body without
answersgets a 500 that never says what was missingnace/drex-v2.0model and one questionmodelandusageAfter: the same failure now tells the operator the upstream left out
answersmodelandusageanswersField requiredPre-Submission checklist
Screenshots / Proof of Fix
No real decisions upstream returns a success body without
answers, so this proof points the proxy at a tiny local fake that answers every POST with200 {"model": "drex-v2.0", "usage": {"input_tokens": 12, "output_tokens": 3}}. No real provider and no spend is involvedConfig
Request
Before (e63aec0)
After (8718033)
The integration guard
tests/integration/providers/test_decisions_wire.py::test_upstream_success_without_answers_is_a_gateway_side_server_erroralso failed at the merge base and passed with the fix in a local run, and the wholetest_decisions_wire.pyfile passed with the fix (43 passed, 1 skip that was already marked as a known bug)Type
🐛 Bug Fix
Caveats (if any)
Low
_SystemonePayloadinstead of a public typeFinal Attestation
Note
Low Risk
Observability-only change to validation error text on an existing 500 path; successful response handling is unchanged.
Overview
When a decisions upstream returns HTTP 200 but omits
answers, gateway failures now surfaceanswers/ Field required instead of a generic dictionary validation error.parse_systemone_responsevalidates the body with a small_SystemonePayloadmodel that requiresanswerswhile still allowing extra fields (model,usage, etc.). Answer normalization and IR conversion are unchanged for valid responses.A parametrized unit test asserts the
answersfield name appears in the 500 error across nace, openrouter, fireworks_ai, and typesafe provider configs.Reviewed by Cursor Bugbot for commit 8718033. Bugbot is set up for automated code reviews on this repo. Configure here.