fix(gateway): preserve custom_providers extra_body on reused-agent turns - #68946
fix(gateway): preserve custom_providers extra_body on reused-agent turns#68946IbrahimKhan12 wants to merge 1 commit into
Conversation
Related competing fixes for #54922: #30224 preserves existing overrides then clears known transient keys; #52432 tracks/removes the previous turn payload; this PR recomputes durable |
|
Thanks for isolating the durable-versus-transient override contract. The defect is still present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
|
ack will fix |
a8cbe45 to
0282316
Compare
- Reapply custom-provider defaults after active runtime restoration. - Keep explicit turn overrides authoritative without retaining prior turns.
0282316 to
a36d28e
Compare
|
Done, revised the PR. |
SummaryTwo open PRs address #54922 through different state-management contracts: #30224 merges existing cached-agent overrides with each turn, while #68946 reconstructs durable custom-provider extra_body from configuration after runtime restoration and now exercises fast-to-normal cached-agent reuse. Related pull requests
Duplicates#30224 and #68946 are competing fixes for the same cached-agent overwrite behind #54922; #30224 can be treated as superseded by #68946. Suggested consolidationKeep #68946 open with a salvage path: retain its stateless configuration-derived reconstruction, active-runtime scoping, precedence handling, and newly added cached-agent fast-to-normal regression, then obtain review of the revision. Close #30224 as a duplicate of #68946; despite #30224's keep_open review, its diff leaves the review-identified runtime request_overrides routing omission unresolved and tests only its helper. Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I54922(["issue #54922 (open)"])
subgraph Dup30224 ["PRs duplicating each other"]
P30224["PR #30224 (open)"]
P68946["PR #68946 (open)"]
end
P68946 -->|best fix| I54922
class I54922 open
class P30224 open
class P68946 open
class P68946 best
class P68946 target
click I54922 "https://github.com/NousResearch/hermes-agent/issues/54922"
click P30224 "https://github.com/NousResearch/hermes-agent/pull/30224"
click P68946 "https://github.com/NousResearch/hermes-agent/pull/68946"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 2 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 13 kB of PR diffs, 14 kB of issue/PR text, 5 kB of discussion (6 comments), 3 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Why
Gateway cached-agent turns replace
request_overrides, dropping durablecustom_providers[].extra_bodyvalues initialized on the agent. Custom-provider requests therefore behave differently between CLI and messaging paths, silently removing fields such asreasoning_effort.What
Reapply matching custom-provider
extra_bodydefaults after active-runtime restoration at the start of each agent turn. Explicit turn-level top-level and nested values retain precedence, and defaults are applied only to the active provider runtime so cooldown-active fallbacks do not inherit primary-provider settings.Add regression coverage for a reused gateway agent across fast and normal turns, merge precedence, restored primary runtimes, and cooldown-active fallbacks.
Testing
scripts/run_tests.sh tests/agent/test_custom_provider_extra_body.py tests/agent/test_turn_context.py tests/gateway/test_fast_command.py -qpython -m ruff check agent/agent_init.py agent/turn_context.py tests/agent/test_custom_provider_extra_body.py tests/agent/test_turn_context.py tests/gateway/test_fast_command.pygit diff --check origin/main..HEADReferences