Repository navigation
feat(terminal): inline images via @xterm/addon-image (perf-first) - #19512
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds configurable inline image rendering for SIXEL, iTerm2 IIP, and Kitty graphics. The change introduces lazy Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Relay sessions can lose the image protocol hint, and three transient chunk-load failures permanently disable inline images until the renderer restarts. Resolve these behavior gaps before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 21.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 64 functions across 58 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 714aa42e-5439-433d-88f8-5971af290569
📥 Commits
Reviewing files that changed from the base of the PR and between 7adb5b3 and b47ed52f4ece76837cd4de17eeb359d31915202f.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (46)
config/scripts/renderer-boot-graph.mjspackage.jsonsrc/main/daemon/pty-subprocess/spawn-environment.tssrc/main/ipc/pty-spawn-env-terminal-basics.test.tssrc/main/providers/local-pty-spawn-environment.tssrc/main/pty/wsl-orca-env.test.tssrc/main/pty/wsl-orca-env.tssrc/relay/pty-handler-spawn-environment.test.tssrc/relay/pty-handler.tssrc/renderer/src/components/settings/TerminalRenderingSection.tsxsrc/renderer/src/components/settings/setting-labels.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.tssrc/renderer/src/components/terminal-pane/terminal-appearance.tssrc/renderer/src/components/terminal-pane/terminal-capability-replies.test.tssrc/renderer/src/components/terminal-pane/terminal-capability-replies.tssrc/renderer/src/components/terminal-pane/terminal-pane-manager-options.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/pane-manager/pane-container-listener-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-dom-creation.tssrc/renderer/src/lib/pane-manager/pane-drag-reorder.test.tssrc/renderer/src/lib/pane-manager/pane-drop-no-op.test.tssrc/renderer/src/lib/pane-manager/pane-fit-resize-observer.test.tssrc/renderer/src/lib/pane-manager/pane-initial-fit-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-inline-images.test.tssrc/renderer/src/lib/pane-manager/pane-inline-images.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.tssrc/renderer/src/lib/pane-manager/pane-manager-pane-creation.tssrc/renderer/src/lib/pane-manager/pane-manager-types.tssrc/renderer/src/lib/pane-manager/pane-manager.tssrc/renderer/src/lib/pane-manager/pane-reveal-repaint.test.tssrc/renderer/src/lib/pane-manager/pane-split-close.test.tssrc/renderer/src/lib/pane-manager/pane-split-close.tssrc/renderer/src/lib/pane-manager/pane-split-scroll.test.tssrc/renderer/src/lib/pane-manager/pane-terminal-gpu-acceleration.test.tssrc/renderer/src/lib/pane-manager/pane-tree-ops.test.tssrc/renderer/src/lib/pane-manager/pane-tree-reparent-frame.test.tssrc/renderer/src/lib/pane-manager/pane-webgl-context-recovery.test.tssrc/renderer/src/lib/pane-manager/pane-webgl-refresh-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-webgl-renderer.test.tssrc/renderer/src/lib/pane-manager/terminal-image-addon-loader.tssrc/renderer/src/lib/pane-manager/terminal-inline-image-options.tssrc/renderer/src/lib/pane-manager/terminal-scroll-intent-key-retention.test.tssrc/shared/default-global-settings.tssrc/shared/global-settings-types.tssrc/shared/terminal-image-protocol.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
|
Visual proof: real PTY output in an Orca folder workspace, captured through Playwright CDP with Disabled: Enabled: This capture covers macOS local rendering. SSH/network-failure and native Windows/Linux rendering were not exercised. Readiness review and resource-limit fixes are in progress. |
There was a problem hiding this comment.
Important
The DA1-authority ordering this PR relies on is only guaranteed once the addon chunk is already resolved. On the first image-enabled pane the addon attaches after Orca's c handler and its own _da1 handler wins, answering \x1b[?62;4;9;22c instead of Orca's \x1b[?1;2;4c. See the inline comment and the section below.
Reviewed changes
- Deferred
@xterm/addon-imageloader — a lazy chunk (terminal-image-addon-loader.ts) with a 3-attempt cap, plus idempotent attach/detach/live-toggle plumbing (pane-inline-images.ts,pane-manager.ts). - DA1 Sixel advertisement —
withSixelDa1Attributeappends;4to Orca's DA1 reply, resolved per query via a newsixelSupportedcallback so a live toggle changes the next response. - New setting —
terminalInlineImages(default on), a Terminal → Inline Images switch, and i18n entries. - Agent hint —
ORCA_IMAGE_PROTOCOL=kittyexported across local/daemon/relay spawn environments and forwarded into WSL viaWSLENV. - Guard + tests — a boot-graph forbidden-payload signature for the addon and unit coverage for the above.
⚠️ Inline-image addon is never primed off the boot path, and the DA1-ordering fix is untested end-to-end
The PR description says the addon is "primed after first paint, only when the setting is on", and terminal-image-addon-loader.ts:7 repeats that claim. It is not. primeTerminalImageAddon is called only from the deferred branch of attachInlineImages, so nothing loads the chunk until the first image-enabled pane opens — and that first attach is always deferred, not synchronous. The WebGL addon gets a void primeTerminalWebglAddon() in main.tsx:85; this addon gets no equivalent, which is what actually enforces the "Orca's DA1 handler is registered after the addon's" ordering the fix depends on.
Separately, none of the new tests activate a real ImageAddon: pane-inline-images.test.ts mocks the module with an activate() that registers no parser handlers, and terminal-capability-replies.test.ts exercises Orca's handler in isolation. So the one behavior that is both load-bearing and order-dependent — Orca's DA1 handler winning over the addon's — is not pinned by any test.
Technical details
# Inline-image addon is not primed off the boot path; DA1 ordering is racy and untested
## Affected sites
- src/renderer/src/lib/pane-manager/terminal-image-addon-loader.ts:7 — comment claims "primed after first paint", but no caller does this
- src/renderer/src/lib/pane-manager/pane-inline-images.ts:37 — the only `primeTerminalImageAddon()` call, inside the deferred branch
- src/renderer/src/main.tsx:85 — primes the WebGL addon only; no image-addon equivalent
- src/renderer/src/lib/pane-manager/pane-inline-images.test.ts:4-16 — mock addon registers no CSI `c` handler, so ordering is never exercised
## Required outcome
- The first image-enabled pane must answer DA1 through Orca's handler (deterministic `\x1b[?1;2;4c`), not the addon's `\x1b[?62;4;9;22c`, regardless of whether the chunk was already loaded.
- A test that activates the real addon (or a faithful mock that registers a DA1 handler) and asserts the final DA1 reply, covering both the pre-primed and deferred paths.
## Suggested approach (optional)
- Prime the addon off the boot path in `main.tsx` (and `web/main.tsx`) like the WebGL addon, so `attachInlineImages` is synchronous for every pane; or
- Register Orca's capability-reply handlers again (or after) the deferred attach so Orca's handler is always last; or
- Disable the addon's DA1 handling if an option for it exists (none is exposed today in `IImageAddonOptions`).
## Open questions for the human (optional)
- Is "answer DA1 with the addon's `\x1b[?62;4;9;22c` on the first pane" acceptable, or does Orca need a stable DA1 identity across all panes?ℹ️ Nitpicks
ORCA_IMAGE_PROTOCOL=kittyis exported unconditionally, even whenterminalInlineImagesis off, so image-capable agents on a disabled client still emit kitty sequences that get silently swallowed (wasted transfer, no garble). The PR documents this as intentional — flagging only so it's a conscious tradeoff, not an oversight.openTerminal's third parameter defaults tofalsewhile the setting defaults totrue; any future caller that forgets the argument silently disables images.- On ConPTY (
da1Response: '\x1b[?61;4c') disabling inline images cannot remove the hardcoded;4, so Windows still advertises Sixel while the addon is detached.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Readiness review/fix loop complete at 65632cbd9b8. Two review rounds, one fix round; both final architecture and reproduction lanes report no remaining proven actionable findings.
Four counsel seats were attempted; three independently agreed on P2 and completed blind peer ratings. Grok could not participate because its weekly limit was exhausted. A later capability-hint concern was rechecked and dropped as actionable: ConPTY's Sixel advertisement predates this PR, and no changed consumer regression from the unconditional environment hint was demonstrated. Validation: 152 tests pass, full typecheck passes, commit lint/React/format hooks pass, and generated source/CJS/ESM/sourcemaps plus lockfile hashes reproduce from the pinned upstream build. Before/after visual proof demonstrates all three protocols and the live toggle through a real PTY in a macOS folder workspace. Residual gaps: native Windows/Linux, SSH/network failure/reconnect, mixed-version mobile rendering, and release-scale RSS/throughput were not exercised live. Delayed addon attachment can change DA1 identity; replay suppression still holds and no affected consumer was found. No persisted-state migration or stream opcode was introduced. No remaining proven issue requires a release-blocking action; broader live topology validation remains advisable. |
|
Pushed in Follow-up: real SSH + paired runtime validation and image-memory fixes.
Known boundary: terminal snapshots do not preserve prior images. Fresh remote image output after reconnection is verified; restoring all historical images is not part of this change. First lazy addon load can also precede parser attachment; boot-time priming as in #19201 is a useful follow-up, not a guarantee by itself. Cross-reference #19201: same addon/feature, so these implementations should not be merged independently. Its September 7 force-push ( Paired runtime after host restart: Measured 12-terminal cycles: retained decoder capacity 102,236,160 bytes while loaded, zero after reset. After the second close cycle: JS heap 39,244,460 bytes (baseline 30,383,976), backing storage 10,374,183 bytes (baseline 10,170,640). All 24 created terminal managers were released. Font zoom also renders without retaining a full enlarged bitmap. Final protocol regression: evicting an unfinished upload without an image ID no longer injects an unsolicited Validation: 24 focused tests, three real Electron scenarios, additional zoom/memory rerun, full application typecheck, changed-code quality gate, and pinned xterm patch reproduction all passed. |
There was a problem hiding this comment.
ℹ️ No critical issues — the memory-bounding patch is sound for its primary goal, with two minor rough edges inline.
Reviewed changes
- Bounded Kitty upload memory — a pnpm-applied source patch caps pending Kitty decoders by count (evicting the oldest and answering
ENOMEM) and byte-evicts encoded blobs inKittyImageStorage. - Classified Kitty acknowledgements —
terminal-query-reply.tsnow routes\x1b_Gi=…;OK|E…:…\x1b\\down the immediate query-reply path so image acks bypass remote input debounce. - Added a memory-contract test —
xterm-image-memory-contract.test.mjsexercises the installed bundle with abandoned uploads, chunk continuation, and FIFO eviction. - Wired the patch into the build —
xterm-upstream.jsonsource-patch entry,pnpmpatch hash, workspacepatchedDependencies, and regeneration docs.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No new issues in this commit — the decode/cleanup hardening is sound and well-tested. The earlier DA1-ordering and Kitty memory-patch findings are unchanged by this delta and remain open.
Reviewed changes
- Bounded decompression —
_decompressnow streams throughDecompressionStreamand rejects output beyondmin(kittySizeLimit, pixelLimit*4, storageLimit*1e6), closing the decompression-bomb vector. - Cancelled stale async decodes — generation counters in
IIPHandlerandKittyGraphicsHandlerclose bitmaps that finish afterreset()/dispose(). - Validated PNG dimensions —
imageType()rejects oversize/invalid PNGs before nativecreateImageBitmap. - Released handler resources on dispose —
ImageAddon.dispose()resets every handler, and the placeholder bitmap is closed when replaced. - Fixed scaled rendering —
ImageRenderertiles fromactualCellSizeand skips full-enlarged zoom canvases. - Guarded the eviction reply —
ENOMEMis now sent only when the evicted upload carried an id. - Added contract and e2e coverage — lifecycle/resize/memory contract tests plus memory, paired-runtime-restart, and SSH drop/stall/flood e2e specs.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 9e2e3d12-d44f-4841-a1e7-dd5670635e09
📥 Commits
Reviewing files that changed from the base of the PR and between b47ed52f4ece76837cd4de17eeb359d31915202f and 8dacbb23f70cea6d6c575b08f8ccdc9e0972bcae.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (20)
config/patches/@[email protected]config/patches/xterm-src/@[email protected]config/patches/xterm-upstream.jsonconfig/scripts/xterm-image-lifecycle-contract.test.mjsconfig/scripts/xterm-image-memory-contract.test.mjsconfig/scripts/xterm-image-resize-contract.test.mjsdocs/reference/xterm-patch-regeneration.mdpnpm-workspace.yamlsrc/renderer/src/components/settings/TerminalRenderingSection.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/pane-manager/pane-inline-images.test.tssrc/renderer/src/lib/pane-manager/pane-inline-images.tssrc/renderer/src/lib/pane-manager/terminal-image-addon-loader.tssrc/renderer/src/lib/pane-manager/terminal-inline-image-options.tssrc/shared/terminal-query-reply.test.tssrc/shared/terminal-query-reply.tstests/e2e/helpers/terminal-inline-image-proof.tstests/e2e/terminal-inline-images-memory.spec.tstests/e2e/terminal-inline-images-paired-runtime.spec.tstests/e2e/terminal-inline-images-ssh.spec.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- src/renderer/src/lib/pane-manager/pane-inline-images.ts
- src/renderer/src/lib/pane-manager/terminal-image-addon-loader.ts
- src/renderer/src/components/settings/TerminalRenderingSection.tsx
- src/renderer/src/i18n/locales/en.json
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
8dacbb2 to
d95e978
Compare
|
Rebased onto Addressed review feedback in
The two lower-storage-budget comments concern configurations Orca does not expose: its fixed 32 MB storage budget exceeds both the 8 MiB sequence limit and one decoder's reserved capacity. No unsupported configuration mode was added to this feature. Validation: 81 focused tests, full application typecheck, changed-code quality checks, frozen install, and pinned xterm patch reproduction pass. Rebuilt Electron/CLI/relay against current main and reran real SSH drop/stall/zoom and paired-host restart rendering checks. |
d95e978 to
2ff3fc5
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 9ccd1ae5-b0f3-4b7c-a5a4-e5f1bed91365
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (65)
config/patches/@[email protected]config/patches/xterm-src/@[email protected]config/patches/xterm-upstream.jsonconfig/scripts/renderer-boot-graph.mjsconfig/scripts/xterm-image-lifecycle-contract.test.mjsconfig/scripts/xterm-image-memory-contract.test.mjsconfig/scripts/xterm-image-resize-contract.test.mjsdocs/reference/xterm-patch-regeneration.mdpackage.jsonpnpm-workspace.yamlsrc/main/daemon/pty-subprocess/spawn-environment.tssrc/main/ipc/pty-spawn-env-terminal-basics.test.tssrc/main/providers/local-pty-spawn-environment.tssrc/main/pty/wsl-orca-env.test.tssrc/main/pty/wsl-orca-env.tssrc/relay/pty-handler-spawn-environment.test.tssrc/relay/pty-handler.tssrc/renderer/src/components/settings/TerminalRenderingSection.tsxsrc/renderer/src/components/settings/setting-labels.tssrc/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.tssrc/renderer/src/components/terminal-pane/terminal-appearance.test.tssrc/renderer/src/components/terminal-pane/terminal-appearance.tssrc/renderer/src/components/terminal-pane/terminal-capability-replies.test.tssrc/renderer/src/components/terminal-pane/terminal-capability-replies.tssrc/renderer/src/components/terminal-pane/terminal-cursor-inactive-style.test.tssrc/renderer/src/components/terminal-pane/terminal-inline-image-da1.test.tssrc/renderer/src/components/terminal-pane/terminal-pane-manager-options.tssrc/renderer/src/components/terminal-pane/terminal-view-attributes-publisher.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/pane-manager/pane-container-listener-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-dom-creation.tssrc/renderer/src/lib/pane-manager/pane-drag-reorder.test.tssrc/renderer/src/lib/pane-manager/pane-drop-no-op.test.tssrc/renderer/src/lib/pane-manager/pane-fit-resize-observer.test.tssrc/renderer/src/lib/pane-manager/pane-initial-fit-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-inline-images.test.tssrc/renderer/src/lib/pane-manager/pane-inline-images.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.tssrc/renderer/src/lib/pane-manager/pane-manager-pane-creation.tssrc/renderer/src/lib/pane-manager/pane-manager-types.tssrc/renderer/src/lib/pane-manager/pane-manager.tssrc/renderer/src/lib/pane-manager/pane-reveal-repaint.test.tssrc/renderer/src/lib/pane-manager/pane-split-close.test.tssrc/renderer/src/lib/pane-manager/pane-split-close.tssrc/renderer/src/lib/pane-manager/pane-split-scroll.test.tssrc/renderer/src/lib/pane-manager/pane-terminal-gpu-acceleration.test.tssrc/renderer/src/lib/pane-manager/pane-tree-ops.test.tssrc/renderer/src/lib/pane-manager/pane-tree-reparent-frame.test.tssrc/renderer/src/lib/pane-manager/pane-webgl-context-recovery.test.tssrc/renderer/src/lib/pane-manager/pane-webgl-refresh-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-webgl-renderer.test.tssrc/renderer/src/lib/pane-manager/terminal-da1-ownership.tssrc/renderer/src/lib/pane-manager/terminal-image-addon-loader.tssrc/renderer/src/lib/pane-manager/terminal-inline-image-options.tssrc/renderer/src/lib/pane-manager/terminal-scroll-intent-key-retention.test.tssrc/shared/default-global-settings.tssrc/shared/global-settings-types.tssrc/shared/terminal-image-protocol.tssrc/shared/terminal-query-reply.test.tssrc/shared/terminal-query-reply.tstests/e2e/helpers/terminal-inline-image-proof.tstests/e2e/terminal-inline-images-memory.spec.tstests/e2e/terminal-inline-images-paired-runtime.spec.tstests/e2e/terminal-inline-images-ssh.spec.ts
🚧 Files skipped from review as they are similar to previous changes (55)
- src/renderer/src/lib/pane-manager/pane-container-listener-lifecycle.test.ts
- src/renderer/src/lib/pane-manager/pane-split-close.test.ts
- src/renderer/src/lib/pane-manager/pane-webgl-renderer.test.ts
- src/renderer/src/components/settings/setting-labels.ts
- src/renderer/src/lib/pane-manager/terminal-scroll-intent-key-retention.test.ts
- src/renderer/src/lib/pane-manager/pane-dom-creation.ts
- src/shared/default-global-settings.ts
- src/renderer/src/components/terminal-pane/terminal-pane-manager-options.ts
- config/scripts/renderer-boot-graph.mjs
- src/renderer/src/lib/pane-manager/terminal-inline-image-options.ts
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/lib/pane-manager/pane-fit-resize-observer.test.ts
- src/main/daemon/pty-subprocess/spawn-environment.ts
- src/shared/terminal-query-reply.test.ts
- src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts
- pnpm-workspace.yaml
- src/renderer/src/lib/pane-manager/pane-tree-ops.test.ts
- package.json
- src/main/pty/wsl-orca-env.ts
- src/renderer/src/lib/pane-manager/pane-split-scroll.test.ts
- src/renderer/src/lib/pane-manager/pane-manager-pane-creation.ts
- src/renderer/src/components/terminal-pane/terminal-appearance.ts
- src/renderer/src/components/terminal-pane/terminal-capability-replies.ts
- src/renderer/src/lib/pane-manager/pane-reveal-repaint.test.ts
- src/shared/terminal-query-reply.ts
- src/main/providers/local-pty-spawn-environment.ts
- src/renderer/src/lib/pane-manager/pane-drop-no-op.test.ts
- config/scripts/xterm-image-resize-contract.test.mjs
- src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
- src/renderer/src/lib/pane-manager/pane-split-close.ts
- src/renderer/src/lib/pane-manager/pane-lifecycle.ts
- src/renderer/src/lib/pane-manager/pane-manager-types.ts
- src/renderer/src/lib/pane-manager/pane-tree-reparent-frame.test.ts
- src/main/pty/wsl-orca-env.test.ts
- src/renderer/src/lib/pane-manager/pane-manager.ts
- config/patches/xterm-upstream.json
- src/renderer/src/components/settings/TerminalRenderingSection.tsx
- src/renderer/src/lib/pane-manager/pane-terminal-gpu-acceleration.test.ts
- src/shared/terminal-image-protocol.ts
- tests/e2e/helpers/terminal-inline-image-proof.ts
- src/renderer/src/lib/pane-manager/pane-inline-images.ts
- config/scripts/xterm-image-lifecycle-contract.test.mjs
- src/shared/global-settings-types.ts
- src/renderer/src/lib/pane-manager/pane-initial-fit-lifecycle.test.ts
- tests/e2e/terminal-inline-images-memory.spec.ts
- src/relay/pty-handler.ts
- src/main/ipc/pty-spawn-env-terminal-basics.test.ts
- src/renderer/src/lib/pane-manager/terminal-image-addon-loader.ts
- src/renderer/src/lib/pane-manager/pane-webgl-context-recovery.test.ts
- tests/e2e/terminal-inline-images-paired-runtime.spec.ts
- src/renderer/src/lib/pane-manager/pane-drag-reorder.test.ts
- src/renderer/src/components/terminal-pane/terminal-capability-replies.test.ts
- src/renderer/src/lib/pane-manager/pane-webgl-refresh-lifecycle.test.ts
- tests/e2e/terminal-inline-images-ssh.spec.ts
- config/patches/xterm-src/@[email protected]
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- DA1 authority re-registration — new
terminal-da1-ownership.ts(registerTerminalDa1Owner/refreshTerminalDa1Owner) stores a per-terminal refresh andattachInlineImagesre-registers Orca'schandler after the addon attaches, so Orca's\x1b[?1;2;4cwins on the first image-enabled pane instead of the addon's\x1b[?62;4;9;22c. - Sixel gated on real attachment —
terminalRendersInlineImages(aWeakSet<Terminal>) makessixelSupportedreport true only once the addon is actually attached, not while its chunk loads or after it fails. - End-to-end DA1 test —
terminal-inline-image-da1.test.tsactivates a real addon on bothprimedanddeferredpaths and asserts the final reply, pinning the previously-untested ordering. - Kitty eviction rework —
KittyImageStorage.storeImagenow evicts unplaced payloads before displayed ones and always stores the incoming image, eliminating both the false-OK-after-drop and visible-image-eviction rough edges. - PNG dimension sign fix —
imageType()dimensions now require> 0, closing the signed-shift bypass where IHDR widths ≥0x80000000read negative and passed the pixel-limit check. - Loader-drain hardening — per-pane try/catch in the deferred
onLoadeddrain so one failed attach does not strand the rest. - Unified setting read —
resolveTerminalInlineImagesEnabled()replaces the mixed?? true/!== falsecall sites.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Shared lazy addon loader — new
terminal-lazy-addon-loader.ts(createLazyXtermAddonLoader) memoizes the dynamic import, exposes the resolved constructor synchronously to later panes, and adds anonFailedlatch plus arearmrecovery boundary. - Image loader delegation —
terminal-image-addon-loader.tsnow routesprime/getConstructor/setHandlersthrough the shared loader;primeTerminalImageAddonkeeps its 3-attempt cap and clears the memo on error so a later pane can retry. - WebGL loader delegation —
terminal-webgl-addon-loader.tsdrops its duplicate inline memo/attempt logic and uses the shared loader, preservingsetTerminalWebglAddonLoadHandlers/primeTerminalWebglAddon/rearmTerminalWebglAddonLoadwith the same exported surface.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Named addon flags —
openTerminalreplaces its two adjacent optional positional booleans with a named{ ligatures, inlineImages }options object, removing the silent-swap footgun flagged in earlier feedback; both callers (pane-manager-pane-creation.ts,pane-split-close.ts) and the wiring test were updated. - Pinned image limits — the addon-options test now asserts the exact
pixelLimit(8_000_000) andiipSizeLimit/kittySizeLimit(8 * 1024 * 1024) values instead of the looser formula-derived check.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
config/patches/xterm-src/@[email protected] (1)
175-193: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winReject uploads that exceed the storage budget
With
storageLimit: 0.5and the defaultkittySizeLimit: 33554432,decoderCapacityis about 44.9 MB. TheMath.max(1, ...)call still permits one unfinishedBase64Decoder, whose initial buffer alone is 4 MB. Reject the transmission before allocation when the decoder capacity exceeds the effective storage budget.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: bb6ec7f9-7907-4e75-9cd1-7c3bae74a67c
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (24)
config/patches/@[email protected]config/patches/xterm-src/@[email protected]config/scripts/run-ssh-docker-e2e.mjssrc/renderer/src/components/settings/TerminalRenderingSection.tsxsrc/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.tssrc/renderer/src/components/terminal-pane/terminal-appearance.tssrc/renderer/src/components/terminal-pane/terminal-inline-image-da1.test.tssrc/renderer/src/components/terminal-pane/terminal-pane-manager-options.tssrc/renderer/src/i18n/en-runtime-required.jsonsrc/renderer/src/lib/pane-manager/pane-inline-images.test.tssrc/renderer/src/lib/pane-manager/pane-inline-images.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.tssrc/renderer/src/lib/pane-manager/pane-manager-pane-creation.tssrc/renderer/src/lib/pane-manager/pane-split-close.tssrc/renderer/src/lib/pane-manager/terminal-da1-ownership.tssrc/renderer/src/lib/pane-manager/terminal-image-addon-loader.tssrc/renderer/src/lib/pane-manager/terminal-inline-image-options.tssrc/renderer/src/lib/pane-manager/terminal-lazy-addon-loader.tssrc/renderer/src/lib/pane-manager/terminal-webgl-addon-loader.tssrc/shared/terminal-inline-images-settings.tstests/e2e/helpers/terminal-inline-image-proof.tstests/e2e/terminal-inline-images-memory.spec.tstests/e2e/terminal-inline-images-ssh.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/lib/pane-manager/terminal-inline-image-options.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
|
Re-reviewed the pushed updates at 28a175a against the readiness checklist, including affected appearance/WebGL consumers. No new runtime defect proven; this is not an OOM guarantee or a complete platform/network certification. Fresh validation:
The other agent caught real gaps in my previous review: DA1 ordering was tested without enforcing actual decoder readiness; byte caps were checked without preserving visible images ahead of unused uploads; PNG tests missed signed parser boundaries; affected appearance mocks and SSH CI ownership were omitted; zoom/backing-storage assertions and test ordering were too weak. My earlier completion language was broader than that evidence justified. Shared loader/named flags are useful refactors. The commit's null-setting rationale is inaccurate for boolean/null/undefined ( Memory remains additive across panes, with transient/native/GPU allocations outside simple pool accounting. Neither 32 MB nor the approximate 98 MB comment is a total-memory ceiling. Windows/WSL/Windows SSH, mobile, physical sleep/DNS faults, and a long-duration saturation soak were not exercised here. Historical images still are not serialized/replayed. Fresh rendered proof after SSH recovery, flooding/reset, and font zoom (IIP red, Sixel green, Kitty blue): |
28a175a to
3c376f9
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Preserve the forced image protocol after deletions. · pty-handler.ts:820-843
src/relay/pty-handler.ts:820-843
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPreserve the forced image protocol after deletions.
sanitizeEnvToDeleteacceptsORCA_IMAGE_PROTOCOL, andpty.spawnpasses it tobuildSpawnEnv. The deletion loop can therefore remove the forcedkittyvalue. Image-capable tools may miss the relay’s protocol hint and not enable the expected encoder.Move the
ORCA_IMAGE_PROTOCOLassignment after the deletion loop.buildSpawnEnvowns the final environment for both spawn and revive.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 09762c27-7269-4ece-8daf-98b9a40cbb34
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
config/scripts/run-ssh-docker-e2e.mjspackage.jsonpnpm-workspace.yamlsrc/relay/pty-handler-spawn-environment.test.tssrc/relay/pty-handler.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/pane-manager/pane-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-manager-types.tssrc/shared/default-global-settings.tssrc/shared/global-settings-types.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/i18n/locales/en.json
- pnpm-workspace.yaml
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
|
Rebased and pushed the PR onto current
One provider failure is unrelated to this PR: Windows packaging fails while installing the current The memory caveat remains: image allocations are bounded per pane and cleaned up on reset/close, but there is no process-wide cross-pane governor or absolute RSS/OOM guarantee. |
7705143 to
b90a864
Compare
|
Rebased again onto the latest
The feature remains bounded per pane with reset/close cleanup proof. It does not provide a process-wide image-memory governor or absolute RSS/OOM guarantee; that remains a documented residual risk rather than an unproven release blocker. |
|
Data point from a now-closed duplicate (#21430), in case it helps: verified on macOS arm64 (WebGL renderer) that oh-my-pi running inside Orca with |
b90a864 to
280b4df
Compare
|
Rebased onto the latest Local verification after the rebase:
The fresh PR Checks and computer-use E2E workflows are queued/running for the rebased head. |
280b4df to
e71ad7d
Compare
|
Post-rebase verification:
The previous run was left untouched while active; a fresh CI cycle is now running for this final rebased head. |
…limits Two adjacent optional booleans could be swapped without a type error once inline images added the second one.
…ring dependency storageLimit:32 reads like the pane's budget but keys three pools — decoded pixels, retained encoded Kitty blobs, and pending WASM decoders — so the worst case is ~98 MB per pane with no cross-pane governor. Say so at the constant. pane-inline-images.test.ts's deferred case needed to run first; it now takes a fresh module instead, and the rest prime in beforeAll. Verified by running the file with that test moved last.
4f7aa92 to
17a7868
Compare
## Summary Treat `TERM_PROGRAM=Orca` as Kitty-image capable in `pi-tui`'s terminal capability detection, so image components render inline instead of falling back to text when running inside Orca. - Recognize Orca as supporting Kitty inline images, true color, and OSC 8 hyperlinks. - Preserve the existing tmux and screen precedence guards. - Gate images on Orca's capability advertisement: require both `TERM_PROGRAM=Orca` and Orca's `ORCA_IMAGE_PROTOCOL=kitty` signal before enabling Kitty output, so existing Orca releases that do not yet advertise image support safely keep the text fallback. - Add a regression test and the package/CLI changesets. ## Related - Requested by maintainer approval in [#7357](#7357) (lgtm). - Depends on the Orca-side capability advertisement, which has landed: [stablyai/orca#19512](stablyai/orca#19512) (merged 2026-09-18, `09073086a8`) exports `ORCA_IMAGE_PROTOCOL=kitty` on the daemon, local, and relay PTY paths, and forwards it across the WSL boundary. Supersedes [stablyai/orca#11706](stablyai/orca#11706), which was closed in favor of #19512. ## Testing - `pnpm --filter @moonshot-ai/pi-tui test` — focused regression suite passes. - `pnpm --filter @moonshot-ai/pi-tui typecheck` — passes.
…s#9329) ## Summary Treat `TERM_PROGRAM=Orca` as Kitty-image capable in `pi-tui`'s terminal capability detection, so image components render inline instead of falling back to text when running inside Orca. - Recognize Orca as supporting Kitty inline images, true color, and OSC 8 hyperlinks. - Preserve the existing tmux and screen precedence guards. - Gate images on Orca's capability advertisement: require both `TERM_PROGRAM=Orca` and Orca's `ORCA_IMAGE_PROTOCOL=kitty` signal before enabling Kitty output, so existing Orca releases that do not yet advertise image support safely keep the text fallback. - Add a regression test and the package/CLI changesets. ## Related - Requested by maintainer approval in [earendil-works#7357](earendil-works#7357) (lgtm). - Depends on the Orca-side capability advertisement, which has landed: [stablyai/orca#19512](stablyai/orca#19512) (merged 2026-09-18, `09073086a8`) exports `ORCA_IMAGE_PROTOCOL=kitty` on the daemon, local, and relay PTY paths, and forwards it across the WSL boundary. Supersedes [stablyai/orca#11706](stablyai/orca#11706), which was closed in favor of #19512. ## Testing - `pnpm --filter @moonshot-ai/pi-tui test` — focused regression suite passes. - `pnpm --filter @moonshot-ai/pi-tui typecheck` — passes. (cherry picked from commit f09d01b)
…endil-works/pi#9329) ## Summary Treat `TERM_PROGRAM=Orca` as Kitty-image capable in `pi-tui`'s terminal capability detection, so image components render inline instead of falling back to text when running inside Orca. - Recognize Orca as supporting Kitty inline images, true color, and OSC 8 hyperlinks. - Preserve the existing tmux and screen precedence guards. - Gate images on Orca's capability advertisement: require both `TERM_PROGRAM=Orca` and Orca's `ORCA_IMAGE_PROTOCOL=kitty` signal before enabling Kitty output, so existing Orca releases that do not yet advertise image support safely keep the text fallback. - Add a regression test and the package/CLI changesets. ## Related - Requested by maintainer approval in [earendil-works/pi#7357](earendil-works/pi#7357) (lgtm). - Depends on the Orca-side capability advertisement, which has landed: [stablyai/orca#19512](stablyai/orca#19512) (merged 2026-09-18, `09073086a8`) exports `ORCA_IMAGE_PROTOCOL=kitty` on the daemon, local, and relay PTY paths, and forwards it across the WSL boundary. Supersedes [stablyai/orca#11706](stablyai/orca#11706), which was closed in favor of badlogic/pi-mono#19512. ## Testing - `pnpm --filter @moonshot-ai/pi-tui test` — focused regression suite passes. - `pnpm --filter @moonshot-ai/pi-tui typecheck` — passes. (cherry picked from commit f09d01b85e0384647fcab6779d35ab9dabe04be3) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s#9329) ## Summary Treat `TERM_PROGRAM=Orca` as Kitty-image capable in `pi-tui`'s terminal capability detection, so image components render inline instead of falling back to text when running inside Orca. - Recognize Orca as supporting Kitty inline images, true color, and OSC 8 hyperlinks. - Preserve the existing tmux and screen precedence guards. - Gate images on Orca's capability advertisement: require both `TERM_PROGRAM=Orca` and Orca's `ORCA_IMAGE_PROTOCOL=kitty` signal before enabling Kitty output, so existing Orca releases that do not yet advertise image support safely keep the text fallback. - Add a regression test and the package/CLI changesets. ## Related - Requested by maintainer approval in [earendil-works#7357](earendil-works#7357) (lgtm). - Depends on the Orca-side capability advertisement, which has landed: [stablyai/orca#19512](stablyai/orca#19512) (merged 2026-09-18, `09073086a8`) exports `ORCA_IMAGE_PROTOCOL=kitty` on the daemon, local, and relay PTY paths, and forwards it across the WSL boundary. Supersedes [stablyai/orca#11706](stablyai/orca#11706), which was closed in favor of #19512. ## Testing - `pnpm --filter @moonshot-ai/pi-tui test` — focused regression suite passes. - `pnpm --filter @moonshot-ai/pi-tui typecheck` — passes.






What changed
Adds inline terminal images through the pinned
@xterm/addon-imageintegration: SIXEL, iTerm2 IIP, and Kitty graphics. Terminal → Inline Images is enabled by default and can be toggled on a running pane. The addon is dynamically imported for enabled panes after renderer startup, keeping decoder code out of the static boot graph; idle panes allocate no decoded-image buffers.Image bytes use the existing PTY stream, so local shells, daemon terminals, relay/SSH terminals, and WSL keep the same execution path. When enabled, Orca advertises SIXEL in DA1 and exports
ORCA_IMAGE_PROTOCOL=kittyas an encoder hint. The hint is forwarded across the WSL boundary and does not add image support to older clients.Resource limits and review fixes
Why the pinned xterm patch is required
The upstream addon exposes image-size and cache options, but no public hooks to bound every memory path that matters for a long-lived terminal. An unfinished Kitty upload can retain a WASM decoder at its maximum capacity; compressed input can inflate before output budgeting; reset or disposal can race an asynchronous bitmap decode; and font zoom can create a full enlarged image copy. Kitty payloads waiting for placement also sit outside the decoded-image cache.
The Orca-local source patch adds those missing guardrails: a pending-decoder governor with an allocation-before-admission check, chunked decompression with an output limit, generation fencing and disposal cleanup for async bitmaps, byte-based Kitty payload eviction, PNG dimension validation, and zoom-time visible-tile scaling. The generated addon bundle is patched from the same source so shipped code and tests stay reproducible. This is deliberately an integration safety patch around addon internals, not a new wire protocol. It must be revalidated when the pinned addon version changes.
The accounting is per pane: 32 MB decoded storage, up to 32 MB retained encoded Kitty payloads, and one active plus up to two pending decoder capacities, plus transient browser buffers. It bounds the feature's known pools but is not a process-wide RSS or absolute OOM guarantee.
Validation
17a7868c088b005425f00dc958f9bc6e15b16fb2.openclaw(Linux 7.0.0-30-generic x86_64) to create a disposable remote worktree, run a real PTY, and send an inline Kitty frame through the stream; the worktree was removed afterward.openclaw; saved Windows environmentsawinandwin-lowspec; saved macOS environmentm4air. The live pixel proof is macOS, while remote-host transport coverage is Linux SSH. Windows/Linux renderer pixel proof and release-scale RSS/throughput remain CI/release validation gaps.The image feature is user-toggleable per pane, including live disable/re-enable; disabling also removes SIXEL capability advertisement and prevents image decoding. This follows the established terminal-emulator pattern of making image support opt-in or configurable because image protocols carry decoder and cache cost.
No persisted image-state migration or new stream opcode was added. Historical images are not serialized in remote snapshots and are not promised to survive terminal serialization/recreation.
Cross-reference
PR #19201 overlaps this addon integration. Its later force-push rebased existing commits with xterm patch/lockfile updates; it does not remove the need for one coordinated loader/addon. This PR keeps the addon off the boot path and retains the snapshot caveat.
Credits
Built from first principles and cross-checked against related community work:
ORCA_IMAGE_PROTOCOLagent-hint environment approach.@xterm/addon-imageroute.