Skip to content

fix(terminal): preserve synchronized output during settled reveal - #32217

Closed
abruption wants to merge 1 commit into
stablyai:mainfrom
abruption:fix/terminal-reveal-synchronized-output
Closed

abruption wants to merge 1 commit into
stablyai:mainfrom
abruption:fix/terminal-reveal-synchronized-output

Conversation

@abruption

Copy link
Copy Markdown
Contributor

ELI5

Switching to a terminal should not briefly erase its contents while the running app is still drawing its next screen. Keep the last complete frame visible until that update is ready.

What Changed

The settled reveal callback still clears shared WebGL texture atlases, but now presents visible panes through the existing synchronized-output-aware path. Previously it forced the current buffer onto the screen, even inside a DEC 2026 synchronized update. If that buffer had been cleared but not yet repainted, the user briefly saw an empty terminal.

The registry retains its two-pass ordering (clear every eligible atlas, then present), visible-pane filtering, and disposal isolation. Other callers retain the existing forced recovery behavior. Legacy managers without a separate atlas-clear method use an ordinary refresh for this mode instead of a combined reset that would force a paint.

Why

Removing atlas invalidation could bring back stale glyphs after reveal; changing the general forced-present primitive could weaken explicit recovery. This change only makes ordinary settled reveal respect an update already in progress.

A controlled reproduction exercises the actual Orca PaneManager and renderer. It establishes this defect path, but does not prove that every flash in the original recording had the same cause: the original terminal byte stream was not retained.

Linked Issue

Fixes #32198

Visual Proof

Actual isolated Orca Electron development build, captured with Playwright CDP on macOS, WebGL enabled. Both images show the same point: the app has parsed a clear-screen inside an unfinished synchronized update and the production settled-reveal callback has run. Synthetic text only; no private user recording is uploaded.

Before — current main exposes the cleared intermediate frame:

Before: the terminal's text disappears during the unfinished update

After — the previous complete frame stays visible until the update ends:

After: COHERENT_FRAME text remains visible during the same unfinished update

Testing

  • I manually tested these changes locally — inspected CDP captures from the isolated development build; no foreground interaction with a user session.
  • Automated tests added/updated.
  • Actual Electron E2E: DOM and required WebGL, 2/2 PASS. Both assert that a partial frame was parsed and the production atlas-clear callback ran while synchronized output was held; the screen stays unchanged and updates after release.
  • Negative control: rebuilt unmodified 22a95c4efe with the same E2E tests; 2/2 fail at the pixel preservation assertion. The WebGL changed-pixel ratio was approximately 8.18%.
  • Focused renderer/recovery regression tests: 7 files, 101 tests PASS.
  • tc:web, Electron E2E build, changed-code quality, formatting, and git diff --check: PASS.
  • Whole E2E typecheck remains failing: baseline 252 diagnostics, candidate 251, with no new diagnostic locations. Unrelated missing cloud workspace dependencies and existing test typing errors prevent a clean whole-suite result; this is not reported as a passing typecheck.
  • Tested macOS ARM64, Electron 43.7.8. Windows/Linux, mobile, and a live two-machine paired/SSH session were not run for this patch. The reproduction uses a controlled TUI update, not a live Codex/Claude/Antigravity request.

Reproduce rendered coverage with ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test --config tests/playwright.config.ts tests/e2e/terminal-reveal-synchronized-output.spec.ts --project electron-headless --workers 1.

AI Disclosure

Codex assisted with source analysis, implementation, tests, and the issue/PR text. Human-provided observations and the private recording informed the investigation; all public screenshots use synthetic test content.

Review

Self-review and a separate agent design review checked preservation of forced recovery, shared-atlas ordering, and visibility filtering. No new platform-specific APIs, PTY input behavior, credentials, wire fields, or transport changes are introduced. Local, paired, and SSH terminal views use the shared renderer path; mixed client/server versions need no protocol negotiation. The behavior is agent-neutral and keeps the existing synchronized-output release/timeout machinery. There is no extra timer or polling loop. Git providers and integrations are unaffected. The main remaining validation limit is live remote and cross-platform coverage.

Agent skill upstream boundary

  • Not applicable: no upstream skill-installer material is copied or translated.

