Skip to content

test(pty): wait for the line editor instead of a fixed 600 ms (closes #58) - #61

Merged
ShortArrow merged 1 commit into
mainfrom
test/pty-wait-for-editor
Oct 12, 2026
Merged

ShortArrow merged 1 commit into
mainfrom
test/pty-wait-for-editor

Conversation

@ShortArrow

@ShortArrow ShortArrow commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Closes #58.

Why the bootstrap waits for a signal instead of a fixed time

PtySession::spawn used to drain the shell's output for a fixed 600 ms before sending the first bootstrap line. pwsh's PSReadLine starts reading keys only after it has sent its cursor-position query, about 300 ms after launch on an idle machine. On a slow macOS runner it started after the 600 ms had passed, so the first line was rendered but never run, and the step timed out after 5 s. With the failure output from #60, the CI failure showed exactly that: the whole line drawn, then no newline.

The harness now waits until each shell's line editor reads keys. pwsh sends two cursor-position queries, nu's reedline sends one, and bash and zsh send none and print a prompt. Each editor blocks until its query is answered, so the queries arrive one at a time and can be counted. After the signal the shell must print nothing for 100 ms. A shell that is not ready within 5 s fails at the startup step.

How it was checked

With 96 busy processes on a 32-core WSL machine, the pwsh PTY tests failed 30 of 30 runs with the fixed wait, every time at the same step as on macOS CI, and 0 of 30 runs with this change. Under the same load the bash, zsh, nu and pwsh tests each passed 10 of 10 runs.

@ShortArrow
ShortArrow force-pushed the test/pty-wait-for-editor branch from 7a9d4fc to 5224be7 Compare October 11, 2026 23:43
@ShortArrow
ShortArrow changed the base branch from test/pty-bootstrap-error to main October 11, 2026 23:43
…58)

pwsh's PSReadLine could start after the window ended, so the first bootstrap line was rendered but never run; under CPU load the old wait failed 30 of 30 runs and this one 0 of 30.
@ShortArrow
ShortArrow force-pushed the test/pty-wait-for-editor branch from 5224be7 to c62e140 Compare October 11, 2026 23:43
@ShortArrow
ShortArrow marked this pull request as ready for review October 11, 2026 23:45
@ShortArrow
ShortArrow merged commit 0d22250 into main Oct 12, 2026
7 checks passed
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.

test(pty): pwsh PTY tests sometimes fail to bootstrap on macOS CI

1 participant