fix(weixin,api_server): proxy support, content normalization, HermesClaw docs - #8680
Merged
Conversation
aiohttp.ClientSession defaults to trust_env=False, ignoring HTTP_PROXY/ HTTPS_PROXY env vars. This causes QR login and all API calls to fail for users behind a proxy (e.g. Clash in fake-ip mode), which is common in China where Weixin and WeCom are primarily used. Added trust_env=True to all aiohttp.ClientSession instantiations that connect to external hosts (weixin: 3 places, wecom: 1, matrix: 1). WhatsApp sessions are excluded as they only connect to localhost. httpx-based adapters (dingtalk, signal, wecom_callback) are unaffected as httpx defaults to trust_env=True. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a one-line entry for HermesClaw (community WeChat bridge) to the Community section. It lets users run Hermes Agent and OpenClaw on the same WeChat account.
Some OpenAI-compatible clients (Open WebUI, LobeChat, etc.) send
message content as an array of typed parts instead of a plain string:
[{"type": "text", "text": "hello"}]
The agent pipeline expects strings, so these array payloads caused
silent failures or empty messages.
Add _normalize_chat_content() with defensive limits (recursion depth,
list size, output length) and apply it to both the Chat Completions
and Responses API endpoints. The Responses path had inline
normalization that only handled input_text/output_text — the shared
function also handles the standard 'text' type.
Salvaged from PR #7980 (ikelvingo) — only the content normalization;
the SSE and Weixin changes in that PR were regressions and are not
included.
Co-authored-by: ikelvingo <ikelvingo@users.noreply.github.com>
teknium1
force-pushed
the
hermes/hermes-f37b1d3f
branch
from
April 13, 2026 00:47
71e25e2 to
6b316c3
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.
Summary
Three changes salvaged from community PRs, each independent and clean.
1. Proxy support for aiohttp sessions (cherry-pick from #8280)
Adds
trust_env=Trueto allaiohttp.ClientSession()calls in weixin.py, wecom.py, and matrix.py. This makes aiohttp respectHTTP_PROXY/HTTPS_PROXYenv vars — critical for Chinese users behind proxies (Clash fake-IP mode) who can't connect to WeChat/WeCom APIs at all without it. No-op for non-proxy users.Author: Sicheng Li (@MaybeRichard)
2. HermesClaw community docs (cherry-pick from #7375)
One-line README addition linking HermesClaw (community WeChat bridge) in the Community section.
Author: AaronWong1999 (@AaronWong1999)
3. Normalize array-based content parts in API server (salvaged from #7980)
Some OpenAI-compatible clients send content as typed arrays (
[{type: 'text', text: 'hello'}]) instead of strings. The Chat Completions endpoint had no normalization, causing silent failures. Adds_normalize_chat_content()with defensive limits (recursion depth, list size, 64KB output cap) and applies it to both Chat Completions and Responses API endpoints. The Responses path had inline normalization that only handledinput_text/output_text— the shared function also handles the standardtexttype.Only the content normalization from #7980 was taken. The SSE changes (reverted #6972 tool progress fix, removed keepalive pings) and Weixin changes (conflicted with #8665, removed retry logic, removed blank-message guards) were regressions and are excluded.
Author: ikelvingo (@ikelvingo) — co-authored
Files changed
gateway/platforms/weixin.py— trust_env=True (3 locations)gateway/platforms/wecom.py— trust_env=True (1 location)gateway/platforms/matrix.py— trust_env=True (1 location)gateway/platforms/api_server.py— _normalize_chat_content function + applied in 2 endpointstests/gateway/test_api_server_normalize.py— 17 new testsREADME.md— 1 line addedTest plan
PRs to close after merge