fix(gateway): honor env proxy for relay aiohttp with WSL-safe fallback - #11762
Closed
shajiang919 wants to merge 2 commits into
Closed
fix(gateway): honor env proxy for relay aiohttp with WSL-safe fallback#11762shajiang919 wants to merge 2 commits into
shajiang919 wants to merge 2 commits into
Conversation
- Add outbound_proxy helpers for trust_env, resolve_proxy_url kwargs, and HERMES_PROXY_TIMEOUT_MULTIPLIER on relay ClientTimeout sock_read. - Retry once without env proxy after transport errors unless disabled. - Document HERMES_GATEWAY_OUTBOUND_NO_PROXY and related env vars in .env.example. - Add tests/gateway/test_proxy_flow.py unit coverage. Made-with: Cursor
🤖 Automated PR ReviewSecurity Scan
Code Quality
SummaryStatus: APPROVE ✓ (with suggestions) |
Made-with: Cursor # Conflicts: # gateway/run.py
Contributor
|
Thanks for the focused proxy-relay work and the accompanying tests. This automated hermes-sweeper review is closing it under the repository's configuration policy.
Closed as not-planned per standing maintainer policy ( |
4 tasks
djbclark
added a commit
to djbclark/hermes-agent
that referenced
this pull request
Aug 11, 2026
… into replayed tool_calls Root cause for NousResearch#83714 (write_file/patch_tool writing literal "...[truncated]" into files, PR NousResearch#83752's guard is the safety net, not the fix): _truncate_tool_call_args_json() in the compression pass shrinks long string values inside a PAST assistant message's tool_calls[].function.arguments — the exact field that represents the model's own prior generated output, replayed back to it verbatim on every subsequent turn. The old marker, a bare "...[truncated]" suffix, is indistinguishable from something the model itself could have written (it's exactly the kind of terse ellipsis abbreviation models already produce). A model conditioned on seeing itself "get away with" that pattern in its own history imitates it in a new tool call, writing the literal marker instead of real content. This is the second bug from the same root text. The first (NousResearch#11762, MiniMax 400s from unterminated JSON) was fixed by shrinking inside the parsed structure so the JSON stays valid, but kept the same visible marker text — fixing the syntax problem while leaving the imitation problem untouched. Fix: replace the marker with one deliberately NOT shaped like prose a model would write — distinctive non-ASCII delimiters, an explicit "not part of the original tool call" disclaimer, and a per-instance char-count that won't match the next omission point even if copied verbatim. The shrunk value stays a plain string (not a nested object) so the NousResearch#11762 valid-JSON/matching-shape contract is unchanged — only the marker text changed. Checked context_compressor.py's other "...[truncated]" call sites (_serialize_for_summary, _compact_fallback_turn, the user-message-only one near _ACTIVE_TASK_MAX_CHARS) — none of them write into a value that gets replayed as the main model's own assistant/tool_calls history, so they don't share this priming risk and were left as-is. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Aug 11, 2026
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.
Summary
Gateway proxy mode (
_run_agent_via_proxy) now buildsaiohttp.ClientSessionwith explicit outbound proxy behavior aligned withgateway/platforms/base.py(resolve_proxy_url/proxy_kwargs_for_aiohttp),trust_envwhere appropriate, and a tunable read timeout. After a transport-level failure, the relay retries once with a direct session (no env-derived proxy kwargs) unless disabled.Motivation
On WSL/Windows,
HTTP_PROXY/HTTPS_PROXYoften points at a host-only forwarder. Relay calls toGATEWAY_PROXY_URLcan mis-route, hang until read timeout, or fail with connection errors. This change makes outbound behavior explicit and adds a safe fallback path.Changes
gateway/outbound_proxy.py: env parsing forHERMES_PROXY_TIMEOUT_MULTIPLIER,HERMES_GATEWAY_OUTBOUND_NO_PROXY,HERMES_GATEWAY_RELAY_NO_DIRECT_FALLBACK, andrelay_client_session_proxy_bundle().gateway/run.py: relay uses scaledClientTimeout, proxy bundle kwargs, and optional direct retry..env.example: document the new variables.tests/gateway/test_proxy_flow.py: unit tests for multiplier, no-proxy bundle, and HTTPS proxy resolution.How to verify