fix(gateway): merge instead of overwrite agent.request_overrides - #52432
Open
gitabtion wants to merge 1 commit into
Open
fix(gateway): merge instead of overwrite agent.request_overrides#52432gitabtion wants to merge 1 commit into
gitabtion wants to merge 1 commit into
Conversation
19 tasks
teknium1
reviewed
Jul 15, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating a real gateway reset bug. Current main merges matching custom-provider extra_body during initialization (agent/agent_init.py:1696), then discards it in the per-turn refresh (gateway/run.py:18394); the proposed copy-and-update directly addresses that sequence.
Problems
- There is no regression test for the gateway sequence being changed.
tests/agent/test_custom_provider_extra_body.py:6tests the init helper, whiletests/gateway/test_fast_command.py:107tests route construction, but neither reaches the post-init assignment atgateway/run.py:18394. - This is only the reset sub-case. Current runtime and turn-route field whitelists still omit
request_overridesatgateway/run.py:1895-1904andgateway/run.py:3901-3910. The linked #53765 correctly identifies those as separate paths.
Suggested changes
- Add a focused gateway regression that verifies custom-provider
extra_bodysurvives the per-turn refresh, including coexistence with a service-tier override. - Keep the PR explicitly narrow, or consolidate with the broader plumbing work; the one-line change should not be treated as covering model-switch or other runtime-resolution paths.
Automated hermes-sweeper review.
Preserve initialization-time request overrides while replacing the previous turn's routing overrides during the gateway refresh. This keeps custom-provider extra_body settings without leaving stale fast-mode service_tier or speed values on cached agents. Add a gateway regression covering coexistence with fast mode and the following normal turn.
gitabtion
force-pushed
the
fix/gateway-request-overrides-merge
branch
from
July 21, 2026 08:03
a747ef3 to
efa729e
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.
Problem
After
init_agent()mergescustom_providersextra_bodyintoagent.request_overrides, the gateway runner's per-turn setup online 15856 unconditionally overwrites it:
turn_route.get(request_overrides)is{}when noservice_tieris set (see_make_turn_routeat line 3487), soany
custom_providersextra_bodythat was injected duringagent init is silently discarded.
Fix
Merge instead of overwrite: preserve whatever the agent already
has in
request_overrides, and only layer onturn_routeoverrides when they are non-empty.
Tested
custom_providersextra_body(e.g.content_filter: falsefor 360 provider) survives past the gatewayper-turn setup when
service_tieris not set.