Skip to content

feat: trace identity in the traced child's env (proxy modes) - #75

Merged
lroolle merged 1 commit into
mainfrom
feat/trace-identity-env
Jul 29, 2026
Merged

feat: trace identity in the traced child's env (proxy modes)#75
lroolle merged 1 commit into
mainfrom
feat/trace-identity-env

Conversation

@lroolle

@lroolle lroolle commented Jul 29, 2026

Copy link
Copy Markdown
Member

The mitm and base-url modes injected only plumbing into the spawned client — HTTPS_PROXY and the CA bundle vars. A subprocess of a traced session (a statusline, a hook, a nested agent) that wanted to know it was being captured had to sniff that plumbing and scan the instance registry for the live UI port: heuristics for a fact the spawning process holds in hand.

Say it outright instead — traceIdentityEnv in src/capture.ts, merged at the one spawn site:

var when
CCTRACE_TRACE_FILE always (absolute path to the run's .jsonl)
CCTRACE_SERVER_PORT live runs (the UI port)
CCTRACE_INSTANCE_ID live runs (the run's registry identity)

Node mode has exported these names since day one; the proxy modes agree now. Static mode (-s) has no server, so it exports the trace file only.

First consumer: claude-code-statusline's [cctrace:PORT] chip (thevibeworks/claude-code-statusline#9), which keeps the registry scan only as its fallback for pre-this-change captures.

Tests: 3 new units on the pure helper; full suite 567 pass. The env passes through docker exec env inheritance unchanged, so deva --trace sessions get it for free.

🤖 Generated with Claude Code

The mitm and base-url modes injected only plumbing into the spawned
client — HTTPS_PROXY and the CA bundle vars. A subprocess of a traced
session (a statusline, a hook, a nested agent) that wanted to KNOW it
was being captured had to sniff that plumbing and scan the instance
registry for the live UI port: heuristics for a fact the spawning
process holds in hand.

Say it outright instead (traceIdentityEnv in src/capture.ts, merged at
the one spawn site): CCTRACE_TRACE_FILE always, CCTRACE_SERVER_PORT +
CCTRACE_INSTANCE_ID when a live server exists. Node mode has exported
these names since day one; the proxy modes agree now. First consumer:
claude-code-statusline's [cctrace:PORT] chip
(thevibeworks/claude-code-statusline#9), which keeps the registry scan
only as its fallback for older captures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lroolle
lroolle merged commit d943a05 into main Jul 29, 2026
1 check passed
@lroolle
lroolle deleted the feat/trace-identity-env branch July 29, 2026 11:13
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.

1 participant