You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
P2: Replay-fixture provider harness: recorded CLI output through the real runner #1428
From the T3 Code Orchestrator V2 comparison (report: reports/T3 Code orchestrator for Solenta.md on branch coder/i-want-you-to-research-t3-codes-orchestr-fae77a). This is item 4 of 4. V2's tests replay recorded NDJSON provider transcripts through the real orchestrator, adapter, normalizer and storage. "Test doubles exist only at true process, network, clock, id, and filesystem boundaries."
Why
Solenta keeps shipping bugs past a green suite because each side of a seam is mocked: parallel workers mocking each other's call seam, gaps that only a read-only scan of the live store found, a broken CSS module that only the release script caught. The orchestration changes in items 1–3 (durable notices, restart recovery, structured results) need tests that run the real path.
Build
Record. Capture real claude-stream stdout (grok uses the same format) into NDJSON fixtures under test/.
Replay script. A small script, a few dozen lines, that replays a fixture with its delays and asserts the stdin writes it expects (V2's expect_outbound / emit_inbound / runtime_exit).
Wire it in. Point the provider's binEnv override at the script (e.g. CODER_CLAUDE_BIN, electron/providers.js:244). Providers are data-driven, so startRun → stream handling → store → pushDetail all run for real.
First scenarios:
a worker finishing wakes its lead;
a restart mid-run (item 2);
steering a live run (steerRun, electron/runner.js:8812);
a stall waiting on a permission prompt.
Later. Codex's two-way JSON-RPC needs a responder and can come later.
Note: run it CI-style. Clear inherited CODER_* env vars and use a PATH with only node, so provider CLIs installed on the machine don't hide failures.
Size: S–M. No dependencies. It can run in parallel with items 1 and 3.
A code-level pass found most of the plumbing already exists. Full detail: reports/T3 Code orchestrator deep dive.md on branch coder/i-want-you-to-research-t3-codes-orchestr-fae77a. Revised size: S, about 300 lines (1–2 days).
It reads the fixture directory from CODER_REPLAY_DIR. A path, not an inlined transcript, because T3 found transcripts outgrow the 128 KiB limit on one env var.
It picks a fixture by matching the first prompt, since a lead and its workers share one env.
On a mismatch it appends to CODER_REPLAY_LOG and exits 3. Every test asserts the log is clean.
useReplay() (~40 lines). Snapshots and deletes every inherited CODER_* var, sets the replay vars, and sets PATH to node's dir plus git's dir. A node-only PATH breaks every test that runs git init or creates worktrees.
scripts/record-claude-fixture.js (~60 lines, manual). Tees a real session into fixture lines. --sanitize replaces session and request ids, home/cwd paths and tokens.
The first scenario file.
Gates replace sleeps. A restart is a new Store(file) plus a new runner over the same files, which is T3's two-runtime pattern. Name fixtures after the CLI version and re-record on each bump.
A live run is steered. Record the Claude behaviour with no priority vs priority:"next" here. T3's #15351 found that "now" cancels queued tool calls, so it's wrong for machine messages.
Stopping a lead whose worker is just finishing must not wake the lead again (T3 #15325).
Add the new file to the Windows allowlist in scripts/test-electron.js:13-25 once it passes there.
Claude fixtures worth recording first. Measured on Claude Code 2.1.283; driver script and raw ndjson are in research_notes/T3 orchestrator ACP UX and repros/cli_experiments.md.
result with terminal_reason: "aborted_tools", subtype: "success" and empty result. Today the runner would finalize a run on it.
rate_limit_event: status, resetsAt, rateLimitType, unifiedWindows. Solenta receives it and ignores it.
command_lifecycle frames and user_message_uuids echoed on result when stdin messages carry a client uuid.
A cumulative total_cost_usd across turns of one warm process. This is the acceptance test for the new cost over-count issue.
PATH correction. The PATH for useReplay() needs git's directory as well as node's. The repro runs confirmed a node-only PATH breaks every test that creates a repo.
Activity
currentbits commentedon Oct 4, 2026
A code-level pass found most of the plumbing already exists. Full detail:
reports/T3 Code orchestrator deep dive.mdon branchcoder/i-want-you-to-research-t3-codes-orchestr-fae77a. Revised size: S, about 300 lines (1–2 days).Already in place
resolveBinhonoursCODER_CLAUDE_BIN(providers.js:1477-1484).electron/test/support/fakeBin.jswrites node shebang fakes that also work on win32.createRunner→ store → IPC path through fake binaries.electron/test/support/fakeCodexCli.js).What's missing is one generic fake that is driven by a fixture file and asserts what the runner writes to its stdin.
Fixture format
It uses T3's directives (
expect/emit/ exit) plus agate:{"v":1,"provider":"claude","match":{"firstPrompt~":"Worker task A"},"argv":{"mcpConfigUrl~":["projectId=","threadId="]}} {"expect":{"type":"user","message.content~":"Worker task A"}} {"emit":{"type":"system","subtype":"init","session_id":"sess-a","model":"m"}} {"emit":{"type":"control_request","request_id":"req-1","request":{"subtype":"can_use_tool","tool_name":"Bash","input":{"command":"ls"}}}} {"expect":{"type":"control_response","response.request_id":"req-1","response.response.behavior":"allow"}} {"gate":"worker-a-finish"} {"emit":{"type":"result","subtype":"success","result":"built it","session_id":"sess-a"}} {"expect":{"type":"user","message.content~":"[orchestration] Worker thread"}}New pieces
electron/test/support/replayCli.js(~100 lines).CODER_REPLAY_DIR. A path, not an inlined transcript, because T3 found transcripts outgrow the 128 KiB limit on one env var.--mcp-configURL, which gives P1: Bind the caller's thread id at the MCP transport (closes thread_stop/thread_archive approval bypass) #1425 an end-to-end check.CODER_REPLAY_LOGand exits 3. Every test asserts the log is clean.useReplay()(~40 lines). Snapshots and deletes every inheritedCODER_*var, sets the replay vars, and sets PATH to node's dir plus git's dir. A node-only PATH breaks every test that runsgit initor creates worktrees.scripts/record-claude-fixture.js(~60 lines, manual). Tees a real session into fixture lines.--sanitizereplaces session and request ids, home/cwd paths and tokens.Gates replace sleeps. A restart is a new
Store(file)plus a new runner over the same files, which is T3's two-runtime pattern. Name fixtures after the CLI version and re-record on each bump.First scenarios
workerResults.awaitingInput, then gets answered.priorityvspriority:"next"here. T3's #15351 found that"now"cancels queued tool calls, so it's wrong for machine messages.Add the new file to the Windows allowlist in
scripts/test-electron.js:13-25once it passes there.currentbits commentedon Oct 4, 2026
Seed material from the third research pass (branch
coder/i-want-you-to-research-t3-codes-orchestr-fae77a):research_notes/T3 orchestrator ACP UX and repros/repros/, plusrun-ci.shfor the CI-comparable env. They cover I1, I2, I3, I4, R1, R2, R3, R5, R7, P1 and P2, and they fail on current code by design. Land them alongside the harness as acceptance tests, marking each skip/todo until its fix issue (Hotfix: agent thread_send turns must not count as human (merge gate) #1433, Close thread_stop/thread_archive approval bypass #1432, P1: Bind the caller's thread id at the MCP transport (closes thread_stop/thread_archive approval bypass) #1425, P1: Close eight run-lifecycle races (double fork, verify window, checkpoint vs next turn, unguarded worktree IPC) #1430, P2: PR refresher can't see archived worker PRs (34 of 35 stuck OPEN); merged-worktree cleanup ignores running threads #1431) lands.research_notes/T3 orchestrator ACP UX and repros/cli_experiments.md.resultwithterminal_reason: "aborted_tools",subtype: "success"and emptyresult. Today the runner would finalize a run on it.rate_limit_event:status,resetsAt,rateLimitType,unifiedWindows. Solenta receives it and ignores it.command_lifecycleframes anduser_message_uuidsechoed onresultwhen stdin messages carry a clientuuid.total_cost_usdacross turns of one warm process. This is the acceptance test for the new cost over-count issue.useReplay()needs git's directory as well as node's. The repro runs confirmed a node-only PATH breaks every test that creates a repo.currentbits commentedon Oct 12, 2026
Landed from Solenta thread "P2: Replay-fixture provider harness: recorded CLI output thr". Closed on merge.