Flaky: test_approval_prompt_accept echoes input before the prompt finishes on macOS
integration_tests::approval_pty::test_approval_prompt_accept failed on macOS in this run on PR #4856, whose diff touches only alias --help routing. The same job passed on the PR's previous head, and the last five ci runs on main passed.
The snapshot diff shows the typed y echoed before the prompt's trailing space:
-❯ Allow and remember? [y/N] y
-◎ Running pre-start project hook @ _REPO_.test-approve
+❯ Allow and remember? [y/N]y
+ ◎ Running pre-start project hook @ _REPO_.test-approve
The likely cause is the wait marker. exec_wt_in_pty_cwd sends input once the output contains [y/N, but the prompt keeps writing after that: ], the style resets, then a space. If the input arrives inside that gap, the PTY echoes y ahead of the space. A marker covering the whole prompt, up to and including its trailing space, would close the gap. The other tests in that file use the same helper, so they share the race.
Fix is open in #4860; CI is green on all three platforms, including codecov/patch. It needs a maintainer's review before it can merge.
The cause is on the writing side, not the wait marker. The approval prompt went out as two write(2) calls, the styled … [y/N] and then a lone " ", because of eprint!("{} ", msg). The test helper's 20 ms quiescence drain only shrinks the gap between them, so a stalled macOS runner can still send y inside it. #4860 writes the whole prompt in one call, and strace now shows a single write that ends in the space. That closes the gap for every test using the helper, with no change to the marker. The shell-install Proceed? [y/N] prompt had the same split and gets the same fix.