# Merge-watch wake evidence

Place `race-hook.mjs` in the checkout root and `merge-wake-before-settlement.e2e.ts`
in `scripts/scenarios/` of current main. Install with `vp i`, then run:

```sh
T3CODE_DEV_SEED=0 \
T3_SCENARIO_INHERIT_ENV='NODE_OPTIONS,PROOF_RACE_PORT,T3CODE_DEV_SEED' \
NODE_OPTIONS="--import=$(pwd)/race-hook.mjs" \
PROOF_RACE_PORT=18994 \
vp run scenarios:prove scripts/scenarios/merge-wake-before-settlement.e2e.ts \
  --base f39ecd3df8f01171c190350fe93e1a9cfb3a017d \
  --head 24803182f3ab543a5e9551126343d739351fd11d \
  --upload-command 'ghdrop upload'
```

This runs real servers and the real web client on fresh isolated homes. Project and
thread creation use the app CLI. The replay agent is free and speaks the real ACP
adapter protocol. Identical in-memory Node load hooks on both revisions:

- Make each replay prompt last at least three seconds.
- Expose a localhost-only fixture endpoint that enables Settle on merge and dispatches
  synthetic open-PR/watch/merge updates through the running server's orchestrator.
- Delay the terminal run reaction by four seconds, before it acquires a thread lock,
  allowing normal automatic settlement to race completion-driven queue promotion.

The settlement service's decisions and the orchestrator's settlement/queue behavior
are not replaced. No database rows are injected and no real pull request is merged.
The scenario checks that the watch wake really queued, records the same interaction,
and asserts only that this wake completed. Base cancels it; head executes it and
settles afterward. Recordings show the actual UI transitions. The replay agent does
not semantically interpret the notification; its next recorded reply proves delivery.

This reproduction does not exercise the separate two-minute expiration boundary or
measure how often the race occurs without the controlled four-second delay.
