Repository navigation
debug-bundle: include proxy-events.jsonl tail in saved bundles - #62
Merged
Merged
Conversation
Pulls the wire-level proxy capture (from claude-code-headless' mitmAddon and codex-headless' ResponsesProxy) into every saved debug bundle, gated on the session having a proxy run dir on disk. Forensic gap before this change: Bundles carried state-snapshot, feed-debug, proxy-semantic, and HTML — useful for "what did the renderer think happened" but silent on "what was actually sent on the wire". The on-disk proxy-events.jsonl had every prompt and header, but it lived outside the bundle's file list and required the user to manually find the run dir under ~/.config/cc-shell/proxy/. Anyone trying to debug a sidecar leak (the orphan-ghost case from PR #54) needed both the bundle AND the user's proxy dir to make any progress. Three additions: 1. src/main/storage/proxyEventsReader.ts (new) Finds the latest proxy run dir matching {cwd, sessionKey}, reads proxy-events.jsonl, tails to PROXY_EVENTS_BUNDLE_MAX_BYTES (5 MiB) when oversized. Returns nulls on any error — bundle save must NEVER fail because the proxy log is missing or unreadable. Uses the same sanitizePath helper the proxy writers use, so the reader and writers can never disagree on the segment shape. 2. IPC seam: 'debug:read-proxy-events' Renderer-callable handler that wraps the reader. Single new types entry (ProxyEventsBundleSection) plus debugApi.readProxyEvents. 3. saveDebugBundle.ts Calls window.api.readProxyEvents during assembly, conditionally adds proxy-events.jsonl + proxy-session-meta.json to the file list when the reader finds something. Manifest gains a `proxyRunDir` field pointing at the FULL log on disk so users who hit the 5 MiB tail cap know where to look for older traffic. Both bundle callers (autosave + manual) pass cwd + providerSessionId from session meta. No new state, no new IPC shape beyond the one read. Verification: - npm run build:app ✅ - Existing bundle layout unchanged for sessions without proxy (the new files are conditional on reader output).
Juliusolsson05
added a commit
that referenced
this pull request
Sep 25, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 25, 2026
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
Pulls the wire-level proxy capture (from claude-code-headless' mitmAddon and codex-headless' ResponsesProxy) into every saved debug bundle, gated on the session having a proxy run dir on disk.
Closes the loop on the three-PR series:
After all three land, opening a debug bundle shows every API request that was sent during the session, including the actual prompt body — with no manual digging through hidden state directories.
What changes
New file: `src/main/storage/proxyEventsReader.ts`
New IPC: `debug:read-proxy-events`
Bundle assembler: `saveDebugBundle.ts`
Bundle layout after this lands
For a Claude/Codex session that ran with proxy:
```
debug-bundles/-/
├── manifest.json ← gains proxyRunDir field
├── state-snapshot.json
├── feed-debug.jsonl
├── work-context.json
├── proxy-semantic.json
├── proxy-events.jsonl ← NEW (wire-level capture)
├── proxy-session-meta.json ← NEW (proxy run metadata)
├── html-raw.html
├── html-clean.html
├── trace/
└── performance/
```
For a session without proxy (legacy or proxy disabled), the layout is unchanged — the new files are conditional.
Verification
Trade-offs
🤖 Generated with Claude Code