# OpenCode 2 answer-delivery race proof

The same driver ran against base [9c7618ba1c](https://github.com/pingdotgg/t3code/commit/9c7618ba1cdbf88f775c1d9f70bc1f38eaf1b8e0) and head [530d91bbca](https://github.com/pingdotgg/t3code/commit/530d91bbcaef8e76ce565fa85b3eacdee0b91b95).

Environment for all captures: Linux web dev client, headless Chromium, 1440x1000, dark theme; real OpenCode 2.2.7 and anthropic/claude-haiku-4-5-20251001 through an authenticated model endpoint. Each run creates a new timestamped directory containing a fresh unseeded T3 home, isolated OpenCode XDG directories, one synthetic git project (Approval demo), and one thread (Question delivery race). No live database is used. Source code was not changed. The browser's thread-details panel is closed on both sides.

## Rebuild

Install dependencies with `vp i` in each checkout. Install the CLI in a scratch directory:

    npm install --prefix ./opencode @opencode/cli@2.2.7

Provide an OpenCode config JSON that authenticates the Anthropic provider to an endpoint serving claude-haiku-4-5-20251001. This is private runtime input, not part of this upload. The driver copies it into each run's isolated XDG config. Run the following sequentially, replacing the capitalized arguments with absolute paths:

    node driver.mjs BASE_CHECKOUT OUTPUT_ROOT OPENCODE_BINARY PRIVATE_OPENCODE_CONFIG base
    node driver.mjs HEAD_CHECKOUT OUTPUT_ROOT OPENCODE_BINARY PRIVATE_OPENCODE_CONFIG head

OPENCODE_BINARY is the installed package's node_modules/@opencode/cli/bin/opencode.exe. Requirements: Node as selected by vp, vp, git, sqlite3, the checkout's playwright-core, and its installed Chromium headless shell. The driver spawns and stops its own dev stack and OpenCode process. Ports 14568 and 14569 must be free. Each run writes a new output directory rather than overwriting any earlier run.

The driver creates the project and starts the thread through T3's CLI. It opens the paired real web client, waits for the actual approval option, SIGSTOPs the captured OpenCode PID, queues POST /api/location/reload, clicks the option in Chromium, waits for T3 to persist a resolved request, and SIGCONTs OpenCode. No click or resume is manual. The model is instructed to say "Still waiting on approval." and end the turn if its question was cancelled, keeping the continuation repeatable. The model places Recommended in the option description and uses Approve plan as the option value.

After the completed turn, the driver saves delivery-outcome.png only after two screenshots 500 ms apart are byte-identical. It reads the synthetic request projection read-only. Then it sends "Approve plan. Create approved.txt containing \"approved\" now." through the chat UI on both commits, verifies the file exists, and saves chat-recovery.png after the same stability check. interaction.webm records the full browser session.

To remove only the initial app load from the recording:

    python3 prepare-video.py RUN_DIRECTORY

This creates interaction.mp4 using the driver's recorded race-start offset; it preserves the interaction continuously through chat recovery. Private runtime logs, config, and databases must never be uploaded.

## Observations

Base: after reload, the turn completed with "Still waiting on approval."; the UI nevertheless displayed "May I create approved.txt? Approve plan". The request remained resolved with answers {"q0":"Approve plan"}; approved.txt was absent. There was no delivery-failure message. Chat approval then created the file.

Head: after the same race, the turn completed with "Still waiting on approval."; the accepted answer was removed. The request was cancelled with no answers. The UI displayed "Answer not delivered" and "The agent closed this question before your answer reached it. Reply in the chat to answer again." approved.txt was absent until the driver followed that instruction in chat; the file was then created and appeared in the diff summary.

The SIGTERM control, server-restart/FormNotFoundError path, and lost-response retry path are not part of this captured location-reload comparison.
