-
fix(egress): unblock SSE/chunked streaming through mitmproxy (#898)
发布于
2026-05-18 03:05:09 +00:00 - fix(egress): unblock SSE/chunked streaming through mitmproxy
The mitmdump --set stream_large_bodies=1m option (added to prevent OOM
on large downloads) buffers any response under 1 MiB before forwarding,
which stalls LLM SSE / chunked streams of small chunks until the stream
ends or the threshold is hit, producing perceptible stutter downstream.Introduce a bundled system addon that is always loaded by the egress
launcher and forces flow.response.stream = True for responses with
content-type: text/event-stream or transfer-encoding: chunked. Large-
body OOM protection from stream_large_bodies stays intact for everything
else.The previous example script add_header.py is renamed to system.py and
repurposed as the always-on system addon (wire-transparent: no headers
added or altered). User-supplied addons via OPENSANDBOX_EGRESS_MITMPROXY_SCRIPT
are still loaded after the system addon and may observe or override its
hooks.Refs: https://project.aone.alibaba-inc.com/v2/project/2135082/req/82131871
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
- fix(egress): case-insensitive header match and correct system addon docs
Normalize content-type and transfer-encoding to lowercase before substring
matching in the system addon, so legal mixed-case values like
Transfer-Encoding: Chunked or Content-Type: Text/Event-Stream still trigger
streaming instead of getting buffered by stream_large_bodies=1m.Also fix the transparent-mode doc, which referenced a non-existent
OPENSANDBOX_EGRESS_MITMPROXY_SYSTEM_SCRIPT env var as a way to disable or
swap the system addon. The launcher always appends the bundled system addon
unconditionally; document that users override behavior via
OPENSANDBOX_EGRESS_MITMPROXY_SCRIPT (loaded after the system addon).Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Co-authored-by: Claude Opus 4.7 noreply@anthropic.com
下载附件