Files
deepseek-harness/examples/acp-agent/tests/snapshots/tool-call-turn/session.jsonl
Tianyi Cui c94f1563f5 test(acp-example): five snapshot scenarios + cancel/error input ops
Adds the first cut of snapshot scenarios, each asserting a normalized stdout
transcript golden and (for model turns) a re-persisted session-log golden:

- text-turn, tool-call-turn, multi-turn: RECORDED against the real API — the
  committed session.jsonl is a genuine harvested log; replay derives the model
  script from it and reproduces deterministically with no key. tool-call-turn
  exercises the real bash executor (echo SNAPSHOT_OK → tool/call + tool/result
  + a post-tool answer step).
- error-finish, cancel: AUTHORED via a replay.override.json sidecar (the live
  API can't be coaxed into a deterministic 401 or mid-stream cancel). error-
  finish replays a {kind:throw} 401 → the bridge answers the prompt with a
  JSON-RPC error and the log records turn/end{kind:error}; cancel replays a
  {kind:hang} → stopReason:cancelled.

Two input-DSL ops support these: promptExpectError (awaits the prompt, asserts
it rejects — the editor's view of a failed turn — and swallows it) and
promptAndCancel (dispatches the prompt unawaited, waits until the client
OBSERVES the streamed agent_message_chunk, then cancels — pinning frame order
so the cancel transcript is deterministic; fixes a flake Codex caught where the
late chunk and the cancelled response could interleave either way).

Scenarios carry a `recorded` flag so test:snapshot:record only re-runs the
live-API ones. reasoning/max-tokens scenarios are deferred (hard to force
deterministically from the live model). Per docs/rfc/implemented/2026-06-19.
2026-06-19 04:10:49 +08:00

101 lines
16 KiB
JSON

{"type":"session","version":1,"id":"8c1d42ba-5f00-44bb-aaa1-0832fae5c24a","createdAt":1781811967162,"cwd":"/tmp/acp-snap-cwd-rdktn3"}
{"type":"turn/start","seq":0,"time":1781811967165,"data":{"turn":1,"trigger":{"kind":"message","source":{"kind":"user"}}}}
{"type":"user/message","seq":1,"time":1781811967165,"data":{"content":[{"type":"text","text":"Use the bash tool to run exactly: echo SNAPSHOT_OK. Then reply with the single word DONE and stop."}],"source":{"kind":"user"}}}
{"type":"step/start","seq":2,"time":1781811967165,"data":{"turn":1,"step":1}}
{"type":"assistant/chunk","seq":3,"time":1781811967719,"data":{"turn":1,"step":1,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}}}
{"type":"assistant/chunk","seq":4,"time":1781811967720,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":"The"}}}
{"type":"assistant/chunk","seq":5,"time":1781811967849,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" user"}}}
{"type":"assistant/chunk","seq":6,"time":1781811967883,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" wants"}}}
{"type":"assistant/chunk","seq":7,"time":1781811967883,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" me"}}}
{"type":"assistant/chunk","seq":8,"time":1781811967883,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" to"}}}
{"type":"assistant/chunk","seq":9,"time":1781811967884,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" run"}}}
{"type":"assistant/chunk","seq":10,"time":1781811967884,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" a"}}}
{"type":"assistant/chunk","seq":11,"time":1781811967916,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" specific"}}}
{"type":"assistant/chunk","seq":12,"time":1781811967917,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" command"}}}
{"type":"assistant/chunk","seq":13,"time":1781811967950,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" and"}}}
{"type":"assistant/chunk","seq":14,"time":1781811967950,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" then"}}}
{"type":"assistant/chunk","seq":15,"time":1781811967951,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" reply"}}}
{"type":"assistant/chunk","seq":16,"time":1781811967984,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" with"}}}
{"type":"assistant/chunk","seq":17,"time":1781811967984,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":" D"}}}
{"type":"assistant/chunk","seq":18,"time":1781811967984,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":"ONE"}}}
{"type":"assistant/chunk","seq":19,"time":1781811967985,"data":{"turn":1,"step":1,"chunk":{"type":"reasoning-delta","index":0,"text":"."}}}
{"type":"assistant/chunk","seq":20,"time":1781811968085,"data":{"turn":1,"step":1,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}}}
{"type":"assistant/chunk","seq":21,"time":1781811968086,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":""}}}
{"type":"assistant/chunk","seq":22,"time":1781811968120,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"{"}}}
{"type":"assistant/chunk","seq":23,"time":1781811968121,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"\""}}}
{"type":"assistant/chunk","seq":24,"time":1781811968121,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"command"}}}
{"type":"assistant/chunk","seq":25,"time":1781811968121,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"\""}}}
{"type":"assistant/chunk","seq":26,"time":1781811968121,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":": "}}}
{"type":"assistant/chunk","seq":27,"time":1781811968153,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"\""}}}
{"type":"assistant/chunk","seq":28,"time":1781811968153,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"echo"}}}
{"type":"assistant/chunk","seq":29,"time":1781811968153,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":" S"}}}
{"type":"assistant/chunk","seq":30,"time":1781811968153,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"NA"}}}
{"type":"assistant/chunk","seq":31,"time":1781811968187,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"PS"}}}
{"type":"assistant/chunk","seq":32,"time":1781811968188,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"H"}}}
{"type":"assistant/chunk","seq":33,"time":1781811968188,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"OT"}}}
{"type":"assistant/chunk","seq":34,"time":1781811968188,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"_OK"}}}
{"type":"assistant/chunk","seq":35,"time":1781811968188,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"\""}}}
{"type":"assistant/chunk","seq":36,"time":1781811968254,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":", "}}}
{"type":"assistant/chunk","seq":37,"time":1781811968255,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"\""}}}
{"type":"assistant/chunk","seq":38,"time":1781811968255,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"description"}}}
{"type":"assistant/chunk","seq":39,"time":1781811968255,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"\""}}}
{"type":"assistant/chunk","seq":40,"time":1781811968255,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":": "}}}
{"type":"assistant/chunk","seq":41,"time":1781811968289,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"\""}}}
{"type":"assistant/chunk","seq":42,"time":1781811968289,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"Run"}}}
{"type":"assistant/chunk","seq":43,"time":1781811968289,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":" the"}}}
{"type":"assistant/chunk","seq":44,"time":1781811968289,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":" exact"}}}
{"type":"assistant/chunk","seq":45,"time":1781811968323,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":" echo"}}}
{"type":"assistant/chunk","seq":46,"time":1781811968356,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":" command"}}}
{"type":"assistant/chunk","seq":47,"time":1781811968356,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":" requested"}}}
{"type":"assistant/chunk","seq":48,"time":1781811968390,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"\""}}}
{"type":"assistant/chunk","seq":49,"time":1781811968390,"data":{"turn":1,"step":1,"chunk":{"type":"tool-call-delta","index":1,"id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","argumentsDelta":"}"}}}
{"type":"assistant/chunk","seq":50,"time":1781811968477,"data":{"turn":1,"step":1,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The user wants me to run a specific command and then reply with DONE."}}}}
{"type":"assistant/chunk","seq":51,"time":1781811968477,"data":{"turn":1,"step":1,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","arguments":"{\"command\": \"echo SNAPSHOT_OK\", \"description\": \"Run the exact echo command requested\"}"}}}}
{"type":"assistant/chunk","seq":52,"time":1781811968477,"data":{"turn":1,"step":1,"chunk":{"type":"usage","usage":{"inputTokens":129,"outputTokens":86,"cacheReadTokens":768,"reasoningTokens":16}}}}
{"type":"assistant/chunk","seq":53,"time":1781811968477,"data":{"turn":1,"step":1,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}}
{"type":"assistant/message","seq":54,"time":1781811968479,"data":{"turn":1,"step":1,"content":[{"type":"reasoning","text":"The user wants me to run a specific command and then reply with DONE."},{"type":"tool-call","id":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","arguments":"{\"command\": \"echo SNAPSHOT_OK\", \"description\": \"Run the exact echo command requested\"}"}]}}
{"type":"usage","seq":55,"time":1781811968479,"data":{"turn":1,"step":1,"usage":{"inputTokens":129,"outputTokens":86,"cacheReadTokens":768,"reasoningTokens":16}}}
{"type":"tool/call","seq":56,"time":1781811968479,"data":{"turn":1,"step":1,"callId":"call_00_waDnb5eZcD1dBV49O7F39256","name":"bash","arguments":"{\"command\": \"echo SNAPSHOT_OK\", \"description\": \"Run the exact echo command requested\"}"}}
{"type":"tool/result","seq":57,"time":1781811968493,"data":{"turn":1,"step":1,"callId":"call_00_waDnb5eZcD1dBV49O7F39256","content":[{"type":"text","text":"SNAPSHOT_OK\n"}],"isError":false}}
{"type":"step/end","seq":58,"time":1781811968494,"data":{"turn":1,"step":1}}
{"type":"step/start","seq":59,"time":1781811968494,"data":{"turn":1,"step":2}}
{"type":"assistant/chunk","seq":60,"time":1781811969060,"data":{"turn":1,"step":2,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}}}
{"type":"assistant/chunk","seq":61,"time":1781811969060,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"The"}}}
{"type":"assistant/chunk","seq":62,"time":1781811969175,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" command"}}}
{"type":"assistant/chunk","seq":63,"time":1781811969209,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" ran"}}}
{"type":"assistant/chunk","seq":64,"time":1781811969244,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" successfully"}}}
{"type":"assistant/chunk","seq":65,"time":1781811969244,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" and"}}}
{"type":"assistant/chunk","seq":66,"time":1781811969244,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" output"}}}
{"type":"assistant/chunk","seq":67,"time":1781811969244,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" \""}}}
{"type":"assistant/chunk","seq":68,"time":1781811969278,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"S"}}}
{"type":"assistant/chunk","seq":69,"time":1781811969278,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"NA"}}}
{"type":"assistant/chunk","seq":70,"time":1781811969278,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"PS"}}}
{"type":"assistant/chunk","seq":71,"time":1781811969279,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"H"}}}
{"type":"assistant/chunk","seq":72,"time":1781811969279,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"OT"}}}
{"type":"assistant/chunk","seq":73,"time":1781811969279,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"_OK"}}}
{"type":"assistant/chunk","seq":74,"time":1781811969313,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"\"."}}}
{"type":"assistant/chunk","seq":75,"time":1781811969313,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" Now"}}}
{"type":"assistant/chunk","seq":76,"time":1781811969313,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" I"}}}
{"type":"assistant/chunk","seq":77,"time":1781811969314,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" need"}}}
{"type":"assistant/chunk","seq":78,"time":1781811969314,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" to"}}}
{"type":"assistant/chunk","seq":79,"time":1781811969314,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" reply"}}}
{"type":"assistant/chunk","seq":80,"time":1781811969347,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" with"}}}
{"type":"assistant/chunk","seq":81,"time":1781811969348,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" the"}}}
{"type":"assistant/chunk","seq":82,"time":1781811969348,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" single"}}}
{"type":"assistant/chunk","seq":83,"time":1781811969420,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" word"}}}
{"type":"assistant/chunk","seq":84,"time":1781811969421,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":" \""}}}
{"type":"assistant/chunk","seq":85,"time":1781811969421,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"D"}}}
{"type":"assistant/chunk","seq":86,"time":1781811969421,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"ONE"}}}
{"type":"assistant/chunk","seq":87,"time":1781811969421,"data":{"turn":1,"step":2,"chunk":{"type":"reasoning-delta","index":0,"text":"\"."}}}
{"type":"assistant/chunk","seq":88,"time":1781811969421,"data":{"turn":1,"step":2,"chunk":{"type":"block-start","index":1,"blockType":"text"}}}
{"type":"assistant/chunk","seq":89,"time":1781811969422,"data":{"turn":1,"step":2,"chunk":{"type":"text-delta","index":1,"text":"D"}}}
{"type":"assistant/chunk","seq":90,"time":1781811969422,"data":{"turn":1,"step":2,"chunk":{"type":"text-delta","index":1,"text":"ONE"}}}
{"type":"assistant/chunk","seq":91,"time":1781811969422,"data":{"turn":1,"step":2,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The command ran successfully and output \"SNAPSHOT_OK\". Now I need to reply with the single word \"DONE\"."}}}}
{"type":"assistant/chunk","seq":92,"time":1781811969422,"data":{"turn":1,"step":2,"chunk":{"type":"block-end","index":1,"block":{"type":"text","text":"DONE"}}}}
{"type":"assistant/chunk","seq":93,"time":1781811969422,"data":{"turn":1,"step":2,"chunk":{"type":"usage","usage":{"inputTokens":105,"outputTokens":30,"cacheReadTokens":896,"reasoningTokens":27}}}}
{"type":"assistant/chunk","seq":94,"time":1781811969422,"data":{"turn":1,"step":2,"chunk":{"type":"finish","reason":{"kind":"stop"}}}}
{"type":"assistant/message","seq":95,"time":1781811969422,"data":{"turn":1,"step":2,"content":[{"type":"reasoning","text":"The command ran successfully and output \"SNAPSHOT_OK\". Now I need to reply with the single word \"DONE\"."},{"type":"text","text":"DONE"}]}}
{"type":"usage","seq":96,"time":1781811969422,"data":{"turn":1,"step":2,"usage":{"inputTokens":105,"outputTokens":30,"cacheReadTokens":896,"reasoningTokens":27}}}
{"type":"step/end","seq":97,"time":1781811969422,"data":{"turn":1,"step":2}}
{"type":"turn/end","seq":98,"time":1781811969423,"data":{"turn":1,"reason":{"kind":"completed"}}}