Notes

Only ordinary settled reveal opts in; explicit recovery paths continue to force presentation as before. Full repository lint/test/typecheck and cross-platform CI are not claimed as passing.

Author

X (Twitter): @abruptWave

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Full repository lint, typecheck, test, and build pass — scoped results and the E2E typecheck limitation are listed above; broader CI remains pending

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 91397af9-7da7-4597-98f0-942308962e8c
📥 Commits

Reviewing files that changed from the base of the PR and between 22a95c4 and 9c9a78f.

📒 Files selected for processing: 9
  • src/renderer/src/lib/pane-manager/pane-manager-registry.test.ts
  • src/renderer/src/lib/pane-manager/pane-manager-registry.ts
  • src/renderer/src/lib/pane-manager/pane-manager.ts
  • src/renderer/src/lib/pane-manager/pane-rendering-control.ts
  • src/renderer/src/lib/pane-manager/pane-reveal-repaint.test.ts
  • src/renderer/src/lib/pane-manager/pane-reveal-repaint.ts
  • tests/e2e/fixtures/terminal-reveal-synchronized-output-probe.ts
  • tests/e2e/helpers/runtime-types.ts
  • tests/e2e/terminal-reveal-synchronized-output.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

Settled terminal reveal recovery now supports clearing WebGL texture atlases while preserving synchronized output. Managers use synchronized-output-preserving viewport presentation when available; legacy managers use ordinary refresh. Existing recovery behavior remains when preservation is not requested. Unit tests cover manager selection and presentation order. New end-to-end tests exercise synchronized terminal reveal with GPU acceleration enabled and disabled.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 9c9a7

The settled reveal path preserves the last complete terminal frame during an unfinished synchronized update. No actionable merge blocker remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title is concise, specific, and accurately describes the main change: preserving synchronized terminal output during settled reveal.
Description check Passed The description includes all required sections, explains the user-visible behavior and implementation, links issue #32198, provides visual proof, documents testing and known limitations, and completes…
Linked Issues check Passed Issue #32198 requires terminal content to remain visible during the affected reveal and update sequence. The PR applies the settled-reveal path only to synchronized-output-preserving presentation. The…
Out of Scope Changes check Passed The changes stay within issue #32198. The registry option, PaneManager and rendering-control adapters, reveal callback change, focused regression tests, and Electron E2E probe all support synchronized…
Full details: Description check

Explanation

The description includes all required sections, explains the user-visible behavior and implementation, links issue #32198, provides visual proof, documents testing and known limitations, and completes the relevant checklist items.

Full details: Linked Issues check

Explanation

Issue #32198 requires terminal content to remain visible during the affected reveal and update sequence. The PR applies the settled-reveal path only to synchronized-output-preserving presentation. The registry clears eligible visible atlases in a first pass, then presents them without forced recovery. Legacy managers use ordinary refresh. Tests cover ordering, visibility, disposal isolation, legacy fallback, and synchronized-output preservation. The Electron E2E test reports that the prior frame remains visible while output is held and updates after release.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #32198. The registry option, PaneManager and rendering-control adapters, reveal callback change, focused regression tests, and Electron E2E probe all support synchronized-output-safe terminal reveal. No unrelated product area or protocol behavior changes are identified.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copy link
Copy Markdown
Contributor

Thank you @abruption for the excellent report on #32198 and for this PR. Your diagnosis was exactly right: the settled reveal's atlas reset forced the current buffer onto the screen during a DEC 2026 synchronized update, which exposed Codex's half-built frame. We merged #32281, which builds on your approach of moving that reveal onto the sync-aware present. It also applies the same fix to the other recovery paths that forced a paint (resume, render-desync, image paste, screen-scale repair) and to the structural-replay unhide, so no reveal or recovery can publish an unfinished frame. Your commit-author credit is kept through a Co-authored-by trailer, and your CDP before/after captures are linked as the visual proof. Closing this in favour of #32281. Thanks again for the careful investigation.

@nwparker nwparker closed this Oct 23, 2026
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]: Paired remote Codex terminal briefly blanks repeatedly after switching sessions (macOS)

2 participants