Skip to content

fix(terminal): break the ConPTY foreground livelock that froze a repainting TUI - #12463

Merged
OrcaWin merged 1 commit into
mainfrom
fix/terminal-conpty-foreground-livelock
Aug 8, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
fix/terminal-conpty-foreground-livelock

Conversation

@nwparker

@nwparker nwparker commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

holdForeground and coalesceForeground each cancelled the other's fallback timer on the Windows ConPTY DEC 2026 (synchronized output) path. A continuously repainting TUI such as Codex therefore left the foreground latch stuck open, so every later chunk was held instead of coalesced and output never reached the visible pane until the tab was refreshed.

Fix

Break the mutual cancellation and mirror the hidden path's scan on the foreground path, carrying a marker tail so a ConPTY-split DEC 2026 marker is still detected. Nothing was wrong with Flutter — it was simply a long-running command behind a repainting TUI.

Verification

  • pnpm typecheck clean on this branch
  • This branch's own tests pass; the new cases fail before the change and pass after
  • Split out of the original combined branch; the union of all 12 split branches was diffed back against it to prove nothing was lost

Fixes #8754

Made with Orca 🐋

…inting TUI

`holdForeground` and `coalesceForeground` each cancelled the other's fallback timer on the Windows ConPTY DEC 2026 (synchronized output) path. A continuously repainting TUI such as Codex therefore left the foreground latch stuck open, so every later chunk was held instead of coalesced and output never reached the visible pane until the tab was refreshed.

Break the mutual cancellation and mirror the hidden path's scan on the foreground path, carrying a marker tail so a ConPTY-split DEC 2026 marker is still detected. Nothing was wrong with Flutter — it was simply a long-running command behind a repainting TUI.

Fixes #8754

Co-authored-by: Orca <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@nwparker, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c4bc638e-cd79-4f0a-9d05-ee7ee44b1d54

📥 Commits

Reviewing files that changed from the base of the PR and between c498d2d and fe1a068.

📒 Files selected for processing (4)
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.test.ts
  • src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker

nwparker commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Proof status — not visually proven, and here is exactly why

No recording for this one, and I would rather say so than attach something that does not actually exercise the bug.

The livelock lives on a path that is gated to native Windows ConPTY with DEC 2026 (synchronized output) — shouldProtectNativeWindowsSynchronizedOutput. On macOS and Linux that branch is off, so any spec I record locally would pass identically with and without the fix: it would prove nothing. That is why this PR has no e2e proof spec while the other macOS-provable fixes in this bug bash do.

Reproducing it faithfully needs a Windows host running a TUI that repaints continuously through DEC 2026 (Codex, as in the original report), plus a long-running command behind it. That means a full Orca build on the Windows box — which I have not done.

What does back the fix today:

  • Unit tests in pane-terminal-output-scheduler.test.ts and pty-connection.test.ts that fail before the change and pass after, covering both the mutual timer cancellation and the ConPTY-split DEC 2026 marker tail.
  • The mechanism is a plain livelock: holdForeground and coalesceForeground each cancelled the other's fallback timer, so a continuously repainting TUI left the latch stuck open and every later chunk was held rather than coalesced.

Warning

Do not read this PR as visually verified. If you want it demonstrated before merge, the path is: build Orca on awin, run Codex in a terminal pane, run a long build behind it, and record the pane staying frozen on main versus streaming on this branch. I can do that on request.

@OrcaWin
OrcaWin merged commit d64ccc7 into main Aug 8, 2026
43 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…inting TUI (stablyai#12463)

`holdForeground` and `coalesceForeground` each cancelled the other's fallback timer on the Windows ConPTY DEC 2026 (synchronized output) path. A continuously repainting TUI such as Codex therefore left the foreground latch stuck open, so every later chunk was held instead of coalesced and output never reached the visible pane until the tab was refreshed.

Break the mutual cancellation and mirror the hidden path's scan on the foreground path, carrying a marker tail so a ConPTY-split DEC 2026 marker is still detected. Nothing was wrong with Flutter — it was simply a long-running command behind a repainting TUI.

Fixes stablyai#8754

Co-authored-by: Orca <[email protected]>
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.

[Bug]: Orca don't render flutter command in Codex session without refreshing the tab

2 participants