Skip to content

Replay forks under a live session's system prompt and tools - #6582

Merged
max-sixty merged 2 commits into
mainfrom
fork-eval-composed-requests
Nov 20, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fork-eval-composed-requests

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The fork eval's replay now sends the request a live fork sends, apart from one date line: Claude Code's interactive identity line, system prompt and tools, then the case's turns and the fork's prompt. Before, claude -p sent its headless prefix (the Agent SDK identity line, a 4,300-character system prompt, 11 tools). Claude Code records a conversation's prefix as a prompt_snapshot and resends it verbatim on resume, so the replay copies the last snapshot of the newest interactive session on the machine into the case's transcript and pins it for the run, so every arm resends the same one.

On source-edited under the line fork prompt before #6477, the one judgment where the replay and live forks disagreed, the live prefix hands the page-source read to the session 11 times of 24 against live forks' 29 of 60; the headless replay did 11 of 46 (p = 0.015 against live forks). Where today's date sits doesn't change it, and at the session's start it made two turn-end cases read their own dates as stale, so it stays after the prompt.

To weigh: all 35 fork cases with judges pass 34 of 35 against 35 of 35 before. The miss is ask-question's judge on the form of the ask's text, which the live prefix failed 6 of 8 times against 2 of 7 (p = 0.13). The prefix comes from the user's own newest session, so a background job's prompt and a foreground session's differ between runs; each sample records which session it used. A case costs about 10% more.

Max picked sending the live fork's request on his login; Claude Code sends it, so no other client reads the login's token. Codex reviewed it. Tests: the fork replay smoke tests.

This was written by Claude Code on behalf of max-sixty

The fork eval's replay sent `claude -p`'s headless prefix: the Agent SDK identity
line, a 4,300-character system prompt and 11 tools. A live fork resends an
interactive session's: Claude Code's CLI identity line, about 17,600 characters
and the session's tools. Claude Code records a conversation's prefix as a
`prompt_snapshot` and resends a recorded one verbatim on resume
(`--system-prompt-snapshot`, on by default in 2.1.329), so the replay now copies
the last snapshot of the newest interactive session on the machine into the
case's transcript, after the first prompt, and pins it in the run's samples
directory so every arm resends the same one. Captured `/v1/messages` bodies show
the interactive identity line, the session's system prompt and its tools, then
the case's turns and the prompt. `--exclude-dynamic-system-prompt-sections`
goes: under a snapshot it changed nothing in the request.

Max picked "the exact request on my login". The option proposed Promptfoo's
`anthropic:messages` with the token from Claude Code's keychain entry; Claude
Code's own resend gives the same request without another client handling the
token.

Measured 2026-11-19, on `source-edited` under the line fork prompt before
#6477, 12 runs per cell, counting forks that hand the page-source read to the
session (live forks on three journey sessions' conversations: 29 of 60):

- headless prefix, date after the prompt (the replay before): 1 of 12
- headless prefix, date at the session's start: 3 of 12
- live prefix, date after the prompt (the replay now): 7 of 12
- live prefix, date at the session's start: 4 of 12

The prefix decides it: live 11 of 24 against headless 4 of 24 (Fisher
p = 0.06), and with the earlier headless runs (7 of 22) headless 11 of 46
against live forks' 29 of 60 (p = 0.015), live 11 of 24 against them
(p = 1.0). Where the date line sits makes no difference (7 of 24 against 8 of
24).

Today's date stays after the prompt. With it at the session's start, all 35
fork cases with their judges scored 32 of 35: ask-step-done and ask-follow-up
read the cases' 3 November dates as stale. With it after the prompt, 34 of 35,
against 35 of 35 for the replay before, run beside it. The one failure is
ask-question's judge, on the form of the ask's text (the question not on a line
of its own, or prose going through each option). Over that run and six more of
the case on each replay, the live prefix's asks failed it 6 times of 8 and the
headless replay's 2 of 7 (p = 0.13), so the live prefix may change how the
turn-end fork words an ask.

The live prefix raises a case's input from 24,600 to 39,900 tokens, mostly
cache reads; the 35 cases cost $3.16 at list prices against $2.89.

Fixes a hook line that directly follows another record without a message:
it now takes its event from the nearest record with one.

Codex reviewed the change. Tests: the fork replay smoke tests.
@max-sixty
max-sixty merged commit e690c07 into main Nov 20, 2026
6 checks passed
@max-sixty
max-sixty deleted the fork-eval-composed-requests branch November 20, 2026 17:20
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.

2 participants