You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(terminal): recover Kitty Unicode images after eviction and renderer reload - #33120
An image printed once by a terminal program should still be visible after Orca reloads. This restores Kitty Unicode-placeholder images from a bounded local cache without asking the running program to send them again.
What Changed
Retain Kitty Unicode virtual-placement metadata independently of decoded pixels and restore visible placements lazily after eviction, alternate-buffer disposal or renderer reload.
Persist validated snapshots by host-qualified PTY/pane, with 128 MiB overall, 32 MiB per pane, 1,024 records, seven-day retention and bounded restore/retry work.
Commit changed-key invalidations before image writes; preserve bounded failed-read barriers and reject stale in-flight results. Reuse the existing hide pass so image-free renders do not scan cells twice.
Update source/generated addon patches and focused regressions. Inherited SIXEL/iTerm2 sections are preserved; this adds no physical Kitty/SIXEL/iTerm2 replay, scaling or Claude-specific behavior.
Why
The terminal text snapshot contains placeholder cells, but those cells cannot reconstruct the image bytes. Keeping only decoded pixels in memory also makes eviction destructive. Retaining bounded encoded data and restoring only visible prototypes addresses both cases without retaining every decoded bitmap. Requiring PTY retransmission would add a replay dependency to every terminal program; the local cache lets renderer recovery work without that cooperation.
Related: #23547, #30383, #32714. HiDPI scaling remains separate from this change and from #30349.
Visual Proof
Feature illustration from earlier source builds; these images are not current-SHA validation evidence. Current hidden-CDP results are listed under Testing.
Testing
Unchanged exact146f standalone: four image files, 65 passed under each entry. The valid native before/after control deliberately aborts a Chromium IndexedDB transaction; actual quota exhaustion and a historical user-crash reproduction were not performed.
Exact combined source validation and retained evidence limits
Exact private combination d7dcaad8c922ac7112f192589556f7c19145b1a4 contains image 146f572, rich output a4aa01b and fixtures 3b65d5f on main 4cd62c4. Executed on macOS with Node 24.22.1 and default Bun 1.4.4.
128 related root files: 1723 passed/7 inherited conditional skip per entry; four mobile files: 77 passed. Frozen root/mobile/cloud preparation and all 16 integration commands passed, including full typecheck/lint/quality, fresh mobile-web/CLI/orcad/E2E builds, and the required five-fixture-file changed gate.
The configured official Claude Code 2.1.309 passed 207 renderer/plugin checks at this exact private SHA, separate from the related-root counts. 5 hidden Electron cases passed; all 14 fresh CDP PNGs were personally inspected and hashed. The selected owned CLI binary/version is recorded separately.
Recorded commands: pnpm tc; pnpm lint --maxWorkers=2; pnpm run test:claude-rich-output; hidden Playwright settings/image-reload specs with --project electron-headless --workers=1 --retries=0. Private delta gate: pnpm check:changed --base=b1e09c5696fa4e7221aa5fd7e19d7cb9b202e886 --maxWorkers=2 (20 checks passed, internal composition base). Public standalone reproduction commands are listed above; the earlier failed 75b9 run remains failed.
This is related/affected validation using current main's test set, including its upstream case retirements/renames. Earlier complete, failed and partial runs retain their own SHA/platform attribution.
Manual interactive desktop testing, hosted CI, native Windows/Linux execution and installer validation remain unperformed; hidden checks were automated through CDP.
AI Disclosure
AI-assisted implementation and automated validation using OpenAI Codex. The author requested these contributions.
Review
Exact published head: 146f57277ba9919e0ec71e69ffa8569c5ad8a4e6. The exact146f full AI review finished, selecting all 12 eligible files; the existing filter excludes the lockfile. No new actionable finding; the cache-invalidation thread is resolved.
Hosted workflows: PR Checks: completed/action_required, 0 jobs. Bot/local success does not replace maintainer workflow authorization or human approval.
Agent skill upstream boundary
Not applicable: no upstream skill-installer code or data is copied.
Notes
Independent test-fixture fixes are now in #33348. The existing SixelHandler, IIPHandler, ImageRenderer and ImageAddon sections of the checked-in source patch are byte-identical to synchronized upstream db8fc6d0cc; this PR preserves those inherited hunks and does not add SIXEL/iTerm2 recovery behavior.
This is a best-effort cache, not permanent transcript storage. Clearing application site data removes the cached images. Cache quota and IndexedDB failure preserve live rendering but can prevent subsequent recovery.
Checklist
Explained final scope, user impact, mechanism and motivation.
Automated tests added/updated; focused, static and source-build checks completed as listed.
Reviewed correctness, process/cache ownership, cross-platform and remote compatibility limits.
Upstream CI authorization/execution and native Windows/Linux installer validation.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Walkthrough
The image addon adds bounded recovery for Kitty Unicode-placeholder images. It retains placement metadata separately from decoded pixels and can restore cached image snapshots after eviction or renderer reloads. The renderer cache uses terminal scopes and IndexedDB retention limits. The Kitty handler validates recovery results and guards against stale asynchronous decodes. The patch also updates image decoding and rendering behavior. Tests cover recovery, cache behavior, and visibility across reloads.
Priority: Normal
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 146f5
The change adds a bounded local cache so Kitty Unicode-placeholder images can reappear after eviction or a renderer reload. The earlier concerns about failed cache writes exposing stale images and about extra per-render scanning are addressed at the current head. No concrete merge-blocking risk remains in the reviewed code; hosted CI and maintainer approval are still pending.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: recovering Kitty Unicode images after eviction and renderer reload.
Linked Issues check
Active direct issue [#33118] requires recovery of Kitty Unicode-placeholder images without PTY retransmission. The changes retain virtual-placement metadata independently of decoded pixels, restore vi…
Out of Scope Changes check
The changes remain within [#33118]. Cache scope wiring, IndexedDB persistence, addon patch updates, lifecycle handling, and focused tests support Kitty Unicode-placeholder recovery. The stated scope e…
Description check
The pull request description follows the required template and clearly explains the user impact, implementation, motivation, linked issue, visual proof, testing, AI use, review status, scope boundarie…
Full details: Linked Issues check
Explanation
Active direct issue [#33118] requires recovery of Kitty Unicode-placeholder images without PTY retransmission. The changes retain virtual-placement metadata independently of decoded pixels, restore visible placements lazily, and persist validated image snapshots in IndexedDB by host-qualified PTY and pane. The implementation applies size, count, age, concurrency, and retry limits. It handles deletion, ID reuse, resets, failed writes, and stale asynchronous reads. Focused unit, contract, lifecycle, and end-to-end tests cover reload, eviction, alternate-buffer disposal, and stale-result prevention.
Full details: Out of Scope Changes check
Explanation
The changes remain within [#33118]. Cache scope wiring, IndexedDB persistence, addon patch updates, lifecycle handling, and focused tests support Kitty Unicode-placeholder recovery. The stated scope excludes physical Kitty replay, Sixel, iTerm2 replay, HiDPI scaling, and Claude-specific behavior. The existing Sixel and IIP sections are preserved inherited patch content and do not establish new recovery behavior.
Full details: Description check
Explanation
The pull request description follows the required template and clearly explains the user impact, implementation, motivation, linked issue, visual proof, testing, AI use, review status, scope boundaries, limitations, and checklist. It also documents unperformed hosted CI authorization and native Windows/Linux validation.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Current published head for #33120: 146f57277ba9919e0ec71e69ffa8569c5ad8a4e6 (OPEN/Ready). Image code/head is unchanged this round; earlier image validation keeps its original attribution.
The independent current heads are image 146f57277ba9919e0ec71e69ffa8569c5ad8a4e6, rich aa40e7e5d1deca36c20d7d1716dd46e32f20569f and fixtures f6d31efa6e50315b6582cb81b6c3a6e284a1de80. Actual-main dcbfc42c1d81953392ac975437abb98ad5a11007 read-only merges are clean, with13/100/29 paths and zero fixture/feature overlap. No newer-main runtime build, whole inventory or native Windows/Linux execution is claimed; prior private/UI/native evidence retains its recorded SHA/runtime.
Hosted action_required runs have zero jobs and still need maintainer workflow authorization. They are not running or failed tests; there are no failed jobs to rerun. Exact-SHA AI review and non-author human maintainer approval remain separate. This updates the existing request for material published evidence; it creates no duplicate authorization request.
This PR is now ready for review. Please review the complete updated diff at current head 12f808955f1f950a2e2962c1543fd6e70e968519, including the repeated-eviction recovery fix. The previous actionable finding has been addressed; validation limits remain documented in the PR description.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Please review the follow-up changes at current head 6ae1825f87b65b582ad4bbddd7b09fc22495b34c. The identified findings have been fixed with regressions and the targeted checks pass. The PR remains Ready for review, with full-repository validation limitations documented separately.
Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Please review the test-fixture follow-up at fcb934ab2047738408143e80d9f0347d34dae026. Assertions and deadlines are unchanged: wait for editor readiness, use serve-sim's public export, and construct the same real Git history with commit/tree objects. All 14 fixture assertions, full typecheck/lint/changed-code quality, the current source build and the hidden Electron three-reload/no-retransmission scenario pass. The complete Node run is queued behind #33131 to avoid fixture contention; its test environment and current limits are disclosed in the PR description.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
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: 91c7a420-0534-4d89-be5b-c58c0650023b
Commits
Reviewing files that changed from the base of the PR and between fcb934a and 0b02d77.
Files selected for processing: 1
config/scripts/zcode-credential-workflow.test.mjs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Please review the full current changeset at 4029abb4773fbd7876fed3f7fd337463c83d9985. Both follow-up identity findings have been addressed with before/after regression evidence, and their threads are resolved. The current complete Node test run is in progress with isolated, zero-retry CI options; its limits are disclosed in the PR description. Please attach the complete review to this head so that a discussion-reply acknowledgement is not mistaken for the full review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
Please review the complete current changeset at 8f44f3b888c748dd8563bc42b95058bda06f9da3. The latest actionable findings have been fixed with before/after regression evidence and their threads are resolved. Full typecheck, lint, changed-code quality, build and hidden Electron checks pass; complete repository runs are still in progress and explicitly disclosed in Testing. Please distinguish this full review from discussion-reply confirmations.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Please review the current complete changeset at 26c558384be3b0be631547ad2e0d4aa152c77e93. The restore-persistence finding is fixed and resolved. Three new regressions fail before and pass after: read-only replay with zero/256 other placements, and stale replay after replacement-upload eviction. All 165 image/cache/launch cases, strict addon compilation, host typecheck, changed-code quality, focused lint, E2E build and hidden reload validation pass. Complete repository runs remain a separate pending gate; interrupted attempts are not reported as passed.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
The scope warning's SIXEL/iTerm2 examples are inherited from the existing addon patch, rather than changes introduced by this PR. I compared src/SixelHandler.ts and src/IIPHandler.ts sections in the patch against the current GitHub base 7868c30ce70617a943b1b3df3d026c60a3a08549; both sections are byte-for-byte identical. Comparing the entire patched addon to the original npm package includes Orca's pre-existing changes; the PR delta should be compared to Orca's base branch.
The four small test fixture changes are intentional and listed in Testing: they fix public entry resolution, editor initialization ordering, and real-Git fixture identity/construction discovered while running the complete repository gate. They preserve the assertions and do not change SIXEL/iTerm2 behavior.
The new placement-deletion finding is independently reproduced and a regression-tested candidate is ready in an isolated checkout. I am letting the current complete run finish before rebuilding and applying it, so the recorded test SHA stays accurate.
Please review the complete current changeset at 8eb9c1d03c6680088717d57781929a6fbc3d4fa8. The latest review fix and independent full-run fixture repairs are pushed. The current full typecheck, full lint, changed-code quality, build and hidden Electron validation pass; the production census inventory is unchanged and its default-heap regression now passes. Complete repository runs on these clean heads are in progress serially with isolation and zero retries, and remain explicitly pending in the description. The image PR also passes 171 image/cache/launch cases and retains full-deletion safety.
Ready head: 18b4c1d0d35c0f64a7dc002931d410b3e452e730; synchronized with upstream db8fc6d0cc9bf7e7f945d54d7387fc2539ee0e3a.
The six independent fixture edits have been removed from this feature diff and preserved in #33348 (five remaining fixes; upstream #33338 retired the census). The source patch's SixelHandler and IIPHandler sections are byte-identical to upstream db8fc6d: their complete embedded-diff SHA-256 values are respectively 42c8ec8c1db8b486a7730d03f1910b20eeafd9e6e0438161974ee7c5e302de75 and 0b25ac143bbbb606ebbc7ffd4ae5baebf2d5b2b90ac478ead06666b572ea1d6d. ImageRenderer/ImageAddon sections are unchanged too. Please assess the incremental patch change rather than treating inherited patch hunks as new SIXEL/iTerm2 work. No replay support for those protocols is added.
Current-head full typecheck/lint/quality, 55 focused cases, fresh CLI/current-platform orcad builds and hidden three-reload Electron verification pass; the actual screenshot was inspected. The complete Node gate is in progress and is not claimed green.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
New Ready head: aee9f552359e95e425d8520a829fbd8c448f4b12. The named physical-delete regression from the last full review is fixed and replied to. Four old-addon cases fail before and pass after; all 59 image/recovery/cache cases pass. Three real hidden Electron cases pass with zero retries: named lowercase/uppercase delete pixel checks and three renderer reloads without retransmission. Screenshots were inspected. Canonical addon regeneration/check, strict frozen install, full typecheck/lint/changed quality, fresh CLI/current-platform orcad/mobile-web/E2E builds pass.
The complete Node gate for this SHA is tracked separately while its release-cache fixtures are prepared. Earlier complete runs are not assigned to this new SHA. Matching clean-upstream controls reproduce the independent fixture failures; those repairs stay solely in #33348. The feature description now closes only its actual feature issue, and the unrelated fixture issue is left to its dedicated PR. Source sections for Sixel/IIP/ImageRenderer/ImageAddon still match the upstream base byte-for-byte. Please review the full current feature diff once for this new SHA.
Exact published Ready head: 514431fd792d13bce0fa18177a8465cbe4f164a0. Please review the entire current PR. This full-review request is sent once for this SHA after the verified normal nonforce update; earlier-head completion is historical. Workflow authorization and maintainer approval remain separate.
The early-return gate no longer skips the per-row placeholder scan in the app.
The app always passes readKittyImage (pane-inline-images.ts:63-69), so restoreMissing is always set. The condition this._virtualPlacements.size === 0 && !this.restoreMissing is therefore never true in the app. Before this change, a terminal with no virtual placements returned immediately.
ImageStorage.render now calls onRenderLine for every visible row. This includes the empty-cache path at Lines 412-417. Each call runs _placeholderCell on every column. The cost applies to every terminal with the image addon on every render, including terminals that never show an image. hidePlaceholderGlyphs already scans the full viewport on every onWriteParsed, so the work is duplicated.
Add a cheap signal that a placeholder cell exists in the viewport. Have hidePlaceholderGlyphs record it, and gate the render path on it. Detect the placeholder before the FgFlags.INVISIBLE skip. Cells that are already hidden must still count.
♻️ Proposed gate (plus the flag set in `hidePlaceholderGlyphs`)
- if (this._virtualPlacements.size === 0 && !this.restoreMissing) {+ if (this._virtualPlacements.size === 0 && !(this.restoreMissing && this._viewportHasPlaceholders)) {
return;
}
Outside the selected range, add private _viewportHasPlaceholders = false;. In hidePlaceholderGlyphs, reset it to false before the row loop. Set it to true when a cell matches PLACEHOLDER_CHAR, before the INVISIBLE check.
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: 4f8b6d60-d44b-49bd-bf64-e6b9a85fec4b
Commits
Reviewing files that changed from the base of the PR and between 9b0170c and 514431f.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Please review the full current diff at published head 146f57277ba9919e0ec71e69ffa8569c5ad8a4e6 after the cache-invalidation and viewport-scan corrections. Valid before/after controls, exact current validation and limits are in the updated description; the existing cache thread has been replied to and resolved. Earlier-head coverage is historical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
An image printed once by a terminal program should still be visible after Orca reloads. This restores Kitty Unicode-placeholder images from a bounded local cache without asking the running program to send them again.
What Changed
Why
The terminal text snapshot contains placeholder cells, but those cells cannot reconstruct the image bytes. Keeping only decoded pixels in memory also makes eviction destructive. Retaining bounded encoded data and restoring only visible prototypes addresses both cases without retaining every decoded bitmap. Requiring PTY retransmission would add a replay dependency to every terminal program; the local cache lets renderer recovery work without that cooperation.
Linked Issue
Fixes #33118
Related: #23547, #30383, #32714. HiDPI scaling remains separate from this change and from #30349.
Visual Proof
Feature illustration from earlier source builds; these images are not current-SHA validation evidence. Current hidden-CDP results are listed under Testing.
Testing
Unchanged exact146f standalone: four image files, 65 passed under each entry. The valid native before/after control deliberately aborts a Chromium IndexedDB transaction; actual quota exhaustion and a historical user-crash reproduction were not performed.
Exact combined source validation and retained evidence limits
Exact private combination
d7dcaad8c922ac7112f192589556f7c19145b1a4contains image146f572, rich outputa4aa01band fixtures3b65d5fon main4cd62c4. Executed on macOS with Node 24.22.1 and default Bun 1.4.4.128 related root files: 1723 passed/7 inherited conditional skip per entry; four mobile files: 77 passed. Frozen root/mobile/cloud preparation and all 16 integration commands passed, including full typecheck/lint/quality, fresh mobile-web/CLI/orcad/E2E builds, and the required five-fixture-file changed gate.
The configured official Claude Code 2.1.309 passed 207 renderer/plugin checks at this exact private SHA, separate from the related-root counts. 5 hidden Electron cases passed; all 14 fresh CDP PNGs were personally inspected and hashed. The selected owned CLI binary/version is recorded separately.
Recorded commands:
pnpm tc;pnpm lint --maxWorkers=2;pnpm run test:claude-rich-output; hidden Playwright settings/image-reload specs with--project electron-headless --workers=1 --retries=0. Private delta gate:pnpm check:changed --base=b1e09c5696fa4e7221aa5fd7e19d7cb9b202e886 --maxWorkers=2(20 checks passed, internal composition base). Public standalone reproduction commands are listed above; the earlier failed 75b9 run remains failed.This is related/affected validation using current main's test set, including its upstream case retirements/renames. Earlier complete, failed and partial runs retain their own SHA/platform attribution.
Manual interactive desktop testing, hosted CI, native Windows/Linux execution and installer validation remain unperformed; hidden checks were automated through CDP.
AI Disclosure
AI-assisted implementation and automated validation using OpenAI Codex. The author requested these contributions.
Review
Exact published head:
146f57277ba9919e0ec71e69ffa8569c5ad8a4e6. The exact146f full AI review finished, selecting all 12 eligible files; the existing filter excludes the lockfile. No new actionable finding; the cache-invalidation thread is resolved.Hosted workflows: PR Checks:
completed/action_required, 0 jobs. Bot/local success does not replace maintainer workflow authorization or human approval.Agent skill upstream boundary
Notes
Independent test-fixture fixes are now in #33348. The existing
SixelHandler,IIPHandler,ImageRendererandImageAddonsections of the checked-in source patch are byte-identical to synchronized upstreamdb8fc6d0cc; this PR preserves those inherited hunks and does not add SIXEL/iTerm2 recovery behavior.This is a best-effort cache, not permanent transcript storage. Clearing application site data removes the cached images. Cache quota and IndexedDB failure preserve live rendering but can prevent subsequent recovery.
Checklist