Skip to content

test(tui): run the frame loop in the update-restart epilogue tests - #58271

Open
Hona wants to merge 1 commit into
anomalyco:devfrom
Hona:tui-update-tests
Open

Hona wants to merge 1 commit into
anomalyco:devfrom
Hona:tui-update-tests

Conversation

@Hona

@Hona Hona commented Oct 23, 2026

Copy link
Copy Markdown
Member

The two update-restart epilogue tests from #58139 (restarting after an update…, quitting after a background update…) failed on both unit (linux) runs of #58262.

error: Timed out waiting for frame predicate after 20 passes
frameId: 2
isRunning: false
hasScheduledRender: false
lastFrame: (blank)
  • Cause: the tests never started the renderer's frame loop. In that state, waitForFrame stops at the first pass with no render scheduled (@opentui/core testing.bun.js, waitForFrame). That happens on a busy runner while the home route is still loading, before commands is drawn.
  • Fix: start the frame loop and wait for terminalHandoff's complete, the same as the selection-copy test in app-lifecycle.test.tsx.
const setup = await createTestRenderer({ width: 80, height: 24 })
await setup.renderer.setupTerminal()
setup.renderer.start()
const ready = Promise.withResolvers<void>()
// ...
terminalHandoff: async () => ({ renderer: setup.renderer, mode: "dark", complete: ready.resolve }),
// ...
await ready.promise
await setup.waitForFrame((frame) => frame.includes("commands"))

Copilot AI balanced review requested due to automatic review settings October 23, 2026 00:11

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@opencode-agent opencode-agent 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.

The fix looks sound. I couldn't reproduce the CI flake here: both tests pass on the base and with this change, including when I saturated the CPU. The cause you describe does match @opentui/core's waitForFrame, which stops at the first pass when the frame loop isn't running and no render is scheduled. Starting the frame loop and waiting on the handoff complete signal removes that path. complete fires on the first frame, and the selection-copy test already uses the same pattern. The full app-lifecycle.test.tsx passes (41/0) and tsc -b is clean.

Public API: unchanged (test-only).

No concerns.

This branch has not been deployed

No deployments
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.

2 participants