fix(kimi): exclude brotli from Accept-Encoding to work around httpx/brotlicffi streaming decode bug (#59556)
httpx's brotlicffi backend (pinned for Discord attachment decoding) fails on Kimi API's content-encoding: br SSE streaming responses with: brotli: decoder process called with data when can_accept_more_data() is False This surfaces as 'API call failed after 3 retries: Connection error' on Windows Desktop where the Electron-packaged Python venv includes brotlicffi (#59556). DeepSeek and Xiaomi are unaffected — only moonshot endpoints (api.moonshot.ai, api.moonshot.cn) trigger the bug. The fix forces Accept-Encoding: gzip so the Kimi API falls back to gzip compression, which httpx handles reliably on all platforms. This is the same workaround already applied in tools/skills_hub.py for sitemap fetches and the Hermes index download. Closes associated issues: #28043, #48428 (cherry picked from commit 9c130133b0676138858b73847d1d7c7549339484)
This commit is contained in:
@@ -13,6 +13,10 @@ _HEADERS = {
|
||||
"HTTP-Referer": "https://hermes-agent.nousresearch.com",
|
||||
"X-Title": "Hermes Agent",
|
||||
"User-Agent": f"HermesAgent/{_HERMES_VERSION}",
|
||||
# Exclude brotli: httpx's brotlicffi backend has a streaming decode bug on
|
||||
# Moonshot's content-encoding: br SSE responses (#28043, #48428, #59556).
|
||||
# gzip sidesteps it while still compressing the transfer.
|
||||
"Accept-Encoding": "gzip",
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user