Skip to content

Claude proxy-events.jsonl grows to 2+ GB per session and cannot be pruned while live #1273

Open

Description

@Juliusolsson05

packages/claude-code-headless/src/proxy/mitmAddon.py _write appends every request with its body (body_b64, capped at 2 MiB per request) and has no per-file size cap. Each Claude request re-sends the whole conversation, so growth is roughly quadratic in turns. debugRetention.ts prunes whole run dirs and skips anything touched in the last 10 minutes (ACTIVE_GRACE_MS), so a live session's file is never pruned.

Measured on the owner's machine today: 2.37 GB, 2.10 GB, 1.95 GB and 0.84 GB files, all written 2026-09-25; proxy/ totals 7.6 GB. Requests are ~96% of the bytes. Memory records the earlier proxy-events OOM from reading this file whole.

Fix direction: a per-file byte budget in the addon (rotate or stop writing bodies past N MiB; keep the request_shape the sidecar detection needs, per project_sidecar_request_shape), plus a retention rule for oversized live files. Codex's equivalent is #372. Severity P1 (fills disk in a day).

Found by the Stage 3 C6 hunt; lines are origin/main 9c6e48f. Findings file: temp/quality-loop/hunt-c6.md.

🤖 Generated with Claude Code

Activity

  1. Juliusolsson05 commented on Sep 25, 2026

    @Juliusolsson05
    OwnerAuthor

    Residual after #1284 / claude-code-headless#62 (steering q24). #1284 is now Refs, not Fixes.

    Shipped there: past 256 MiB, request bodies are omitted (body_omitted: "file-budget"). That removes ~93 % of the growth rate.

    Still open here:

    1. The file is still unbounded. Responses and stream chunks (~7 %) keep appending, so it grows ~170 MB per 2.4 GB of old-rate traffic.
    2. Existing oversized live files are never reclaimed, because debugRetention.ts skips runs written in the last 10 minutes.

    A fix needs a live-file policy: rotation, or truncation with the adapter's tail/offset reader (proxyEventsReader, 5 MiB tail) tested against it.

  2. Juliusolsson05 commented on Sep 25, 2026

    @Juliusolsson05
    OwnerAuthor

    Status after #1284 (merged via batch #1318) and claude-code-headless #62.

    Shipped: Claude request bodies are capped per events file, not just per request. Past the budget, the newest prompt is kept in a sidecar (up to 16 MiB), and debug bundles append it.

    Still open: response-side growth, and the fact that debugRetention never prunes a live session's file (10-minute active grace). The same bloat on the Codex side is #372 (#1317 shipped its 3.65× chunk fix).

  3. Juliusolsson05 commented on Sep 27, 2026

    @Juliusolsson05
    OwnerAuthor

    Reopened by B6 (q112). This was closed automatically by the manual Development link on #1376 when batch H merged. #1376 only bounds the proxy-events file; sslkeylog.log is still unbounded (#1380), so #1273 is not finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclass:C6-unboundedUnbounded growthprovider:claudeAffects Claude Code integrationsev:P1Core flow broken or badly degradedtype:bugSomething works wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions