Repository navigation
test(webui): the native acceptance waits for the shell before it types the command - #35
Merged
Merged
Conversation
…s the command The native-terminal acceptance writes its command into a terminal as soon as the terminal exists, and then waits five seconds for the command's echo. On the Windows runner the shell behind the terminal is not ready at that point: PowerShell needed about four seconds before it printed its first prompt, and about five before it rendered the line that had been typed into it. Bytes written before the shell is reading wait in the pty's input buffer, so the five seconds the assertion has are spent on the shell's start-up instead of on the echo, and the assertion fails on a command that was never wrong. The failing run's trace carries the timeline: the write at T0, the prompt at T0+3957ms, the echoed line at T0+4983ms, and the timeout at T0+4991ms. At the moment the wait gave up the buffer held the echoed command and no output line, so the command had not been executed yet. The case now waits for the shell before it types anything. Two signals, in order: whether the shell has printed anything at all (no prompt text, so the same wait works for PowerShell and for sh), and then a probe the shell executes. The probe is what decides, because "the shell has started" is not yet "the shell is reading" -- the prompt arrived about a second before PowerShell began reading. The probe's marker is split the way the command's own marker is split, so the shell's echo of the probe cannot pass for an answer; only its execution can. Nothing is loosened. The assertion is unchanged and still gets the same five seconds for the echo; the new budget is a precondition on the write, spent on the shell's start-up. No retry was added, no case was skipped, and the expected string did not change. A wait that runs out says what it was waiting for and shows the output the terminal did produce. The failure this fixes is recorded in #33.
modacker
force-pushed
the
fix/webui-native-shell-readiness
branch
from
November 11, 2026 09:07
3e4feb7 to
941b4b8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
The native-terminal acceptance types its command into a terminal as soon as the terminal exists, and then waits five seconds for the command's echo. On the Windows runner the shell behind the terminal is not ready at that point: PowerShell needed about four seconds before it printed its first prompt, and about five before it rendered the line that had been typed into it. Bytes written before the shell is reading wait in the pty's input buffer, so the five seconds the assertion has are spent on the shell's start-up rather than on the echo, and the assertion fails on a command that was never wrong.
The failing run's trace carries the timeline: the write at T0, the prompt at T0+3957ms, the echoed line at T0+4983ms, and the timeout at T0+4991ms. When the wait gave up, the buffer held the echoed command and no output line -- the command had not been executed yet. This is the failure recorded in #33.
The case now waits for the shell before it types anything, with two signals in order: whether the shell has printed anything at all (no prompt text, so the same wait works for PowerShell and for sh), and then a probe the shell executes. The probe is what decides, because "the shell has started" is not yet "the shell is reading" -- the prompt arrived about a second before PowerShell began reading. The probe's marker is split the way the command's own marker is split, so the shell's echo of the probe cannot pass for an answer; only its execution can.
Nothing is loosened. The assertion is unchanged and still gets the same five seconds for the echo; the new budget is a precondition on the write, spent on the shell's start-up. No retry was added, no case was skipped, and the expected string did not change. A wait that runs out says what it was waiting for and shows the output the terminal did produce.
Validation
node --check packages/webui/test/browser/native-runtime.spec.mjs: pass.packages/webui/test/integration/agent-transcript.test.ts, while this branch's own case passed in that same run's Playwright stage (native-runtime.spec.mjs:201V04/V06, 5.6s). That Vitest flake is tracked in [Bug]: the agent-transcript case fails on the Windows runner and the failure leaves no evidence behind #32, and this revision is rebased ontomainso the run carries the panel-state diagnostic merged in test(webui): the agent transcript names the browser panel's state when no frame arrives #34.perf:fulllabel: the change is outside the paths the performance rules inCONTRIBUTING.mdlist, and it is not a performance optimization.Publication and contribution checks
release/public-source.json; new tests are declared intest/vitest-suites.jsonwhere applicable. -- no source file was added or removed, sorelease/public-source.jsonis unchanged; no vitest file was added, so no suite declaration is needed.Maintainer handoff
Publication scope or license changes (if any): none.
Shared-source port: not needed. The change is inside
packages/webui, which does not exist upstream; perpackages/webui/docs/agents/issue-tracker.mdnothing in this repository is published to upstream.