Skip to content

Wait for the turn to end after a reply's final text in the E2E tests - #2297

Merged
fazxes merged 3 commits into
mainfrom
wait-for-turn-end-after-final-text
Nov 25, 2026
Merged

fazxes merged 3 commits into
mainfrom
wait-for-turn-end-after-final-text

Conversation

@fazxes

@fazxes fazxes commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

#2252 made a reply's last words show before its turn ends. Tests that waited only for that text, then read turn-end rows, quit, resumed, pressed a key, or sent the next prompt, now race the turn's end. Linux CI usually wins the race. The macOS arm64 PGSO training build is slower and lost it every time in tui-tool-story:

  • "a refused shell request the turn ended on says why" read └ Couldn't run ls, printf before · 2 invalid fields showed (the pane still said Generating).
  • "a shell session's row names the programs of a launch command…" killed fx before the turn was saved, so the resume retried a gateway with no replies left.

Each wait like that now also waits for turnSettled, the form d19fe17 used: 74 waits in 18 files in the PGSO corpus. Waits followed by nothing that depends on the turn's end are unchanged.

REFUSED_LAST holds its stream end 1 s after the text, so the refused-row check fails again if runStory stops waiting for the turn's end. A held-stream copy of a sessions.test.ts test also failed without its fix (turn_interrupted reasons ["cancel","cancel"]) and passed with it.

Each changed file passes on its own in the sandbox.

A reply's last words now show before its turn ends (#2252). Tests that
waited only for that text and then read turn-end rows, quit, resumed,
pressed a key, or sent the next prompt raced the turn's end. The slower
macOS release build loses that race: tui-tool-story read the refused
row before its reason showed, and killed fx before the turn was saved.

Each such wait now also waits for turnSettled, as d19fe17 did for
five waits. The refused-request story holds its stream end for a second
after the text, so its row check fails again if runStory stops waiting
for the turn's end.
@fazxes fazxes added the type: maintenance Changes internal tooling, dependencies, CI, or implementation structure label Nov 25, 2026
The first sweep covered waitForText only. Tests that found a reply's
final text with a scrollback helper, such as waitForScrollback or
scrollbackContains, and then read saved state, quit, sent the next
prompt, or pressed a key raced the turn's end the same way. On macOS,
tui-full-transcript-brutal read the saved log before the live reply was
committed and found it missing.

Each such wait is now followed by a wait for turnSettled, as sessions
already did after one scrollbackContains. The brutal stress test waits
for the reply in the saved log instead, since the Ctrl-O viewer can
cover the pane's status row.
@fazxes
fazxes merged commit 3bde76f into main Nov 25, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: maintenance Changes internal tooling, dependencies, CI, or implementation structure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant