Repository navigation
proxy: bump headless request_shape capture and header filtering - #55
Conversation
Picks up packages/claude-code-headless 505377a (proxy: emit request_shape from mitm addon, decouple sidecar predicate from body size cap). Why this matters for cc-shell: c8c2623's body-shape sidecar predicate has been silently no-op since shipping — production debug bundles (e.g. 2026-05-07T08-26-35-212-5d948ab5) show ~99% of /v1/messages requests exceeding the addon's 256 KiB body capture cap, so state.requestShape was null and no flow_ignored events ever fired. Title-gen, branch-name-gen, and the new predict-next-prompt feature all leaked through as live semantic flows, ghost-orphaned, and parked at the bottom of the conversation feed. After this submodule bump, the addon parses the body in process and emits a small request_shape blob regardless of body size, so the existing predicate finally has data to work with. The renderer-side symptom suppression on fix/orphan-sidecar-ghosts remains useful as belt-and-suspenders for any sidecar variant we don't yet have a fingerprint for.
…ded request_shape)
Picks up packages/claude-code-headless f978e15 (proxy: filter
request headers + extend request_shape with forensic
discriminators).
Adds to the existing request_shape capture from 505377a:
- Headers filtered to an allowlist (no Authorization, no
user-set custom headers) so debug bundles are safe to share.
- request_shape gains tools_count, system_blocks_count,
system_total_chars, messages_total_chars,
attribution_entrypoint — all the discriminators we identified
by reading vendor/claude-code-src/.
- body_b64 cap raised from 256 KiB to 2 MiB so forensic tooling
can decode the actual prompt text from real turns. Previous
cap silently dropped every body past the warmup quota check.
No cc-shell-side change required — the adapter type extension is
backward-compatible, the renderer is unaffected, and the new
fields are diagnostic-only until a follow-up wires them into
isSidecarFlow.
|
Scope expansion — additional commit on this branch (and the submodule branch): Building on the original `request_shape` capture, added:
`verify-sidecar-haiku.ts`: 13/13 still passing — predicate logic untouched; all new fields are additive. Submodule commits: 505377a (original), f978e15 (this expansion). |
Settled reads now also refuse inside an open synchronized update and after an unredrawn resize, and count a chunk before pty-data listeners run. Interim pointer; the final bump goes to #55's merge commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Bumps
packages/claude-code-headlessso the mitm addon emitsrequest_shapealongside proxy request events. This repairs the body-shape sidecar predicate that was silently inert in production: modern Claude Code requests include large conversation bodies, so the old adapter usually had no body data to inspect and title-gen / branch-name-gen / hook-agent flows could leak into the cc-shell feed as orphan ghosts.This bump also includes two proxy-capture behavior changes that should be reviewed with the same care as the request-shape field:
proxy-events.jsonlare filtered through an allowlist, so sensitive headers such asAuthorizationand unreviewed custom headers are no longer persistedbody_b64capture cap increases from 256 KiB to 2 MiB;request_shapeis still the predicate path, whilebody_b64remains for debugging captured small/medium requestsForensic root cause (debug bundle
2026-05-07T08-26-35-212-5d948ab5)Content-Length681862-1033291)state.requestShapenon-null when isSidecarFlow ranflow_ignoredevents emittedThe c8c2623 predicate was correct; the addon never fed it data on real Claude Code traffic because every modern request includes the full conversation history.
Submodule change (
packages/claude-code-headless)fix/emit-request-shapenow points at commitf978e15and includes:mitmAddon.pyparses the buffered request body inside the addon and emits a smallrequest_shapeJSON object regardless of body sizeClaudeProxyAdapter.tsaccepts optionalrequest_shape, prefers it over parsingbody_b64, and keepsbody_b64as the fallback for older addon binariesAuthorizationor future sensitive headers by default_REQUEST_BODY_CAPis now 2 MiB for forensicbody_b64capture; request-shape extraction remains independent of that capFollowups
SIDECAR_SYSTEM_PROMPT_PREFIXES, the renderer filter can be removed.fix/emit-request-shapeto its main so the submodule pointer here is reachable from a stable ref.Verification
npm run buildinpackages/claude-code-headlessnpm run build:appin cc-shellnpx tsx src/testing/verify-sidecar-haiku.ts— 13 passed, 0 failedflow_ignoredevents for any sidecar shape that matches signal 2a (max_tokens <= 1024 AND messageCount <= 3) or signal 2b (system-prefix fingerprint).