# Pi empty-text stream proof

This is deterministic protocol injection through the real Pi adapter, server,
WebSocket orchestration, and web client. It does not call Gemini or the real Pi CLI.
The same executable was used for both commits. No application source was changed.

Base: a8bbc2b241d9b0f059ca6288079ed30a5d37dc86
Head: f6acba4391c21beab6fb384c087bc584170fcf0c

For each independent checkout:

1. Install with `vp i`; start `T3CODE_DEV_SEED=0 vp run dev` on fresh state.
2. Make pi-rpc.mjs executable. In this checkout's own `.t3/userdata/settings.json`,
   add providerInstances.pi with driver `pi`, enabled true, and
   config.binaryPath set to that executable's absolute path.
3. Create a synthetic git project containing README.md with the text
   `Synthetic project for empty-text stream proof.`
4. Add it with `node apps/server/src/bin.ts project add <project> --title 'Pi empty text proof' --base-dir .t3`.
5. Ensure no file named `start` exists next to pi-rpc.mjs. Launch:
   `node apps/server/src/bin.ts thread start <project> 'Read README.md and answer.' --provider pi --model google/gemini-4-neon --title 'Empty text stream' --base-dir .t3 --json`.
6. Pair Chromium to the printed dev URL. Navigate directly to the returned thread,
   using `/<environmentId>/<encoded threadId>`. Viewport 1280x800, light theme.
   Collapse the sidebar and thread details using their toolbar buttons, to hide
   machine-specific names. Start the browser recording.
7. Create the file `start` beside pi-rpc.mjs. The process emits assistant message_start,
   text_start, empty text_delta, tool_execution_start; after 120 ms it emits empty
   text_end and message_end. After 1500 ms it completes the synthetic read tool,
   emits a second assistant message with text_end `Answer`, then agent_settled.
8. Wait for completion. Expand `Worked for …` to expose the read tool. Capture the
   rendered result; two screenshots taken more than 500 ms apart were byte-identical
   on each side. Stop the recording.

Observed base: `(empty response)` followed by `Answer`.
Observed head: `Answer`, with no empty assistant response. The read tool remains.

The startup gate lets the browser and recording become ready before the stream;
its waiting duration is not part of the reproduced adapter timing. The 120 ms
empty-block interval is identical on both commits and exceeds STREAM_FLUSH_MS=50.
The tool result is synthetic and added to complete the visible tool lifecycle.
