Skip to content

fix(terminal): never present a half-built synchronized-output frame on reveal or recovery - #32281

Merged
nwparker merged 1 commit into
mainfrom
nwparker/sync-output-forced-present
Oct 23, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/sync-output-forced-present

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​273 $\color{#cf222e}{\Huge{\mathbf{−}}}$​97 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​176
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​70 $\color{#cf222e}{\Huge{\mathbf{−}}}$​54 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16

ELI5

Agent CLIs like Codex draw each new screen in two steps: they first erase parts of it, then paint the new content. They also tell the terminal "hold on, I'm mid-drawing" while they do it. When you switched to a terminal, Orca sometimes ignored that signal and pushed whatever was in the buffer onto the screen. If Codex was mid-drawing, you saw a blank pane for a frame. Now Orca keeps the last complete picture on screen until the drawing is finished, and it never waits longer than about one second.

What Changed

Before: after switching to a session (seen most on a paired remote Codex terminal on macOS), the terminal content blinked blank several times for about 13–27 ms while the surrounding app stayed put.

After: the previous complete frame stays visible until Codex finishes its redraw, then the new frame appears.

Mechanism. Codex wraps nearly every redraw in DEC 2026 synchronized output (a captured Codex 0.158 turn has 345 held blocks), and some blocks erase rows before repainting them. Orca had two viewport-present modes:

  • a mode that respected the hold;
  • a forced mode (forceFullViewportPresent) that called the WebGL renderer directly and painted the half-built frame.

The forced mode was used by the settled reveal's atlas reset (the settled-reveal trace in the report) and by every other atlas recovery that goes through PaneManager.presentForcedViewports / resetAndRefreshAllTerminalWebglAtlases: visibility-resume-dpr, system-resume, render-desync, and the image-paste burst. It was also used by the direct DPR-repair presents on window wake and by the structural-replay unhide.

  • presentPaneViewport now has a single mode: it always respects DEC 2026. The forced mode and presentPaneViewportPreservingSynchronizedOutput are gone, so no reveal or recovery path can publish a half-built frame again. presentForcedViewports is renamed presentViewports.
  • Structural replay keeps its retained copy of the last frame on screen while a synchronized frame is still open. When it does unhide, it no longer forces a paint.
  • forceFullViewportPresent is now used in only two places, both documented: the Windows keystroke echo inside a held frame, which is deliberate for input latency, and the replay hold cap.

Bounded fallback for a TUI that never closes its frame:

  • Presents go through xterm's RenderService.refreshRows, which buffers the rows and starts xterm's 1000 ms synchronized-output safety timer. When that timer fires, xterm turns sync off and repaints the whole viewport.
  • The replay hold keeps its existing 1 s cap, and the cap still forces a paint.
  • Both limits are tested.

Why

The DEC 2026 contract says a terminal shouldn't show a frame until the app closes it. Respecting it everywhere, with xterm's own timeout as the backstop, removes the whole class of bug rather than one call site. A per-caller option (the approach in #32217) fixes the settled reveal but leaves the other forced callers and the replay unhide able to flash. Removing the atlas reset on reveal would bring back stale glyphs.

The one trade-off: if a canvas is resized mid-frame, it is blank until the frame closes (normally a few milliseconds, at most 1 s), where before it showed a partial frame. The forced paint existed so that a reveal never waited on a held frame. That wait is now capped at 1 s.

This builds on @abruption's diagnosis and PR #32217, which identified the settled reveal's forced present as the cause and moved that reveal onto the sync-aware path. This PR extends the same idea to every forced caller and to replay. Thanks to @abruption for the report and the analysis.

Linked Issue

Fixes #32198

Supersedes #32217.

Visual Proof

N/A for new captures in this PR. The rendered before/after for the settled-reveal path is in @abruption's #32217 (CDP captures from an isolated build). The unit test below drives a real xterm with a real captured Codex frame. On main it fails with the visible screen literally blank (expected ' ' to contain 'COHERENT FRAME'). With this change it passes.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated

  • New pane-viewport-present-synchronized-output.test.ts: real @xterm/xterm (DOM renderer, happy-dom) fed the first erasing synchronized frame from the captured Codex 0.158 transcript (src/main/runtime/__fixtures__/codex-0-158-0-timed-turn.txt). It asserts that the coherent frame stays on screen after a present while the frame is held, that the new frame shows after ?2026l, and that a frame which never closes still paints once xterm's 1 s timeout fires. Both cases fail on main and pass here.

  • terminal-structural-replay-presentation.test.ts: the retained frame stays up while the frame is held, and the hold cap still unhides a frame that never closes. Both fail on main.

  • The @headful e2e in terminal-reveal-paused-render-repro.spec.ts asserted the old behaviour (atlas recovery paints the held frame). It now asserts that the coherent frame is kept while held and the completed frame appears after release. I did not run it locally because it needs a visible window; CI's headful lane covers it.

  • Ran every unit test file that imports a changed module (42 files, 376 tests), plus the lib/pane-manager and components/terminal-pane folders. The full static-analysis job passes locally.

  • Platforms: macOS unit tests only. No live paired or SSH session was run. The change is renderer-only, so local, SSH and paired terminals all use the same path.

AI Disclosure

Review

  • Codex review against the pinned base: clean.
  • Independent Opus review: no P0–P2 findings. Its P3 note, that the replay unhide still forced a paint for an empty capture, was fixed.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Remote and mixed versions: renderer-only. No wire, IPC or protocol change.
  • Cross-platform: no platform branches. The Windows ConPTY keystroke-echo present is unchanged.
  • Mobile: it doesn't use this pane-manager path; its xterm handles DEC 2026 natively.
  • Folder workspaces: unaffected.
  • Performance: removes forced synchronous paints. The replay wait is one rAF per frame while held, capped at 1 s.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…n reveal or recovery

Settled reveal and every other atlas recovery forced the current xterm buffer
onto the screen even while a TUI held DEC 2026 synchronized output. Codex
erases rows inside each held redraw, so a reveal mid-redraw showed a blank
pane for a frame (#32198).

Viewport presents now have one mode: they keep the last coherent canvas and
let xterm present when the TUI closes the frame, bounded by xterm's 1s
synchronized-output safety timeout. Structural replay keeps its retained frame
up until an open synchronized frame closes, bounded by its existing hold cap.

Co-authored-by: YEONGUK LEE <contact@abruption.dev>
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The changes consolidate pane viewport presentation under presentPaneViewport. During synchronized output, presentation retains the last coherent frame. Replay release waits for synchronized output to finish, with a hold-cap path that forces presentation. Reveal, visibility-resume, hidden-output restore, and atlas recovery callers and tests now use the updated presentation methods.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to a6e1a

The headful reveal test may fail under slow capture despite correct rendering. This is a bounded test-reliability risk, not an established terminal-rendering failure.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 17 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description is complete and covers the required sections, including user impact, implementation details, rationale, linked issue, visual-proof status, testing, platform considerations, and review …
Title check Passed The title clearly and concisely describes the primary change: preventing half-built synchronized-output frames during terminal reveal and recovery.
Linked Issues check Passed Issue #32198 is open and directly linked. Its coding expectation is that rendered terminal content stays present after a session becomes visible and through later updates. The issue states that the tr…
Out of Scope Changes check Passed All changed files relate to the single objective of keeping a coherent frame visible during DEC 2026 holds. The changes are: (a) removal of the forced present mode and `presentPaneViewportPreservingSy…
Full details: Description check

Explanation

The description is complete and covers the required sections, including user impact, implementation details, rationale, linked issue, visual-proof status, testing, platform considerations, and review notes. It clearly discloses that manual testing and some local validation were not performed.

Full details: Linked Issues check

Explanation

Issue #32198 is open and directly linked. Its coding expectation is that rendered terminal content stays present after a session becomes visible and through later updates. The issue states that the trigger and cause are unconfirmed and that no production fix is claimed. The reviewed head implements the candidate paths named in the issue. (1) presentPaneViewport in pane-viewport-present.ts now has one mode. It calls requestFullViewportPresent, and the forced-current-buffer path and presentPaneViewportPreservingSynchronizedOutput are removed. (2) terminal-replay-presentation.ts waits on animation frames while isSynchronizedOutputHeld(terminal) is true before a normal unhide. The retained frame stays visible during that wait. Only atHoldCap uses forceFullViewportPresent, and the 1,000 ms cap is kept. (3) Coverage for these behaviors is described in the PR as unit tests on a captured Codex 0.158 frame and in terminal-structural-replay-presentation.test.ts. I did not read those test files or run them. Limits of this assessment: I did not verify that requestFullViewportPresent itself defers under DEC 2026. That behavior is inferred from its call sites and comments. The issue's 'empty capture' candidate path is only partly covered. When retainTerminalReplayFrame returns no frame, unhideWhenFrameComplete skips the frame wait and unhides at once. Any residual blanking on that path depends on requestFullViewportPresent honoring the hold. Causation between these code paths and the reported symptom is not established, which the issue itself does not claim.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the single objective of keeping a coherent frame visible during DEC 2026 holds. The changes are: (a) removal of the forced present mode and presentPaneViewportPreservingSynchronizedOutput, with the rename presentForcedViewports to presentViewports and its registry use in pane-manager-registry.ts and pane-manager.ts; (b) caller switches in terminal-visibility-resume.ts, hidden-output-restore-snapshot.ts, and pane-reveal-repaint.ts; (c) the replay hold and frame-wait logic in terminal-replay-presentation.ts; (d) comment updates in terminal-render-pause-release.ts; (e) the re-export removal in pane-webgl-renderer.ts; and (f) test updates and additions, including the new pane-viewport-present-synchronized-output.test.ts and the e2e reveal spec update. The PR states no wire, IPC, or protocol change, and the file list shows renderer-only changes. I found no unrelated feature, refactor, or platform change in the summarized scope. My checks covered only pane-viewport-present.ts, terminal-replay-presentation.ts, and the pane-manager directory listing. I did not inspect the other changed files directly.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ 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: dd6447d9-4211-4d7c-901f-1e07e663fd6f
📥 Commits

Reviewing files that changed from the base of the PR and between c32d468 and a6e1aba.

📒 Files selected for processing: 17
  • src/renderer/src/components/terminal-pane/pty-connection-hidden-backlog-snapshot.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection/hidden-output-restore-snapshot.ts
  • src/renderer/src/components/terminal-pane/terminal-visibility-resume.test.ts
  • src/renderer/src/components/terminal-pane/terminal-visibility-resume.ts
  • 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-reveal-repaint.ts
  • src/renderer/src/lib/pane-manager/pane-viewport-present-lifetime.test.ts
  • src/renderer/src/lib/pane-manager/pane-viewport-present-synchronized-output.test.ts
  • src/renderer/src/lib/pane-manager/pane-viewport-present.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-renderer.test.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts
  • src/renderer/src/lib/pane-manager/terminal-render-pause-release.ts
  • src/renderer/src/lib/pane-manager/terminal-replay-presentation.ts
  • src/renderer/src/lib/pane-manager/terminal-structural-replay-presentation.test.ts
  • tests/e2e/terminal-reveal-paused-render-repro.spec.ts

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

.toBeGreaterThan(0)
const afterReveal = await captureStableTabScreenshot(orcaPage, tabId)
// Why not a stable capture: the atlas clear's redraw starts xterm's 1s DEC 2026 safety timeout.
const afterReveal = await captureFirstRevealedFrame(orcaPage, tabId)

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

set -o pipefail
file=tests/e2e/terminal-reveal-paused-render-repro.spec.ts
printf '%s\n' '--- relevant symbols and references ---'
rg -n -F -- 'captureFirstRevealedFrame' "$file" || test "$?" -eq 1
rg -n -F -e 'synchronized' -e '2026' -e 'watchdog' -e 'reveal' "$file" || test "$?" -eq 1
printf '%s\n' '--- current helper and test region ---'
sed -n '1,180p' "$file"
sed -n '400,510p' "$file"
printf '%s\n' '--- base/current diff for the file ---'
git diff --no-ext-diff --unified=30 b4ee652bcfac8d48b30d6dca16f2a1fda5f726a2 a6e1abac3e7b795ec9553bb24be5819c23e5337a -- "$file"

Repository: stablyai/orca

Length of output: 24209


🏁 Script executed:

set -o pipefail
file=tests/e2e/terminal-reveal-paused-render-repro.spec.ts
printf '%s\n' '--- synchronized probe and capture helper ---'
sed -n '200,360p' "$file"
printf '%s\n' '--- exact lines around the reviewed call ---'
nl -ba "$file" | sed -n '450,485p'

Repository: stablyai/orca

Length of output: 7690


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- production reveal path ---'
rg -n -F --glob '*.{ts,tsx,js}' -e 'scheduleRevealRepaint' -e 'resetWebglTextureAtlases' -e 'clearTextureAtlas' src tests || test "$?" -eq 1
printf '%s\n' '--- xterm dependency declarations and checked-in sources ---'
rg -n -F -e '"@xterm/xterm"' -e 'xterm' package.json pnpm-lock.yaml package-lock.json yarn.lock 2>/dev/null || true
rg -n -F --glob '!node_modules/**' -e '_syncOutputHandler' -e 'synchronizedOutput' . || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 45668


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- pane manager reveal methods ---'
nl -ba src/renderer/src/lib/pane-manager/pane-manager.ts | sed -n '270,325p'
printf '%s\n' '--- xterm declarations and source locations ---'
rg -n -F -e '"@xterm/xterm"' -e '@xterm/xterm@' package.json pnpm-lock.yaml
rg --files | rg '(^|/)(xterm|@xterm|terminal).*(sync|core|input|package|json)' | head -n 100

Repository: stablyai/orca

Length of output: 12648


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- delegated reveal implementations ---'
rg -n -F --glob '*.ts' -e 'function schedulePaneRevealRepaint' -e 'const schedulePaneRevealRepaint' -e 'function resetPaneWebglTextureAtlases' -e 'const resetPaneWebglTextureAtlases' src/renderer/src/lib/pane-manager
printf '%s\n' '--- implementation files ---'
for f in $(rg -l -F --glob '*.ts' -e 'schedulePaneRevealRepaint' -e 'resetPaneWebglTextureAtlases' src/renderer/src/lib/pane-manager); do
  echo "--- $f"
  rg -n -F -e 'schedulePaneRevealRepaint' -e 'resetPaneWebglTextureAtlases' -e 'clearTextureAtlas' -e 'presentPaneViewports' "$f" || true
done
printf '%s\n' '--- xterm patch metadata ---'
sed -n '1,240p' config/patches/xterm-upstream.json

Repository: stablyai/orca

Length of output: 9785


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- pane-reveal-repaint.ts ---'
nl -ba src/renderer/src/lib/pane-manager/pane-reveal-repaint.ts | sed -n '1,190p'
printf '%s\n' '--- pane-rendering-control.ts ---'
nl -ba src/renderer/src/lib/pane-manager/pane-rendering-control.ts | sed -n '100,155p'
printf '%s\n' '--- synchronized-output references in xterm source patches ---'
rg -n -F -e 'SyncOutputHandler' -e '_syncOutputHandler' -e 'synchronizedOutput' config/patches/xterm-src config/patches/@xterm__xterm@6.1.0-beta.304.patch || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 45659


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- xterm timeout contexts in the checked-in patch ---'
python3 - <<'PY'
from pathlib import Path
p = Path('config/patches/@xterm__xterm@6.1.0-beta.304.patch')
text = p.read_text(errors='replace')
needle = '_syncOutputHandler'
pos = 0
count = 0
while True:
    pos = text.find(needle, pos)
    if pos < 0:
        break
    count += 1
    print(f'--- occurrence {count} at offset {pos} ---')
    print(text[max(0, pos-900):pos+1800])
    pos += len(needle)
print('count', count)
PY
printf '%s\n' '--- called reveal/reset implementations ---'
rg -n -F -e 'function resetAndRefreshAllTerminalWebglAtlases' -e 'function reattachWebglIfNeeded' -e 'function resetWebglTextureAtlas' src/renderer/src/lib/pane-manager
for f in $(rg -l -F -e 'resetAndRefreshAllTerminalWebglAtlases' -e 'reattachWebglIfNeeded' -e 'resetWebglTextureAtlas' src/renderer/src/lib/pane-manager); do
  echo "--- $f"
  rg -n -F -e 'resetAndRefreshAllTerminalWebglAtlases' -e 'reattachWebglIfNeeded' -e 'resetWebglTextureAtlas' "$f" || true
done

Repository: stablyai/orca

Length of output: 41636


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- readable xterm synchronized-output handler ---'
rg -n -F -e 'class SynchronizedOutputHandler' -e 'SYNCHRONIZED_OUTPUT_TIMEOUT_MS' -e 'bufferRows(' -e 'flush()' config/patches/xterm-src
printf '%s\n' '--- reattach and atlas reset blocks ---'
nl -ba src/renderer/src/lib/pane-manager/pane-webgl-reattach.ts | sed -n '1,90p'
nl -ba src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts | sed -n '175,220p'
nl -ba src/renderer/src/lib/pane-manager/pane-manager-registry.ts | sed -n '1,70p'

Repository: stablyai/orca

Length of output: 7189


🌐 Web query:

@xterm/xterm 6.1.0-beta.304 SynchronizedOutputHandler _timeout source

💡 Result:

<source_evidence>
<source kind="search">
<title>Rendering Architecture | xtermjs/xterm.js | DeepWiki</title>
<location>https://deepwiki.com/xtermjs/xterm.js/4.1-core-addons</location>
<excerpt>citeturn1search0 [wordlim: 200] Crawled: last month; This document describes the rendering architecture of xterm.js, including how the `RenderService` orchestrates rendering, the `IRenderer` abstraction, and how different renderer implementations plug into the system. ... Synchronized Output  | Buffers renders during DEC mode 2026  | `SynchronizedOutputHandler` ... When DEC mode 2026 (synchronized output) is enabled, the `SynchronizedOutputHandler` buffers all render requests until the mode is disabled:

# Rendering Architecture

Relevant source files

  * addons/addon-webgl/src/WebglRenderer.ts
  * src/browser/CoreBrowserTerminal.ts
  * src/browser/Linkifier.test.ts
  * src/browser/Linkifier.ts
  * src/browser/TestUtils.test.ts
  * src/browser/Viewport.ts
  * src/browser/public/Terminal.ts
  * src/browser/renderer/dom/DomRenderer.ts
  * src/browser/renderer/dom/DomRendererRowFactory.test.ts
  * src/browser/renderer/dom/DomRendererRowFactory.ts
  * src/browser/renderer/dom/WidthCache.test.ts
  * src/browser/renderer/dom/WidthCache.ts
  * src/browser/renderer/shared/TextBlinkStateManager.test.ts
  * src/browser/renderer/shared/TextBlinkStateManager.ts
  * src/browser/services/RenderService.ts
  * src/browser/services/Services.ts

This document describes the rendering architecture of xterm.js, including how the `RenderService` orchestrates rendering, the `IRenderer` abstraction, and how different renderer implementations plug into the system. For details on specific renderers, see DOM Renderer and WebGL Renderer. For viewport and scrolling behavior, see Viewport and Scrolling.

## Architecture Overview

The rendering system is built around a layered architecture that separates orchestration from implementation:

Sources: src/browser/services/RenderService.ts1-383 src/browser/renderer/dom/DomRenderer.ts1-663 addons/addon-webgl/src/WebglRenderer.ts1-800

## RenderService: The Orchestrator

The `RenderService` class (src/browser/services/RenderService.ts25-325) serves as the central coordinator for all rendering operations. It does not perform rendering itself but manages when and what to render.

### Core Responsibilities

Responsibility  | Implementation  | Key Methods
--- | --- | ---
Render Scheduling  | Debounces render requests to batch updates  | `refreshRows(start, end, sync)`
Renderer Management  | Holds reference to active `IRenderer`  | `setRenderer(renderer)`
Dimension Tracking  | Exposes `dimensions` from active renderer  | `dimensions` getter
Pause/Resume  | Pauses rendering when terminal is off-screen  | `_handleIntersectionChange()`
Synchronized Output  | Buffers renders during DEC mode 2026  | `SynchronizedOutputHandler`

Sources: src/browser/services/RenderService.ts25-325

### Render Debouncing

The `RenderService` uses a `RenderDebouncer` to batch multiple render requests within a single animation frame:

The debouncer merges overlapping ranges and fires once per frame, reducing unnecessary DOM operations or GPU uploads.

Sources: src/browser/services/RenderService.ts73-74 src/browser/services/RenderService.ts175-176

### Synchronized Output Handling

When DEC mode 2026 (synchronized output) is enabled, the `SynchronizedOutputHandler` buffers all render requests until the mode is disabled:

This prevents flickering during complex escape sequence operations by ensuring all updates are rendered atomically.

Sources: src/browser/services/RenderService.ts76-81 src/browser/services/RenderService.ts327-382

### Visibility-Based Rendering

The `RenderService` uses an `IntersectionObserver` to pause rendering when the terminal is not visible:

  * When the terminal goes off-screen, `_isPaused` is set to `true`
  * Render requests are queued as `_needsFullRefresh = true`
  * When the terminal becomes visible again, a full refresh is triggered
  * This optimization reduces CPU/GPU usage when terminals are in background tabs or scrolled out of view

Sources: src/browser/services/RenderService.ts125-149

## IR…[truncated]</excerpt>
</source>
<source kind="search">
<title>Rendering Architecture | xtermjs/xterm.js | DeepWiki</title>
<location>https://deepwiki.com/xtermjs/xterm.js/4.1-core-addons</location>
<excerpt>citeturn3search8 [wordlim: 200] Crawled: last month; This document describes the rendering architecture of xterm.js, including how the `RenderService` orchestrates rendering, the `IRenderer` abstraction, and how different renderer implementations plug into the system. ... The `RenderService` class (src/browser/services/RenderService.ts25-325) serves as the central coordinator for all rendering operations. ... Synchronized Output  | Buffers renders during DEC mode 2026  | `SynchronizedOutputHandler`

### Core Responsibilities

Responsibility  | Implementation  | Key Methods
--- | --- | ---
Render Scheduling  | Debounces render requests to batch updates  | `refreshRows(start, end, sync)`
Renderer Management  | Holds reference to active `IRenderer`  | `setRenderer(renderer)`
Dimension Tracking  | Exposes `dimensions` from active renderer  | `dimensions` getter
Pause/Resume  | Pauses rendering when terminal is off-screen  | `_handleIntersectionChange()`
Synchronized Output  | Buffers renders during DEC mode 2026  | `SynchronizedOutputHandler`

Sources: src/browser/services/RenderService.ts25-325

### Render Debouncing

The `RenderService` uses a `RenderDebouncer` to batch multiple render requests within a single animation frame:

The debouncer merges overlapping ranges and fires once per frame, reducing unnecessary DOM operations or GPU uploads.

Sources: src/browser/services/RenderService.ts73-74 src/browser/services/RenderService.ts175-176

### Synchronized Output Handling

When DEC mode 2026 (synchronized output) is enabled, the `SynchronizedOutputHandler` buffers all render requests until the mode is disabled:

This prevents flickering during complex escape sequence operations by ensuring all updates are rendered atomically.

Sources: src/browser/services/RenderService.ts76-81 src/browser/services/RenderService.ts327-382

### Visibility-Based Rendering

The `RenderService` uses an `IntersectionObserver` to pause rendering when the terminal is not visible:

  * When the terminal goes off-screen, `_isPaused` is set to `true`
  * Render requests are queued as `_needsFullRefresh = true`
  * When the terminal becomes visible again, a full refresh is triggered
  * This optimization reduces CPU/GPU usage when terminals are in background tabs or scrolled out of view

Sources: src/browser/services/RenderService.ts125-149

</excerpt>
</source>
<source kind="search">
<title>GitHub - xtermjs/xterm.js: A terminal for the web · GitHub</title>
<location>https://github.com/xtermjs/xterm.js/</location>
<excerpt>citeturn0search0 [wordlim: 200] Crawled: today; console development javascript pty ssh terminal terminal-emulators tty typescript vt100 webgl xterm ... Xterm.js can be connected to processes like `bash` and let you interact with them (provide input, receive output) through a library like node-pty. ...           &lt;script src=&quot;node_modules/@xterm/xterm/lib/xterm.js&quot;&gt;&lt;/script&gt; ...   * kmux: A keyboard-centric terminal workspace for running parallel AI coding agents side by side on macOS and Linux.

xterm.js

Public

  * NotificationsYou must be signed in to change notification settings
  * Fork2k (2k)
  * Star21.3k (21.3k)You must be signed in to star a repository

## About

A terminal for the web

xtermjs.org/

### Topics

consoledevelopmentjavascriptptysshterminalterminal-emulatorsttytypescriptvt100webglxterm

# 

Xterm.js is a frontend component that enables applications to bring fully-featured terminals to their users in the browser. It&#39;s used by popular projects such as VS Code (and its forks), Tabby and Hyper.

## Features

  * Terminal apps just work: Xterm.js works with most terminal apps such as `bash`, `vim`, and `tmux`, including support for curses-based apps and mouse events.
  * Performant: Xterm.js is really fast and includes an optional GPU-accelerated renderer.
  * Rich Unicode support: Supports CJK, emojis, and IMEs.
  * Self-contained: The core library has zero dependencies.
  * Accessible: Screen reader mode and minimum contrast ratio support can be turned on.
  * And much more: Links, theming, custom glyphs, addons, well documented API, etc.

## What xterm.js is not

  * Xterm.js is not a terminal application that you can download and use on your computer.
  * Xterm.js is not `bash`. Xterm.js can be connected to processes like `bash` and let you interact with them (provide input, receive output) through a library like node-pty.

## Getting Started

First, you need to install the module. We ship exclusively through npm, so you need that installed and then add @xterm/xterm as a dependency by running:
    
    npm install --save @xterm/xterm

The recommended way to load xterm.js with the ES module syntax, either using TypeScript or a modern JS tooling. Note that both CommonJS and ES module files are shipped with the npm package.
    
    import { Terminal } from &#39;@xterm/xterm&#39;;

Then instantiate a `Terminal` object, open it on an element and write to it:
    
    const term = new Terminal();
    term.open(document.getElementById(&#39;terminal&#39;));
    term.write(&#39;Hello from \x1B[1;3;31mxterm.js\x1B[0m $ &#39;)

Most use cases will hook up input and output to a pseudoterminal API such as node-pty which will drive the terminal.
    
    pty.onData(data =&gt; term.write(data));
    term.onData(data =&gt; pty.write(data));

Then make sure to also include the `css/xterm.css` file, for example in HTML:
    
    &lt;link rel=&quot;stylesheet&quot; href=&quot;node_modules/@xterm/xterm/css/xterm.css&quot; /&gt;


### Standalone example

Here is a complete standalone example in a HTML file:
    
    &lt;!doctype html&gt;
      &lt;html&gt;
        &lt;head&gt;
          &lt;link rel=&quot;stylesheet&quot; href=&quot;node_modules/@xterm/xterm/css/xterm.css&quot; /&gt;
          &lt;script src=&quot;node_modules/@xterm/xterm/lib/xterm.js&quot;&gt;&lt;/script&gt;
        &lt;/head&gt;
        &lt;body&gt;
          &lt;div id=&quot;terminal&quot;&gt;&lt;/div&gt;
</excerpt>
</source>
<source kind="search">
<title>xterm.js/src/common/CoreTerminal.ts at master · xtermjs/xterm.js · GitHub</title>
<location>https://github.com/xtermjs/xterm.js/blob/master/src/common/CoreTerminal.ts</location>
<excerpt>citeturn0search1 [wordlim: 200] Crawled: 3 weeks ago; * Copyright (c) 2014-2020 The xterm.js authors. ... * Fabrice Bellard&#39;s javascript vt100 for jslinux: ... * it&#39;s filtered out. ... this._register(EventUtils.forward(this._inputHandler.onLineFeed, this._onLineFeed)); ... return this._inputHandler.registerCsiHandler(id, callback);

# CoreTerminal.ts

# CoreTerminal.ts

Copy path

Top

## File metadata and controls

  * Code

  * Blame

307 lines (270 loc) · 13.6 KB

/**

* Copyright (c) 2014-2020 The xterm.js authors. All rights reserved.

* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)

* @license MIT

*

* Originally forked from (with the author&#39;s permission):

* Fabrice Bellard&#39;s javascript vt100 for jslinux:

* http://bellard.org/jslinux/

* Copyright (c) 2011 Fabrice Bellard

* The original design remains. The terminal itself

* has been extended to include xterm CSI codes, among

* other features.

*

* Terminal Emulation References:

* http://vt100.net/

* http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt

* http://invisible-island.net/xterm/ctlseqs/ctlseqs.html

* http://invisible-island.net/vttest/

* http://www.inwap.com/pdp10/ansicode.txt

* http://linux.die.net/man/4/console_codes

* http://linux.die.net/man/7/urxvt

*/

import { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, IMouseStateService, IUnicodeService, LogLevelEnum, IOscLinkService } from &#39;./services/Services&#39;;

import { InstantiationService } from &#39;./services/InstantiationService&#39;;

import { LogService } from &#39;./services/LogService&#39;;

import { BufferService, BufferServiceConstants } from &#39;./services/BufferService&#39;;

import { OptionsService } from &#39;./services/OptionsService&#39;;

import { IDisposable, IScrollEvent, ITerminalOptions, IParams } from &#39;./Types&#39;;

import { IAttributeData, IBufferSet } from &#39;./buffer/Types&#39;;

import { CoreService } from &#39;./services/CoreService&#39;;

import { MouseStateService } from &#39;./services/MouseStateService&#39;;

import { UnicodeV6 } from &#39;./input/UnicodeV6&#39;;

import { UnicodeService } from &#39;./services/UnicodeService&#39;;

import { CharsetService } from &#39;./services/CharsetService&#39;;

import { updateWindowsModeWrappedState } from &#39;./WindowsMode&#39;;

import { IFunctionIdentifier } from &#39;./parser/Types&#39;;

import { InputHandler } from &#39;./InputHandler&#39;;


this._register(this._bufferService.onScroll(() =&gt; {

this._onScroll.fire({ position: this._bufferService.buffer.ydisp });

this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);

}));

// Setup WriteBuffer

this._writeBuffer = this._register(new WriteBuffer((data, promiseResult) =&gt; this._inputHandler.parse(data, promiseResult)));

this._register(EventUtils.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));

}

public write(data: string | Uint8Array, callback?: () =&gt; void): void {

this._writeBuffer.write(data, callback);

}

/**

* Write data to terminal synchonously.

*

* This method is unreliable with async parser handlers, thus should not

* be used anymore. If you need blocking semantics on data input consider

* `write` with a callback instead.

*

* @deprecated Unreliable, will be removed soon.

*/

public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {

if (this._logService.logLevel &lt;= LogLevelEnum.WARN &amp;&amp; !hasWriteSyncWarnHappened) {

this._logService.warn(&#39;writeSync is unreliable and will be removed soon.&#39;);

hasWriteSyncWarnHappened = true;

}

this._writeBuffer.writeSync(data, maxSubsequentCalls);

This is used to avoid

* unwanted events being handled by the viewport when the event was triggered from the viewport

* originally.

*/

public scrollLines(disp: number, suppressScrollEvent?: boolean): void {

this._bufferService.scrollLines(d…[truncated]</excerpt>
</source>
<source kind="search">
<title>xterm.js/typings/xterm.d.ts at master · xtermjs/xterm.js · GitHub</title>
<location>https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts</location>
<excerpt>citeturn0search2 [wordlim: 200] Crawled: 2 weeks ago; * This contains the type declarations for the xterm.js library. ... * some interfaces differ between this file and the actual implementation in ... * A {@link Document} to use instead of the one that xterm.js was attached ... * a terminal app writing link in the form `javascript:...` that runs some ... * term.parser.addCsiHandler({final: &#39;t&#39;}, params =&gt; {

# xterm.d.ts

# xterm.d.ts

Copy path

Top

## File metadata and controls

  * Code

  * Blame

2243 lines (2025 loc) · 72.3 KB

/**

* @license MIT

*

* This contains the type declarations for the xterm.js library. Note that

* some interfaces differ between this file and the actual implementation in

* src/, that&#39;s because this file declares the *public* API which is intended

* to be stable and consumed by external programs.

*/

/// &lt;reference lib=&quot;dom&quot;/&gt;

declare module &#39;@xterm/xterm&#39; {

/**

* A string or number representing text font weight.

*/

export type FontWeight = &#39;normal&#39; | &#39;bold&#39; | &#39;100&#39; | &#39;200&#39; | &#39;300&#39; | &#39;400&#39; | &#39;500&#39; | &#39;600&#39; | &#39;700&#39; | &#39;800&#39; | &#39;900&#39; | number;

/**

* A string representing log level.

*/

export type LogLevel = &#39;trace&#39; | &#39;debug&#39; | &#39;info&#39; | &#39;warn&#39; | &#39;error&#39; | &#39;off&#39;;

/**

* An object containing options for the terminal.

*/

export interface ITerminalOptions {

/**

* Whether to allow the use of proposed API. When false, any usage of APIs

* marked as experimental/proposed will throw an error. The default is

* false.

*/

allowProposedApi?: boolean;

/**

* Whether background should support non-opaque color. It must be set before

* executing the `Terminal.open()` method and can&#39;t be changed later without

* executing it again. Note that enabling this can negatively impact

* performance.

*/

allowTransparency?: boolean;

/**

* If enabled, alt + click will move the prompt cursor to position

* underneath the mouse. The default is true.

*/

altClickMovesCursor?: boolean;

/**

* When enabled the cursor will be set to the beginning of the next line

* with every new line. This is equivalent to sending `\r\n` for each `\n`.

* Normally the settings of the underlying PTY (`termios`) deal with the

* translation of `\n` to `\r\n` and this setting should not be used. If you

* deal with data from a non-PTY related source, this settings might be

* useful.

*

* @see https://pubs.opengroup.org/onlinepubs/007904975/basedefs/termios.h.html

*/

convertEol?: boolean;

/**

</excerpt>
</source>
<omitted_sources count="42">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: https://deepwiki.com/xtermjs/xterm.js/4.1-core-addons?utm_source=openai

🏁 Script executed:

set -o pipefail
python3 - <<'PY'
from pathlib import Path
p = Path('config/patches/@xterm__xterm@6.1.0-beta.304.patch')
text = p.read_text(errors='replace')
needles = ['setTimeout', 'clearTimeout', '1000', '1e3', 'SynchronizedOutput']
for needle in needles:
    print(f'=== {needle} ===')
    pos = 0
    count = 0
    while count < 12:
        pos = text.find(needle, pos)
        if pos < 0:
            break
        count += 1
        print(f'--- {count} offset {pos} ---')
        print(text[max(0, pos-500):pos+1000])
        pos += len(needle)
    print('count shown', count)
PY

Repository: stablyai/orca

Length of output: 41999


Pause the synchronized-output watchdog during the held-frame capture.

paintFrame(...release: false) clears the current timer, but the reveal repaint clears the atlas afterward. xterm then calls SynchronizedOutputHandler.bufferRows, which starts a new one-second timer when _timeout is undefined. If visibility waiting or screenshot capture takes at least one second, captureFirstRevealedFrame can run after xterm releases the frame and make the test fail despite correct presentation.

Expose a test-only watchdog-hold operation and invoke it immediately after the atlasClears poll, before captureFirstRevealedFrame. Record the reveal-to-capture interval in headful CI.

@nwparker
nwparker merged commit 13ab523 into main Oct 23, 2026
44 checks passed
nwparker added a commit that referenced this pull request Oct 24, 2026
* fix(git): preserve unmerged branches with no net file changes

* fix(workspace): show launch actions in empty tab groups (#32182)

* fix(workspace): show launch actions in empty tab groups

* fix(workspace): resolve empty-pane browser policy by owner

* Scope daemon inventories for safe worktree teardown (#32171)

* Fix scoped daemon inventories without changing terminal input routes

* Serialize daemon owner inventory refreshes safely

* Serialize daemon owner inventory refreshes safely

* test(daemon): protect baseline inventory budgets and recovery

* fix(daemon): clear route proof during synthetic exits (#32196)

* docs: condense test anti-pattern guidance (#32201)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* refactor: colocate repository draft input and tests (#32155)

* test: consolidate discovery coverage and replace copied oracles (#32211)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* test: retire copied oracles and implementation inventories (#32206)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* test: remove classification inventories and verify settled boundaries (#32216)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* test: keep explicit regressions without legacy algorithm copies (#32218)

* test: keep explicit regressions without legacy algorithm copies

* test: use Number.NaN in latency fixtures

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* ci: avoid slow Ubuntu mirrors during WebKit setup (#32205)

* ci: reuse bounded Ubuntu mirror setup for WebKit

* ci: preserve Ubuntu setup for dispatched older refs

* perf(renderer): scope runtime connection and parking subscriptions (#32199)

* fix(chat): allow visuals to declare open without breaking scripts (#32226)

* fix(native-chat): keep queued messages in the chat's own record, so a refused one can't be skipped (#30418)

* fix(native-chat): a refused queued message still blocks the queue when its card write fails

Every reader of a queued card goes through one derived view of the journal's dispatch facts,
so a card whose message was refused reads as returned even when its card-table update and heal
both failed. One decision and one writer store the derived state for every action.

* refactor(native-chat): keep each queued message in the chat's journal, not a second table

A queued message lived in its own SQL table, and a hook that may be skipped copied
each refusal from the journal into it. When that write failed, a refused card
vanished: the cards behind it sent, and its Send and Delete did nothing.

Each queued message is now a `queue` row in the chat's journal beside the
submission that hands it off and the dispatch row that answers it. The reducer
folds the card from those rows, so a refusal returns the card and holds the
cards behind it with nothing written, and replay reads the same. Every action
writes its own rows in one transaction. Cards an earlier build stored are read
through the same classification until they move: each action moves its own
card, and a bulk import runs once per open. A new epoch restates every card
still owed an answer in the transaction that deletes the old rows.

The settlement hook and its savepoint, the open-time heal, the drain's heal and
the derived-card view are gone. The published card list is unchanged.

* test(native-chat): adapt the queue tests to cards kept in the journal

Cards are written through the journal, so tests queue them with their body
alone and hand them off under their real fingerprint. Tests of the removed
settlement hook, heal and SQL store are deleted; the text-update spec now
covers the edit decision alone, and a test of an earlier build's stored holds
seeds the legacy table and reads the imported cards. Rolling over an epoch now
keeps a card whose hand-off was never handed over, so that test checks the
retried id never sends rather than that nothing sends.

* test(native-chat): a refused card holds the queue through rewind, a new epoch and a restart

One whole-flow test through the host: the refusal writes no card row, a rewind
that retires the refused hand-off and a rolled-over epoch keep the card
returned, a restart and Resume send nothing behind it, its own Send refused
again still holds the queue, and its Delete releases the next card in order.

* test(native-chat): an earlier build's queued cards move into the journal once, each read the same

One mixed-import test through the host. The first open's import fails and
moves nothing, yet every card reads as it will; Delete and Send each move only
their own card. The next open moves the rest in one transaction, writing a
refusal only where its hand-off is gone, nothing for answered cards, and leaving
an unreadable row on disk. A later command turn spends a moved command card, a
third open writes nothing, an old Delete replays from its receipt, and a chat
with only answered legacy rows clears them in a delete-only transaction.

* test(native-chat): adapt typechecked tests to cards kept in the journal

The row-kind table lists a queue row, the clear and legacy-import tests
match the current signatures, and the downgrade test keeps only the
leftover-send case: a queued card is now a newer-version journal row an
older build keeps read-only, and users don't downgrade.

* refactor(native-chat): drop the journal row writer's unused transaction hook

No caller passes one since the queue's savepoint bookkeeping left.

* test(native-chat): downgrade probes write rows at the version older builds read

The highest version this build reads is now 4, the queue row's. A newer
build's row in these probes is written at version 3 so the older build
meets its kind, not a newer version, and the Stop-event probe hands the
older build the rows as stored, since a read raises each row's version.

* test(native-chat): unit tests follow the queue row's version 4

The legacy-import test opens real SQLite, so it runs in the Node runtime
project. The newest version this build reads is now 4, and a read raises a
row's version to it, so the turn-lifecycle test no longer pins the
in-memory version (the written one stays pinned by journalRowSchemaVersion).

* fix(native-chat): one batch echoing two refused queued messages spends both

The per-row delivery check returned only the first waiting card an echo
proved delivered, so when one settlement carried echoes for two cards the
second stayed waiting and was sent again. It now returns every card the
row proves delivered, and the fold withdraws each; replay folds the same.

* fix(native-chat): a rewind moves an earlier build's cards into the journal first

While the open's import had failed, an earlier build's card that read as
refused through its hand-off lost that reading when an in-place rewind
retired the hand-off: it disappeared and the card behind it sent. The
rewind now adopts every legacy card ahead of its tombstones and deletes
their rows in its own transaction, as an epoch replacement already does,
so the fold latches each card's reading before its hand-off is gone.

* fix(native-chat): keep an earlier build's card whose hand-off is still unconfirmed

The import dropped a legacy card handed off as a send whose delivery was
unknown, though the fold keeps such a card linked and a later refusal
returns it. The import now keeps every card whose hand-off a later row can
still answer, through the same check the reducer folds dispatch rows by.

* fix(native-chat): one delivery echo withdraws at most one queued card

One provider echo proves one delivery, yet it withdrew every waiting card
with the same text whose hand-off was refused, so a second identical card
was lost. The fold now pairs each echo with one card: on its own row the
earliest-positioned match no other echo of that row took, and for a card
that waits again the earliest applied echo no card has taken. Paired echoes
live in the fold's state, so live and replay pair the same; readers of
cards not yet imported work on a copy.

* fix(native-chat): a queued message handed to the agent is sent again only on proof it never got it

Pressing Stop after Orca handed a queued or steered message to the agent,
before the agent confirmed it, put the card back in the queue, and Resume
or the next send sent it again. A check matching the agent's echo of the
text was the only guard against a double send, and it kept trading a
resend for a lost card. Whether the card waited again was decided by the
rejection's category, not by proof the agent never got the message.

A refused hand-off now waits again only where Orca proves the agent never
received it: the host still held it, or whoever settled it recorded that.
A failure still returns the card and holds the cards behind it. Anything
else may have reached the agent, so the card is spent and its message
reads as sent, derived on every fold from the stored rejection: with the
turn it was answered into, as that turn's unconfirmed message where it was
handed over; withdrawn before any turn opened, as a person's own send a
Stop took back. The reopen mark ignores a recovered doubt, and the restart
reconciler no longer judges a queued hand-off unsent from what history
lacks. The echo text matching and its pairing are deleted.

A close or quit while the agent starts settles sends with the unrun hold.
The host hands nothing to a child before its start answers
(structured-agent-session-delivery-loop.ts: a handover needs phase
ready), so such a send went to an earlier child and may have run: it now
reads as sent instead of waiting again.

* fix(native-chat): Claude's report that it removed a queued message unrun lets the card wait again

Claude says when it removed a send without running it: the interrupt
receipt's cancelled list, or a command_lifecycle cancelled, discarded or
refused frame for a command that never started. Every one settles through
rejectClaudeDispatchWaiters, which now marks the settlement unrun. For a
queued card's hand-off the host records that as proof the agent never got
it, so the card waits again under the queue's pause. A direct send keeps
the plain refusal: there the proof would owe it as stopped history.

* fix(native-chat): an earlier build's card stopped after hand-over follows the same rule on upgrade

Earlier builds put a card back to waiting after any refusal without a
verdict and cleared its link, so a card the agent may already have would
be sent again after the upgrade. The card's own hand-offs in the journal
decide now: unchanged and last sent as one that may have reached the
agent, it is spent on that hand-off and its message reads as sent; edited
or sent again since, it is held for its own Send under a host-only marker
that publishes as a plain hold; with no hand-off in doubt, including one
that never left Orca, it waits as before. The import writes a card spent
on a hand-off in doubt, so its message shows.

* fix(native-chat): read a queued row's hand-off before the lookup that uses it

The lookup's callback lost the narrowing of the row's change, which the
mobile test typecheck rejects.

* test(native-chat): a card steered into a turn a Stop ends stays sent in the Stop tests

Three tests pinned the old rule, that a card handed into a running turn
comes back to waiting when a Stop ends it. Under the new rule nothing
proves the agent never got it, so the card is spent: with the turn named,
its message reads as that turn's unconfirmed one; without, as a send the
Stop took back. Neither is ever sent again.

* fix(native-chat): a queued message stopped before Orca handed it to the agent waits again

A Stop that aborts a hand-off after its row is written but before the agent call now records
the withdrawal as never reaching the agent, for queued hand-offs only, so plan D's rule returns
the card to waiting under the Stop's pause instead of spending it. Direct sends keep the plain
withdrawal (the flag would owe them as stopped history). The agent's own refusal while aborted
is kept rather than overwritten, and an abort thrown during the call stays in doubt.

* fix(native-chat): a queued message stopped while the agent prepares it waits again

The abort signal reaches only an adapter's preparation (its options, the previous turn opening),
never its write, so the signal's own reason thrown back is the adapter saying nothing was
written. The handover now reads that, for queued hand-offs only, as never reaching the agent,
so the card waits again under the Stop's pause. Claude no longer wraps that abort as an option
refusal, which had returned a stopped card as a refused one blocking the queue. A real refusal
keeps its cause and its barrier; any other throw stays in doubt and is never resent.

* test(native-chat): the usage-limit Continue backlog case writes its card through the journal queue

Main's #30396 wrote its backlog card with the stored fingerprint and host-instance stamp the
journal queue derives instead; the card the Continue must yield to is the same waiting card.

* test(claude): the real-CLI queued Stop expects the unrun mark Claude's cancelled-unrun receipt carries

* fix(native-chat): retain spent legacy messages when import fails

* Bound per-write chat selector work and guard ownership scans (#32109)

* Guard per-write chat selector work with shared ownership indexes

* Use checked sender session identities in the scale fixture

* Read each indexed tab row once during snapshot rebuilds

* Fix lexical binding and cache matching in selector lint rules

* Keep behavioral selector guards and resolve imported bindings

* Require selector binding definitions to declare functions

* Key performance subscribers by saved chat scope

* Show activity status with worktree-style counts (#26443)

* Show prioritized agent counts on the activity bell

* Move activity badge into the corner and shrink its count

* Use a fixed side column for activity status and counts

* Fix activity count spacing and status alignment

* Use worktree-style superscript counts for activity

* Keep activity count positions and update only number styling

* Keep idle layout fixtures out of active agent status updates

* Show child workspace statuses in the children toggle (#32224)

* Show child workspace status counts in lineage toggle

* Give child status summaries room and wrap narrow layouts

* Use solid working dots and keep child summaries on one line

* Restore children icon and clarify worktree tooltip

* Keep child totals clear of status counts in narrow layouts

* fix: preserve workspace review references when clearing active reviews (#32263)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* Saving a file, then closing that tab mid-save, no longer leaves its other tabs looking clean (STA-11786) (#32259)

* fix(editor): settle a save's shared record when the saving tab closed mid-write

With one file open in two workspaces, closing the saving tab while its write was in
flight left the other tab's disk baseline, dirty flag, draft and loaded text on the
pre-save version: every completion step looked the closed tab up by id and found
nothing, and the saved event listed only the closed tab as the record's views. An undo
back to the old text then read as clean and closed without asking.

The write now captures its record id with no await before the write, and completion
(rebaseline, dirty/draft settle, conflict clear or refusal banner, saved event's view
list) goes through a live view of that record, preferring a writable one. The save
runner and the write-lock wait do the same, so a save queued by a tab that closes
still writes through the record's remaining view. The chat visual's saved-event
listener also falls back to the record's views.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(editor): follow a closed saver's record through re-keys, kept records and listeners

Review follow-ups to the closed-saving-tab fix:

- Completion now finds the record through the view ids captured before the write,
  not the record id: a re-key mid-write (an unpinned runtime tab resolving its
  pairing) keeps views but changes the id, which brought the original bug back.
- A fallback writer (asking view closed while queued or waiting on the file lock) is
  chosen like autosave/restart's writer: writable and on a current connection, so a
  stale-connection sibling no longer throws when a current view exists.
- With no view of the record left, a kept record (no-prompt removal) is dropped when
  the write saved its text, else rebaselined; other open views of the file (a
  detached peer) take the written baseline, keeping their edits.
- A save may mark a record clean through a read-only or CSV-preview view (markFileDirty
  `written`); such views still never become dirty.
- Markdown preview refresh and the CSV pending-cell listener match the saved event's
  record views, not only the saving view's id.

Co-Authored-By: Claude <noreply@anthropic.com>

* test(editor): name the closed-view save harness as a test fixture

The focus-read ratchet scans non-test sources; the `.test-fixture.ts` suffix marks this
harness as test-only like the repo's other fixtures.

Co-Authored-By: Claude <noreply@anthropic.com>

* test(ci): list the closed-view save rig as a unit support bridge

The rig builds on the autosave test fixture, which takes the editor slice harness, so
the routing check saw it as a product consumer of that harness. Bridges are an explicit
list, like the browser drawn-from-main fixture.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Show task names for Codex subagents (#32243)

* fix: name Codex subagents from rollout metadata

* Hide generic default role in child agent rows

* Reject non-regular Codex identity transcripts without blocking

* [comment audit] Shorten preload comments (#32257)

* chore: audit preload root comments and track repository coverage

* docs: track repository comment audit coverage

* chore: keep comment audit tracker local

* chore: shorten preload API contract comments

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix: offload macOS deletion spawns and reduce branch cleanup (#32227)

* fix: reduce worktree deletion branch cleanup overhead

Refresh only the remote base branches needed to prove a branch merged, with automatic maintenance disabled. Skip merge simulation when no common ancestor is available and preserve the branch when its remote base cannot be refreshed.

* fix: preserve fetch mappings and live branch cleanup fallbacks

* fix: spawn macOS worktree deletion commands off the main thread

* test: remove redundant cases and start comprehensive value tracker (#32269)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(web): the browser client advertises the desktop's chat capabilities, so its host opens chats (#32253)

* fix(web): the browser client advertises the desktop's chat capabilities, so its host opens chats

The browser client's handshake never named agent-session.structured.v1, so a paired
host refused every agentSession call with structured_agent_session_unsupported and
withheld chat tabs. The desktop window, the Electron remote handshake and the browser
client now build their lists from one shared array of what the renderer's chat implements.

Fixes #32145

* refactor(web): keep the browser client's capability list beside the desktop's in shared

The host-side test parses both handshakes with the host's own parser, which the node
typecheck project can only import from src/shared.

* test(web): assert close-intent support in the auth frame, not the whole capability list

* fix(terminal): a timed-out CLI split names its pending pane, and a retry can never re-run its command (#32278)

* fix(terminal): a timed-out CLI split names its pending pane and can be retried without splitting again

Fixes #32169

* fix(terminal): a blank retry id or a closed pane never re-runs a split's command

* refactor(terminal): a split retry only waits for its pane and never asks the window again

* fix(terminal): a split missing from the graph is reported pending, never closed

* fix(ssh): never block or over-read on an SSH identity file (#32274)

Every place Orca reads an SSH key or identity file now goes through one
reader that refuses directories, FIFOs and devices (including through
symlinks) with a nonblocking open, and caps the read at 1 MB. An auth
failure now names any identity file that was skipped and why.

Fixes #31965. Reported by @Huge, who also proposed the first fix in #31966.

Co-authored-by: Martin Vlach <mr.huge@seznam.cz>

* test: finish fixture work before unit-test cleanup (#32285)

* fix(mobile): keep a terminal tab's chat identity while its handle is unchanged (#32251)

* fix(mobile): keep a terminal tab's chat identity while its handle is unchanged

A status frame that omits agentType or providerSession flipped chat back to the
terminal for tabs with no launchAgent (#31977), and left a launched tab with no
session to read (#32134). Mobile now remembers the last resolved agent and
session per tab and handle, so a missing field is treated as missing evidence.

* fix(mobile): keep remembered chat read-only and drop it on relaunch

A chat resolved only from this phone's memory may sit on a bare shell, so its
writes stay locked until live status confirms the agent. A live agent frame
without a session no longer inherits the previous conversation, and the
latest remembered agent outranks an older launch hint.

* fix(mobile): gate native-chat image sends on a confirmed live agent

An image send from a chat only this phone remembers could paste into a bare
shell; it now shares the confirmed-agent gate with text sends.

* fix(mobile): type remembered chat identity structurally

Importing MobileSessionTab into the eligibility module pulled React Native
globals into the e2e program through nested-agent-idle-session-owner.spec.ts,
retyping setTimeout as number there.

* fix(terminal): never present a half-built synchronized-output frame on reveal or recovery (#32281)

Settled reveal and every other atlas recovery forced the current xterm buffer
onto the screen even while a TUI held DEC 2026 synchronized output. Codex
erases rows inside each held redraw, so a reveal mid-redraw showed a blank
pane for a frame (#32198).

Viewport presents now have one mode: they keep the last coherent canvas and
let xterm present when the TUI closes the frame, bounded by xterm's 1s
synchronized-output safety timeout. Structural replay keeps its retained frame
up until an open synchronized frame closes, bounded by its existing hold cap.

Co-authored-by: YEONGUK LEE <contact@abruption.dev>

* refactor(renderer): colocate task page pagination rules (#32297)

* perf(test): bundle Zod once per isolated Vitest invocation (#32298)

* Use incremental tsrs locally and update Bun to 1.4.4 (#32276)

* Use incremental tsrs for local typechecks

* Update pinned Bun to 1.4.4

* fix(deps): bump dompurify to 3.4.17 and docs next to 16.4.1 for security advisories

dompurify 3.4.17 patches GHSA-cg2g-xh64-v4q7, GHSA-mrv2-3pqr-j5jr and
GHSA-c6gr-qvv4-5v3f in the root and mobile lockfiles. next 16.4.1 patches
GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr and GHSA-p3m5-59mp-jv5r in the
docs site.

* Prepare mobile bundle for smoke benchmarks

* Give native compiler benchmarks a larger ARM runner

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* test: trim redundant coverage and fix vacuous assertions (#32305)

* test: remove redundant cases and repair behavioral assertions

* docs: reconcile audit records with current main

* fix(deps): apply security updates from #32101

Apply the six-file DOMPurify 3.4.17 and Next.js 16.4.1 patch from PR #32101 to resolve the dependency security gate for this test audit. Original patch by Brennan Benson.

* test: satisfy changed-line quality gates

Add required braces and replace filter indexing with find. Rerun both CI quality gates and the 27 affected relay tests; refresh audit hashes and record the corrections.

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* fix(ci): retain ambiguous unit-test import consumers (#32366)

* test: exercise real boundaries and trim redundant cases (#32353)

* test: replace redundant checks with observed behavior

* docs: reconcile completed audit batches and upstream review

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(git): retain zero-net history with current merge-base guards

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: OrcaWin <alpha-eng@stably.ai>
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Martin Vlach <mr.huge@seznam.cz>
Co-authored-by: YEONGUK LEE <contact@abruption.dev>
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)

1 participant