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.
80 lines
1.1 KiB
Plaintext
80 lines
1.1 KiB
Plaintext
{
|
|
"type": "session",
|
|
"version": 1,
|
|
"id": "{{sessionId}}",
|
|
"createdAt": 0,
|
|
"cwd": "{{cwd}}"
|
|
}
|
|
{
|
|
"type": "turn/start",
|
|
"seq": 0,
|
|
"time": 0,
|
|
"data": {
|
|
"turn": 1,
|
|
"trigger": {
|
|
"kind": "message",
|
|
"source": {
|
|
"kind": "user"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
{
|
|
"type": "user/message",
|
|
"seq": 1,
|
|
"time": 0,
|
|
"data": {
|
|
"content": [
|
|
{
|
|
"type": "text",
|
|
"text": "This prompt triggers a recorded provider error."
|
|
}
|
|
],
|
|
"source": {
|
|
"kind": "user"
|
|
}
|
|
}
|
|
}
|
|
{
|
|
"type": "step/start",
|
|
"seq": 2,
|
|
"time": 0,
|
|
"data": {
|
|
"turn": 1,
|
|
"step": 1
|
|
}
|
|
}
|
|
{
|
|
"type": "step/end",
|
|
"seq": 3,
|
|
"time": 0,
|
|
"data": {
|
|
"turn": 1,
|
|
"step": 1
|
|
}
|
|
}
|
|
{
|
|
"type": "error",
|
|
"seq": 4,
|
|
"time": 0,
|
|
"data": {
|
|
"turn": 1,
|
|
"step": 1,
|
|
"message": "simulated provider error (HTTP 401)",
|
|
"code": "AUTH"
|
|
}
|
|
}
|
|
{
|
|
"type": "turn/end",
|
|
"seq": 5,
|
|
"time": 0,
|
|
"data": {
|
|
"turn": 1,
|
|
"reason": {
|
|
"kind": "error",
|
|
"message": "simulated provider error (HTTP 401)",
|
|
"code": "AUTH"
|
|
}
|
|
}
|
|
}
|