Codex delivers a sub-agent message at a sampling boundary by keeping the
interrupted reply's text, dropping its tool call, and sending the history
on with the new message. Since 0.1.74 lineageVerdict called that a fork:
the pending call was closed with SUPERSEDED_NOTE and the conversation was
replayed in a new session, losing agy's cached prefix and, for a long
history, the turns past the 112 KiB prompt budget.
Now lineageVerdict returns "dropped" when the recorded history with the
turn's unanswered calls taken out is exactly the client's history, and
the reply that carried them kept some text. keepDroppedTurn answers those
calls with "cancelled by the client, not executed" through the existing
steerInSession (MCP commit wait, session/cancel, history set to the
client's), and the new trailing message goes in as the next prompt in
the same session. A changed reply text, a reply that was only the call,
grown tools, another work dir or other instructions still replay as
before; so does a steer that fails.
Run (mote, HOME=$(mktemp -d)):
- node --test test/dropped-call.mjs: 3 pass (kept session; changed text
replays; call-only reply replays).
- bun test (agy-cli): 38 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.
Broken by hand: origin/main's index.mjs with the new test: the kept-
session case fails (a second agy session is started); the two replay
cases pass on both.
Not tried: a real Codex session with a sub-agent message arriving
mid-sampling against a real agy; the fake reproduces the request shape
the issue describes. Part 1 (history seed through systemPrompt.append,
opt-in) is not in this change.