Skip to content

P2: Replay-fixture provider harness: recorded CLI output through the real runner #1428

Closed

Description

@currentbits

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.

Activity

  1. added
    plan:todo
    on Oct 4, 2026
  2. currentbits commented on Oct 4, 2026

    @currentbits
    OwnerAuthor

    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).

    Already in place

    • resolveBin honours CODER_CLAUDE_BIN (providers.js:1477-1484).
    • electron/test/support/fakeBin.js writes node shebang fakes that also work on win32.
    • 28 test files already drive the real createRunner → store → IPC path through fake binaries.
    • A 681-line fake Codex CLI that speaks JSON-RPC (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 a gate:

    {"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

    1. electron/test/support/replayCli.js (~100 lines).
    2. 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.
    3. 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.
    4. 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.

    First scenarios

    1. A worker finishes and wakes its idle lead. This also covers P2: Structured worker result in the lead's wake notice, rendered as a card #1427's workerResults.
    2. A permission stall reaches awaitingInput, then gets answered.
    3. A restart mid-run leaves a held notice and nothing auto-starts (P1: Durable crew notices and honest restart recovery with consent-gated resume #1426).
    4. 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.
    5. 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.

  3. currentbits commented on Oct 4, 2026

    @currentbits
    OwnerAuthor

    Seed material from the third research pass (branch coder/i-want-you-to-research-t3-codes-orchestr-fae77a):

  4. added
    plan:doing
    plan:done
    and removed
    plan:todo
    plan:doing
    on Oct 12, 2026
  5. currentbits commented on Oct 12, 2026

    @currentbits
    OwnerAuthor

    Landed from Solenta thread "P2: Replay-fixture provider harness: recorded CLI output thr". Closed on merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions