Skip to content

fix(test): wait for the second interrupt instead of sleeping - #40

Merged
devswha merged 1 commit into
mainfrom
fix/e2e-interrupt-wait
Aug 13, 2026
Merged

fix(test): wait for the second interrupt instead of sleeping#40
devswha merged 1 commit into
mainfrom
fix/e2e-interrupt-wait

Conversation

@devswha

@devswha devswha commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Problem

real tmux interrupt cancels a running verified fake-agent turn and repeats on the same generation slept a fixed 100ms after sending the second interrupt, then asserted that exactly two interrupts had been recorded.

That is a timing race, and it fired for real: PR #37 failed on Node 24 while Node 22 passed on the same commit, and a plain rerun went green. The change under test was unrelated to interrupt handling.

✖ real tmux interrupt … (126ms)
  AssertionError: same-generation interrupts are intentional repeatable user gestures
  1 !== 2

Fix

waitForInterrupt takes an expected count and polls to the harness deadline, so the test waits on the exact event it asserts instead of guessing how long tmux needs.

The assert.equal(..., 2) stays, so an extra interrupt is still a failure — the wait only removes the "too early" failure mode.

Note

The delay(1_100) above it is left alone on purpose: it backs a negative assertion (no turn_completed may appear), and there is no event to wait for when asserting absence.

Verification

File run three times consecutively, 10/10 passing each time.

The repeated-interrupt assertion slept 100ms and then required exactly two
recorded interrupts, so a slower runner failed it: PR #37 went red on Node 24
while Node 22 passed on the same commit, and a rerun went green.

waitForInterrupt now takes an expected count and polls to the harness deadline,
so the test waits on the event it asserts. The equality check still pins
exactly two, so an extra interrupt remains a failure.

Verified by running the file three times in a row after the change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@devswha
devswha merged commit 3bb0e28 into main Aug 13, 2026
2 checks passed
@devswha
devswha deleted the fix/e2e-interrupt-wait branch August 13, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant