Repository navigation
Stop console-pty tests from hanging in CI: run the sight-pty helper tests in their own process, away from a Bun 1.3 double close - #380
Conversation
…ble close can't hang console-pty On Bun 1.3.x, a child spawned with an extra stdio pipe (fd 3, sight-pty's control channel) has that pipe's fd closed when the child exits and again when the stream is garbage-collected. The second close hits whatever has reused the number. In CI's single test process that was usually console-pty.test.ts's Bun.Terminal, which went blank until the 5 s timeout, or an epoll fd (EBADF in `await proc.exited`). Bun 1.4.0 fixed it. CI now runs helper-pty.test.ts in a separate `bun test` step.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…e pinned Bun release-build.yml ran bun test ./tests in one process, which on Bun 1.3.13 can hang or throw EBADF unless helper-pty.test.ts runs on its own (#380). Both workflows now run bun run test:ci, a package.json script that does that split, and a test checks they still match. Co-authored-by: Claude Opus 5.5 <[email protected]>
…e pinned Bun release-build.yml ran bun test ./tests in one process, which on Bun 1.3.13 can hang or throw EBADF unless helper-pty.test.ts runs on its own (#380). Both workflows now run bun run test:ci, a package.json script that does that split, and a test checks they still match. Co-authored-by: Claude Opus 5.5 <[email protected]>
…e build's tests the way CI does (#420) * Send only the cursor's statement under #delimit ;, not a neighbour on its first or last line With display on one line and 1; clear; on the next, Send Statement on display also ran clear;, and the same held for }; clear; after a block and for code before a statement on its first line. The detector now reads each ; statement's character range and sends the statements that start on the cursor's line (or the one through it), cutting the lines they share. When the last line holds the next statement, the cursor stays there. Send Upward and Downward Lines end and start at the same cuts. Co-authored-by: Claude Opus 5.5 <[email protected]> * Run the release build's tests the way CI does, so it can't hang on the pinned Bun release-build.yml ran bun test ./tests in one process, which on Bun 1.3.13 can hang or throw EBADF unless helper-pty.test.ts runs on its own (#380). Both workflows now run bun run test:ci, a package.json script that does that split, and a test checks they still match. Co-authored-by: Claude Opus 5.5 <[email protected]> * Read a document for sending once per edit, not on every send Each send lexed and parsed the whole document, which took about 130 ms on a 50,000-line file even to send a selection. The reading is now kept per document until its version changes. Co-authored-by: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
console-pty.test.tskept failing CI at random. Usually the first test hit the 5 s timeout with a blank screen; onceawait proc.exitedthrewEBADFinstead. Reruns passed. The tests weren't slow: in 105 recent CI jobs the first test took 559–669 ms whenever it passed, and every failure stopped at exactly 5,000 ms.The cause is a Bun 1.3.x bug. When a child is spawned with an extra stdio pipe (fd 3, the
sight-ptycontrol channel), Bun closes that pipe's fd when the child exits, then closes the same number again when the stream is garbage-collected. The second close hits whatever has reused the number.helper-pty.test.tsruns just beforeconsole-pty.test.tsin CI's single test process, so the victim was usually console-pty's terminal, and once an epoll fd (theEBADF). Closing the streams explicitly in the tests doesn't prevent it. Bun 1.4.0 fixed it. CI pins 1.3.13.So CI now runs
helper-pty.test.tsin its ownbun teststep, and the main run skips it with--path-ignore-patterns. Comments inci.ymland the test file record the bug. No timeouts changed, and nothing catchesEBADF.How I found it, in a Linux container with Bun 1.3.13:
sight-pty helpertests run first in the same process: 11/60 together, 0/40 alone. No single helper test reproduces it, because the late closes build up across the group.Proof: in that container, the two-file command that failed 5/45 without the change failed 0/60 with it, with no
EBADF. Line endings, typecheck, lint andactionlintpass.Follow-up, not in this PR: run alone,
helper-pty.test.tscan still trip itself (2/50 in the container, none in 78 CI logs). Moving CI and release builds to Bun 1.4 or later would fix the bug itself.Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved.
Created with Claude Opus 5.5 in Claude Code (T3 Code); reviewed by gpt-6.1-sol in Codex.
Summary by CodeRabbit