Repository navigation
Conversation
The request body was {model, state, questions} and nothing else, built
from a literal. OpenRouter's DecisionsRequest documents four more --
provider, session_id, trace, user -- and none of them could be sent
through this client at all. The official JavaScript SDK spreads the
caller's request into the payload so any unknown top-level field goes
through, and Python has extra_body. Here the only route was to subclass
the provider and override request_body, for a session id.
ask takes extra:. Keys are stringified, structured values go through
untouched, and model, state, and questions are refused: they come from a
validated client and from the arguments the answers are matched back
against, so quietly letting a hash overwrite them would decouple the
request from the response handling.
request_body is a documented override point, so it gains extra: with a
default and a provider written against the old three-keyword signature
keeps working. Passing extra fields to one raises ConfigurationError
naming the provider, rather than dropping the fields on the floor, which
is the failure mode that would have cost someone an afternoon.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
The request body was
{model, state, questions}and nothing else, built from a literal.OpenRouter's
DecisionsRequestdocuments four more —provider,session_id,trace,user— and none could be sent through this client at all. The official JavaScript SDK spreads the caller's request into the payload so any unknown top-level field goes through, and Python hasextra_body. Here the only route was to subclass the provider and overriderequest_body, for a session id.Keys are stringified, structured values go through untouched, and
model,stateandquestionsare refused: they come from a validated client and from the arguments the answers are matched back against, so letting a hash overwrite them would decouple the request from the response handling.request_bodyis a documented override point, so it gainsextra:with a default and a provider written against the old three-keyword signature keeps working. Passing extra fields to one raisesConfigurationErrornaming the provider, rather than dropping the fields on the floor — which is the failure mode that would cost someone an afternoon.Tests
test/extra_fields_test.rb, 12 cases, including a legacy provider that can't take them.Draft: part of a security and API-coverage audit, opened for reference rather than as a request for immediate review. Independent of the other branches, each off
main. Suite green on Ruby 3.2.11, 3.3.8 and 3.4.8.🤖 Generated with Claude Code