Files
gabrielvidalandClaude Opus 5.5 522b77b972 test(agy): the legacy agy suite and the mirror-replay fixture cover agy's tasks
sidecar/test_agy.py (run against the harness-agy plugin) and the agy
mirror-replay fixture now cover update_steps → todo, a background
run_command with its data.taskId and finished report, manage_task, and a
call cut by an ERROR_MESSAGE. Written by the ai-agent-plugins agy-tasks run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:01:29 +01:00

195 lines
12 KiB
Python

"""Synthetic agy (Antigravity CLI) data, as the ordered writes agy and the
sidecar make. Replayed by ``mirror-replay.py`` into a throw-away layout:
home/.gemini/antigravity-cli/ the account's app dir (brain/, cache/)
logs/<hub uuid>.log the run logs (SIDECAR_LOG_DIR)
runner/ids.json hub uuid ⇄ agy conversation (SIDECAR_AGY_DIR)
Ops:
{"op": "record", sid, fields} agy_cli.record(): the launch's pending run
{"op": "alive", sid, alive} whether the run's process is still there
{"op": "append", file, line} one line onto an app-dir file (a step)
{"op": "write", file, json} a whole app-dir file (subagent link, cache)
{"op": "log", sid, line} one line onto the run's log
{"op": "log_reset", sid} a resume rewrites the run log
Covered: binding a hub run through the log's ``init`` event, the
``<USER_REQUEST>`` / ``<ai-agent-instructions>`` unwrapping, thinking + text +
tool calls (both tool spellings), results in call order, a tool error, a
background tool (``RUNNING`` with its task id, then ``DONE`` for one step
index; agy's "finished" report from the task), plan steps (``update_steps``),
``manage_task`` (status, list), the calls a failed model call left (cut by an
``ERROR_MESSAGE``), a
``SYSTEM_MESSAGE`` body, a turn closed by the next user message and by a
``SUCCESS`` result, an interrupt with a pending tool (``[Request interrupted
by user]``), a resume rewriting the run log, a subagent (sidechain +
meta.json, linked to the spawning call), a failed step + ``ERROR_MESSAGE`` + an
``ERROR`` result (API-error turns), effort suffixes, and a terminal
conversation (no hub run: cwd from ``last_conversations.json``, closed after
its quiet window).
"""
ACCOUNT = "google-personal"
HUB_A = "11111111-0000-4000-8000-00000000000a"
CONV_A = "a0000000-0000-4000-8000-00000000000a"
CHILD = "c0000000-0000-4000-8000-00000000000c"
HUB_B = "11111111-0000-4000-8000-00000000000b"
CONV_B = "b0000000-0000-4000-8000-00000000000b"
CONV_T = "d0000000-0000-4000-8000-00000000000d"
def tfile(conv: str) -> str:
return f"brain/{conv}/.system_generated/logs/transcript_full.jsonl"
def append(conv, **line):
return {"op": "append", "file": tfile(conv), "line": line}
INIT_A = {"event": "init", "conversation_id": CONV_A,
"init": {"model": "gemini-4-hydrogen", "cwd": "/w/demo", "tools": ["read_file"]}}
INSTR = ("<ai-agent-instructions>\nThis machine's instructions live in CLAUDE.md files.\n"
"</ai-agent-instructions>\n\n")
OPS: list[dict] = [
# ── hub run A, turn 1: read + a failing edit, then the answer ──
{"op": "record", "sid": HUB_A, "fields": {"account": ACCOUNT, "cwd": "/w/demo",
"pendingSince": 0}},
{"op": "alive", "sid": HUB_A, "alive": True},
{"op": "log", "sid": HUB_A, "line": INIT_A},
append(CONV_A, step_index=0, source="USER_EXPLICIT", type="USER_INPUT", status="DONE",
created_at="2026-11-22T00:58:35Z",
content=f"<USER_REQUEST>\n{INSTR}edit a.txt: b → g\n</USER_REQUEST>\n"
"<ADDITIONAL_METADATA>\nlocal time 01:58\n</ADDITIONAL_METADATA>"),
append(CONV_A, step_index=1, type="PLANNER_RESPONSE", status="DONE",
created_at="2026-11-22T00:58:36Z", model="gemini-4-hydrogen-low",
input_tokens=9490, cache_read_tokens=0, output_tokens=403, thinking=" plan it ",
tool_calls=[{"name": "read_file", "args": {"Path": "a.txt"}},
{"name": "edit_file", "args": {"Path": "/w/demo/a.txt", "Target": "b",
"Replacement": "g"}}]),
append(CONV_A, step_index=2, type="GENERIC", status="DONE",
created_at="2026-11-22T00:58:37Z",
content="Created At: 2026-11-22T01:58:37+01:00\nCompleted At: x\n1: a\n2: b"),
append(CONV_A, step_index=3, type="GENERIC", status="ERROR",
created_at="2026-11-22T00:58:38Z", content="", error="target not found"),
append(CONV_A, step_index=4, type="PLANNER_RESPONSE", status="DONE",
created_at="2026-11-22T00:58:40Z", model="gemini-4-hydrogen-low",
input_tokens=2313, cache_read_tokens=8167, output_tokens=174,
content="The edit failed: `b` isn't in a.txt."),
{"op": "log", "sid": HUB_A, "line": {"event": "result", "result": {
"status": "SUCCESS", "response": "The edit failed.", "duration_seconds": 5.2,
"usage": {"input_tokens": 11803, "output_tokens": 577}}}},
{"op": "alive", "sid": HUB_A, "alive": False},
# ── run A resumed, turn 2: a background command, a subagent, interrupted ──
{"op": "log_reset", "sid": HUB_A},
{"op": "alive", "sid": HUB_A, "alive": True},
{"op": "log", "sid": HUB_A, "line": INIT_A},
append(CONV_A, step_index=5, source="USER_EXPLICIT", type="USER_INPUT", status="DONE",
created_at="2026-11-22T01:05:00Z",
content="<USER_REQUEST>\nrun the tests, and list the files with a helper\n"
"</USER_REQUEST>"),
append(CONV_A, step_index=6, type="PLANNER_RESPONSE", status="DONE",
created_at="2026-11-22T01:05:02Z", model="gemini-4-neon-high",
input_tokens=12000, cache_read_tokens=4000, output_tokens=220,
content="Starting both.",
tool_calls=[{"name": "run_command", "args": {"CommandLine": "pytest -q",
"Cwd": "/w/demo",
"toolSummary": "Run tests"}},
{"name": "invoke_subagent", "args": {"Subagents": [{
"Prompt": "list the files", "Role": "Lister",
"TypeName": "research"}]}}]),
append(CONV_A, step_index=7, type="GENERIC", status="RUNNING",
created_at="2026-11-22T01:05:03Z",
content="Created At: 2026-11-22T02:05:03+01:00\n"
f"Tool is running as a background task with task id: {CONV_A}/task-7\n"
"Task Description: Run tests\nTask logs are available at: "
f"file:///home/.gemini/brain/{CONV_A}/.system_generated/tasks/task-7.log"),
append(CONV_A, step_index=8, type="GENERIC", status="DONE",
created_at="2026-11-22T01:05:03Z",
content=f'Created the following subagent:\n{{"conversationId": "{CHILD}"}}'),
{"op": "write", "file": f"brain/{CONV_A}/.system_generated/subagents/{CHILD}.json",
"json": {"conversationId": CHILD, "spawnStepIndex": 8,
"subagentDescriptor": {"typeName": "research", "role": "Lister"}}},
append(CHILD, step_index=0, type="SYSTEM_MESSAGE", status="DONE",
created_at="2026-11-22T01:05:04Z",
content="<SYSTEM_MESSAGE>\n[Message] sender=" + CONV_A + " content=list the files\n"
"</SYSTEM_MESSAGE>"),
append(CHILD, step_index=1, type="PLANNER_RESPONSE", status="DONE",
created_at="2026-11-22T01:05:06Z", model="gemini-3.8-flash-low",
input_tokens=800, output_tokens=12, content="a.txt\nb.txt",
tool_calls=[{"name": "view_file", "args": {"AbsolutePath": "/w/demo/a.txt",
"StartLine": 1, "EndLine": 2}}]),
append(CHILD, step_index=2, type="GENERIC", status="DONE",
created_at="2026-11-22T01:05:07Z", content="1: a\n2: b"),
append(CONV_A, step_index=7, type="GENERIC", status="DONE",
created_at="2026-11-22T01:05:09Z", content="Command exited with code 0.\n3 passed"),
append(CONV_A, step_index=9, type="SYSTEM_MESSAGE", status="DONE",
created_at="2026-11-22T01:05:10Z",
content="The following is a <SYSTEM_MESSAGE> not actually sent by the user.\n\n"
f"<SYSTEM_MESSAGE>\n[Message] sender={CHILD} content=a.txt b.txt\n"
"</SYSTEM_MESSAGE>"),
append(CONV_A, step_index=10, type="SYSTEM_MESSAGE", status="DONE",
created_at="2026-11-22T01:05:11Z",
content="<SYSTEM_MESSAGE>\n[Message] timestamp=2026-11-22T01:05:11Z "
f"sender={CONV_A}/task-7 priority=MESSAGE_PRIORITY_HIGH "
f'content=Task id "{CONV_A}/task-7" finished with result:\n'
"Command exited with code 0.\n\nCommand output:\n3 passed\n"
"</SYSTEM_MESSAGE>"),
append(CONV_A, step_index=11, type="PLANNER_RESPONSE", status="DONE",
created_at="2026-11-22T01:05:12Z", model="gemini-4-neon-high",
input_tokens=300, cache_read_tokens=16000, output_tokens=40,
tool_calls=[{"name": "update_steps", "args": {"steps": [
{"title": "Run the tests", "status": "done"},
{"title": "List the files", "status": "in_progress"},
{"title": "Report", "status": "pending"}]}},
{"name": "manage_task", "args": {"Action": "status",
"TaskId": f"{CONV_A}/task-7"}},
{"name": "manage_task", "args": {"Action": "list"}}]),
append(CONV_A, step_index=12, type="GENERIC", status="DONE",
created_at="2026-11-22T01:05:12Z", content="OK"),
append(CONV_A, step_index=13, type="GENERIC", status="DONE",
created_at="2026-11-22T01:05:12Z",
content=f"Task: {CONV_A}/task-7\nStatus: DONE\nLog: file:///x/task-7.log\n"
"Log output:\n3 passed"),
append(CONV_A, step_index=14, type="GENERIC", status="DONE",
created_at="2026-11-22T01:05:13Z",
content="No background tasks are currently running."),
append(CONV_A, step_index=15, type="PLANNER_RESPONSE", status="DONE",
created_at="2026-11-22T01:05:14Z", model="gemini-4-neon-high",
input_tokens=300, cache_read_tokens=16000, output_tokens=40,
tool_calls=[{"name": "view_file", "args": {"AbsolutePath": "/w/demo/b.txt"}}]),
# interrupted while view_file ran: agy writes no step, the log says it
{"op": "log", "sid": HUB_A, "line": {"event": "result", "result": {
"status": "ERROR", "error": "interrupted", "finished_reason": "interrupted"}}},
{"op": "alive", "sid": HUB_A, "alive": False},
# ── hub run B: a failed model call and an ERROR result ──
{"op": "record", "sid": HUB_B, "fields": {"account": ACCOUNT, "cwd": "/w/other",
"pendingSince": 0}},
{"op": "alive", "sid": HUB_B, "alive": True},
{"op": "log", "sid": HUB_B, "line": {"event": "init", "conversation_id": CONV_B,
"init": {"cwd": "/w/other"}}},
append(CONV_B, step_index=0, source="USER_EXPLICIT", type="USER_INPUT", status="DONE",
created_at="2026-11-22T02:00:00Z", content="<USER_REQUEST>\nsummarise\n</USER_REQUEST>"),
append(CONV_B, step_index=1, type="PLANNER_RESPONSE", status="ERROR",
created_at="2026-11-22T02:00:02Z", model="gemini-4-argon-xhigh",
input_tokens=100, output_tokens=0, content="Partial",
error="RESOURCE_EXHAUSTED: quota",
tool_calls=[{"name": "read_file", "args": {"Path": "/w/other/x"}}]),
append(CONV_B, step_index=2, type="ERROR_MESSAGE", status="DONE",
created_at="2026-11-22T02:00:03Z", content="upstream connection reset"),
{"op": "log", "sid": HUB_B, "line": {"event": "result", "result": {
"status": "ERROR", "error": "RESOURCE_EXHAUSTED: weekly limit"}}},
{"op": "alive", "sid": HUB_B, "alive": False},
# ── a conversation started in a terminal ──
{"op": "write", "file": "cache/last_conversations.json", "json": {"/w/term": CONV_T}},
append(CONV_T, step_index=0, source="USER_EXPLICIT", type="USER_INPUT", status="DONE",
created_at="2026-11-22T03:00:00Z", content="hello"),
append(CONV_T, step_index=1, type="PLANNER_RESPONSE", status="DONE",
created_at="2026-11-22T03:00:01Z", model="gemini-4-neon",
input_tokens=50, output_tokens=5, content="Hi!"),
]