Skip to content

Keep only the current WebSocket message in the secrets proxy - #79

Merged
czpython merged 1 commit into
mainfrom
claude/secrets-proxy-websocket-history-u33ma4
Oct 19, 2026
Merged

czpython merged 1 commit into
mainfrom
claude/secrets-proxy-websocket-history-u33ma4

Conversation

@czpython

Copy link
Copy Markdown
Owner

Requested by Paulo · project thread

Before: mitmproxy keeps every message of a WebSocket connection for the connection's life. A long Codex session grows the proxy without a limit (DRU-888).

After: the websocket_message hook drops all messages but the current one. The dumper (flow_detail=1) runs after the script addons and reads messages[-1], so the current message stays.

How: one hook in deploy/proxy/swap.py, one unit test.

Local run with mitmproxy 12.2.3, a real mitmdump with this addon, and a WebSocket echo server; 128 round trips of 1 MiB:

RSS after 32 / 64 / 128 held by the flow at the end
without the hook 148 / 213 / 342 MiB 256 messages, 260 MB
with the hook 86 / 86 / 83 MiB 1 message, 1 MiB

Text, binary, fragmented and permessage-deflate messages and the close (1000) passed, and every echoed payload was byte-equal. A real Codex call through production is still to do.


Generated by Claude Code

mitmproxy keeps every message of a WebSocket connection for its life, so a
long Codex session grows the proxy without bound (DRU-888).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENMdnx74hgYh4bWfsm44WV
@czpython czpython self-assigned this Oct 19, 2026
@czpython
czpython merged commit 9dc39f2 into main Oct 19, 2026
6 checks passed
@czpython
czpython deleted the claude/secrets-proxy-websocket-history-u33ma4 branch October 19, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants