test(senpi-task): prove the auto-deny reaches the host before the next command
Summary
Replaces the wall-clock assertion in the HostSessionClient confirm auto-deny test, which went red on a loaded Windows runner (run 36309221289, 55.2 ms > 50 ms) while the deny frame was correct.
Root cause
A test flake, not a product bug. session-client.ts dispatches the deny (void sendExtensionUIResponse(...)) synchronously on ingest, with no timer on the path. The test measured socket round-trip latency against a fixed 50 ms budget.
Fix
The test now asserts the contract the product guarantees. The host sends the UI request followed by an agent_end record on the same stream, and the test awaits the client forwarding that event, which proves the request was already ingested. Then it issues getState(). The host's command log must show extension_ui_response before get_state, with the deny payload confirmed: false. No sleeps, no timing budget.
QA & Evidence
bun test packages/senpi-task/src/runners/rpc-host/session-client-records.test.ts: 8 pass.--rerun-each 50: 400 pass, 0 fail.tsgo -p packages/senpi-taskand biome are clean.- Mutation: making the product's deny wait 8 s before sending turns the new test red in 4 ms (
get_statearrives first). The previous version of this change still passed under the same mutation, which is why the ordering assertion replaced it. - Test-only change; product code is unchanged, so no live Senpi driver run applies.
- Windows focused soaks (3 x 10 iterations) are listed in a comment.
Summary by cubic
Replaces the flaky confirm auto-deny test in HostSessionClient records, which timed out at 50 ms on a loaded Windows runner (55.2 ms) even though the deny payload was correct. The new test proves the deny reaches the host before the client's next command, instead of measuring socket latency.
- Awaits the client forwarding the
agent_endrecord (confirming the UI request was already ingested), then assertsextension_ui_responseappears beforeget_statein the host's command log. - Test-only change; verified with
--rerun-each 50(400/400 pass) and a mutation delaying the deny by 8 s, which the new test catches in 4 ms.
Fixes #8950