Skip to content

test(terminal): page through scrollback only after the command's output has printed - #831

Merged
sambitcreate merged 1 commit into
mainfrom
fix/terminal-scrollback-test-race
Nov 18, 2026
Merged

sambitcreate merged 1 commit into
mainfrom
fix/terminal-scrollback-test-race

Conversation

@sambitcreate

@sambitcreate sambitcreate commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Fixes the flaky E2E `tests/e2e/workspace-panel.spec.ts:409` ("scrollback keys move through history without reaching the shell"), which failed with `--fail-on-flaky-tests` on unrelated PRs (for example #802, job 134369661796).

Cause

The test waited for `/\b300\b/` before pressing Shift+PageUp. The typed command line `seq 1 300` is echoed as it is typed, so the wait could pass before `seq` had printed anything. Shift+PageUp then arrived while there was no scrollback to page through, the 300 lines landed afterwards, and the view stayed at the bottom (the failure shows `292…300` and the prompt). It is the same race #774 fixed in the selection-action test.

Fix

The test now runs `M=lines; seq 1 300; echo "$M-done"; sleep 60` and waits for `lines-done`, a line only the command's output prints. The `sleep` stops the prompt from printing after it. There are no added retries or timeouts, and the app's code is unchanged.

Verification (Cua Space, `--repeat-each=20 --retries=0`)

  • On main before the fix, with 4 workers: 17 of 20 failed, all at `:415` `not.toContainText(/\b300\b/)`, matching CI.
  • With the fix, with 4 workers: 20 of 20 passed.
  • With the fix, with 1 worker: 20 of 20 passed.

…ut has printed

The wait matched "300", which is already on screen as the typed command line echoes, so Shift+PageUp could arrive before any scrollback existed and the view stayed at the bottom. Wait for a marker only the command's output prints, and keep sleep in the foreground so no prompt follows it.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes I reviewed the terminal scrollback E2E synchronization fix in 89b1bf0c9.

  • Output-only synchronization — The test now waits for lines-done, which cannot be matched by the literal echoed command, before sending scrollback shortcuts.
  • Stable terminal state — The foreground sleep prevents a subsequent prompt from changing the viewport during assertions and matches the established adjacent terminal-selection test pattern.
  • Verification — npm run type-check:e2e passes, and the change does not alter production code or external contracts.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

@sambitcreate
sambitcreate merged commit bc49b19 into main Nov 18, 2026
28 checks passed
@sambitcreate
sambitcreate deleted the fix/terminal-scrollback-test-race branch November 18, 2026 04:54
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.

1 participant