Repository navigation
feat(proxy): keep the newest Responses request body beside the events file - #70
Conversation
… file (agent-code#1336) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… slices (review a) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eering q96) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Disposition for review a, plus steering q96 (head
The PR body is rewritten for the current design. |
… (review b) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Disposition for review b (head
|
…ss; honest comments (review c) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Disposition for review c (head
|
|
READY (W1). Head App-side sequencing: the Agent Code bump to this package waits for agent-code#1366, which moves the same gitlink. The fresh-session half, agent-code#1399, is held: its fallback can pick a stale run, and the proper fix is agent-code#1405. Merging this package PR alone does not close agent-code#1336. |
04afc42
into
integration/batch-2026-09-27-cxh-v
For Juliusolsson05/agent-code#1336. App side: Agent Code needs the bump PR in the second list below before the file is reachable for fresh sessions.
Plan:
docs/plans/2026-09-27-latest-request-body.md, including review a and steering q96.Problem
proxy-events.jsonl./modelsrefreshes, therequestevent with itsbody_b64is out of the tail, and the bundle has no prompt.latest-request-body.jsonsidecar (claude-code-headless#62). Agent Code already appends that file for any provider, but Codex never wrote it.Change (head
880c6d8)LatestRequestBodySidecar(newsrc/proxy/latestRequestBody.ts). It keeps the newest main-turn Responses request body beside the events file as one line:{kind:'request-body-latest', requestId, endpoint, body_b64}. It uses the Claude addon's name and kind, and stores the raw on-wire bytes, as in therequestevent (zstd on current Codex).ResponsesProxy):responses*endpoints with a body, excluding requests with an output schema (a heuristic for temporary structured turns such as title generation; a structured MAIN turn, which Agent Code never sends, would leave the file one turn behind), and excluding subagent calls (x-openai-subagentother thancompact; review b).request_shapegainshas_output_schema(text.format). Codex 0.157 title generation sets it (tuithread_title.rs→ codex-apicodex_output_schema), and ordinary turns never do.responses/compact) is kept.record()unlinks the public file synchronously, with one metadata call.renameSyncin the same synchronous turn, so no newerrecord()can slip between check and commit (steering q96). A superseded write discards its temp file.eventsFileis set.flushMirror()andstop()also wait for it.API.mddescribes the file andhas_output_schema.SECURITY.mdsays that bodies between 2 MiB and 16 MiB are persisted only in the sidecar, and that a crash can leave a.tmpcopy.Tests
responsesProxy.latestBody.test.tssends real requests through the proxy to a local upstream:/modelsGET does not replace it;thread_spawnandreviewsubagent calls do not replace the main prompt, while acompact-tagged request is kept;latestRequestBody.test.ts:latestRequestBody.commitFence.test.ts: it holds A's commit, records B, releases A, and reads the public file before B commits. The file is absent or B, never A. It was red ona54cfe7./memories/trace_summarizeor/alpha/searchPOST must not replace the prompt; review c found this was NOT pinned before), the schema check, the subagent filter (both directions), the generation check, the unlink, a lowered cap, and the crash-left temp sweep.Verification
tsc --noEmitclean.src/proxy: 11 files, 74 tests.Agent Code side
Review a P1: for a fresh session, the bundle asked only for
resume-<providerSessionId>, while the run lives undershell-<paneId>, so no proxy section was bundled at all. That is fixed in the app PR that bumps this package:saveDebugBundlefalls back to the pane's ownshell-key.🤖 Generated with Claude Code