Skip to content

fix(terminal): stop inline-image decoders exhausting the renderer's wasm memory budget - #23499

Merged
nwparker merged 1 commit into
mainfrom
fix/terminal-wasm-reservation-exhaustion
Sep 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/terminal-wasm-reservation-exhaustion

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​160 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​160
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​516 $\color{#cf222e}{\Huge{\mathbf{−}}}$​37 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​479

Found by Orca crash scan 28 on the released v1.4.215. User identities are left out.

Description

A user with about 220–230 open terminals saw many RangeError: WebAssembly.instantiate(): Out of memory: Cannot allocate Wasm memory for new instance and RangeError: WebAssembly.Memory(): could not allocate memory errors. After those errors, terminals stopped showing output, Orca's stall detector kept rebuilding them (terminal_pane_recovery_remount reason=write-stalled, repeated terminal_replay_guard_wedged_release), and the rebuilt terminals failed the same way.

Root cause. Electron renderers run V8 with its memory sandbox turned on. Inside that sandbox, every live WebAssembly memory reserves a large guard region, so a process can hold only about 124 live wasm memories, however much RAM is free. The terminal picture add-on (@xterm/addon-image) used up that budget:

  • Every terminal created its own SIXEL decoder (a wasm instance plus its memory) as soon as the add-on loaded, even if the terminal never showed a picture.
  • The IIP (iTerm2 inline image) base64 and QOI decoders stayed alive after the first image, because KEEP_DATA (4 MB) is larger than the starting buffer (1 MB).

With inline images on (the default), about 124 terminals used up the budget. After that:

  1. Each new terminal's add-on activation failed with an unhandled rejection. The pane still opened but had no SIXEL support.
  2. Any Kitty or IIP image sequence, including the Kitty support queries that TUIs send at startup, threw WebAssembly.Memory(): could not allocate memory synchronously out of xterm's parser. xterm's write buffer then never fired the callback for that write or any later one, so the terminal stayed frozen until something rebuilt it.

A React #185 error also appeared right after a burst of these failures. The rebuild storm is a plausible trigger, but that link is not proven: the attribution for that error is marked unreliable, and I did not reproduce #185 itself.

ELI5

Electron gives each window about 124 "parking spaces" for a kind of fast decoding engine (WebAssembly), no matter how much RAM the computer has. The picture-in-terminal add-on parked one engine for every terminal, even terminals that never showed a picture. With about 230 terminals the spaces ran out. After that, the next picture a terminal received broke that terminal's text pipeline, so it stopped showing output until Orca rebuilt it, and the rebuilt terminal hit the same problem. Now all terminals share a couple of engines and only borrow one while a picture is arriving. If there's still no space, that one picture is skipped and the text keeps flowing.

What Changed

Before (as the user experiences it): past about 120 terminals in one window, terminals go blank or freeze as soon as a program prints an image or sends a Kitty graphics query. Orca then rebuilds those terminals over and over.

After: terminals hold no image decoders while idle, so the number of terminals no longer uses up the budget. The whole renderer holds about 1 decoder at rest. If the budget really is exhausted (for example, by some other wasm user), that one image is dropped and the text keeps flowing.

Mechanism. This PR changes the addon-image source patch (config/patches/xterm-src/@[email protected]). The bundle patch and the lockfile hash were regenerated with regenerate-xterm-patches.mjs --write, and --check confirms they are in sync.

  • SixelHandler: activation no longer creates a decoder. All terminals share a pool of decoders, keyed by memoryLimit, with at most 2 idle. The pool is primed once per process with an async compile. A terminal borrows a decoder when an image starts (hook) and returns it when the image ends or the terminal resets (unhook/reset, with a try/finally). Each terminal keeps its own color registers in a Uint32Array palette, so registers still carry over between images until RIS/DECSTR, as before. If no decoder can be allocated, the image is dropped with a console.warn.
  • IIPHandler: KEEP_DATA is now 0, so the base64 and QOI decoders free their wasm memory after each image. If init() or a QOI decode() fails, the image is dropped (single-part and multipart) instead of the error escaping from the parser, and both the base64 and QOI decoders are released so a failed decode() cannot pin a wasm memory.
  • KittyGraphicsHandler: if Base64Decoder.init() fails, the upload is aborted. When the upload has an id, Kitty gets an ENOMEM reply. No error is thrown.
  • New contract test: config/scripts/xterm-image-wasm-budget-contract.test.mjs. There is also a short section in docs/reference/xterm-patch-regeneration.md.

No Orca TypeScript changed. pane-inline-images.ts already catches synchronous attach errors, and activation no longer has a wasm step that can fail.

Why

The limit is on how many wasm memories are alive at once, not on RAM. So the fix has to make sure idle terminals don't hold any. Alternatives I considered:

  • Turn inline images off above N terminals. This hides a feature based on an arbitrary threshold, and it still wedges when other code uses up the budget.
  • Only catch errors in Orca. The synchronous throw happens inside xterm's parser, and Orca can't catch it there without the write queue already being stuck.
  • Reuse per-terminal decoders but create them lazily. This still grows with the number of terminals that have ever shown an image.

A shared, borrowed pool keeps the cost constant no matter how many terminals are open. Dropping an image on allocation failure turns a permanent freeze into one missing picture.

Fix evidence

All runs used Electron 43.7.0, the same Electron the user runs, with ORCA_BACKGROUND_LAUNCH=1 and hidden BrowserWindows. The "before" bundle is the released addon, whose patch is identical between v1.4.215 and main.

1) Per-process cap (raw new WebAssembly.Memory held alive):

renderer: FAILED at 123: RangeError: WebAssembly.Memory(): could not allocate memory
main:     FAILED at 124  RangeError: WebAssembly.Memory(): could not allocate memory
(Node 26 without the V8 sandbox: 2000 allocated, no error)
2000 create-and-drop cycles in the renderer: all succeeded (only memories that stay alive count)

2) Each real xterm Terminal + ImageAddon holds 1 wasm memory (BEFORE):

N=0   headroom 124
N=50  headroom 74
N=100 headroom 23-24
N=130 6 unhandled rejections  "RangeError: WebAssembly.instantiate(): Out of memory: Cannot allocate Wasm memory for new instance"
N=250 126 unhandled rejections (same message as the user's report)

3) Functional probe: write kitty / sixel / IIP images, then plain text:

BEFORE  N=250, pane125 and pane249:
  kitty  WEDGED (callback never fired)
  sixel  WEDGED
  iip    WEDGED
  'hello' written afterwards  WEDGED
  imagesStored 0; uncaught "RangeError: WebAssembly.Memory(): could not allocate memory"
  (Same result with only N=20 panes when other code already holds the rest of the budget, EXHAUST=1)

AFTER (patched addon, same probe):
  N=50   headroom 122, 0 rejections, kitty/sixel/iip/plain all "parsed", imagesStored 3
  N=250  headroom 123, 0 rejections, all parsed, imagesStored 3 on pane125 and pane249
  N=400  headroom 122, 0 rejections, all parsed, imagesStored 3
  EXHAUST=1 N=20: all parsed; kitty and IIP images dropped (imagesStored 1, the pooled sixel); nothing throws or wedges

4) New contract test run against both bundles:

before (v1.4.215 addon): 3 failed / 4
  "expected d{ _PIXEL_OFFSET: 16388 …} to be undefined"   (an idle terminal holds a decoder)
  "expected 'wedged' to be 'parsed'"
after:                   4 passed / 4

Commands:

pnpm vitest run --config config/vitest.config.ts config/scripts/xterm-image-wasm-budget-contract.test.mjs
node config/scripts/regenerate-xterm-patches.mjs --check

Trade-offs

  • The first SIXEL image in a process may compile the ~11 KB sixel wasm module synchronously, if it arrives before the async prime finishes. That takes a few milliseconds and happens once. I checked that synchronous compile works on Electron's renderer main thread.
  • Each IIP image now creates a new base64 wasm instance (1 MB to start) instead of reusing a kept one. Streams of many IIP images create more garbage for the collector. I checked that freed memories are reclaimed under pressure.
  • When the wasm budget really is exhausted, Kitty and IIP images are dropped with a console warning, and Kitty uploads with an id get an ENOMEM reply. Before, the terminal froze instead. Under exhaustion, a chunked Kitty upload can also decode only part of its data.
  • The patch grows by about 20 KB of source changes, plus the regenerated bundle and sourcemap hunks.
  • Not validated in the full packaged Orca app with 250 real PTY panes. I proved it in an Electron 43.7.0 renderer with the exact released and patched xterm/addon bundles and the same addon options Orca uses.

Adversarial review

1 loop, clean on the first pass (3 non-blocking notes).

  • Reproduced the budget independently in a hidden sandboxed BrowserWindow. Holding sixel instances failed at exactly 124 with the user's error message. Dropping the references and letting GC run freed the budget.
  • Confirmed that synchronous sixel compile works on the Electron renderer main thread, so it is not a regression.
  • Verified that the CJS/ESM bundles and the sourcemap carry the change, and that the patch is in sync.
  • Code review:
    • The sixel palette is copied out before release and restored in init().
    • dispose → reset returns the decoder to the pool.
    • unhook returns the decoder on every path (try/finally).
    • The prime's rejection is handled.
    • An IIP init failure aborts both the single-part and multipart paths.
    • A Kitty init failure sets _aborted and sends only one ENOMEM reply.
  • Tests: 58/58 on the contract tests, and 882 passed (1 skipped) in pane-manager. oxfmt and check:code-quality:changed are clean. The new tests fail on the old code.
  • Non-blocking notes, all reflected above: a chunked Kitty upload can be partial under exhaustion, IIP now sets up a new decoder per image, and the React fix: improve scrollbar and file explorer scroll behavior #185 link is still unproven.

Linked Issue

None. Found by the internal crash scan.

Visual Proof

N/A. The fix is in the terminal parser, and the only visible change is that terminals no longer freeze. The before/after probe output above stands in for screenshots.

Testing

  • I manually tested these changes locally (Electron 43.7.0 before/after probes at N=20 with EXHAUST=1, 50, 250 and 400)

  • Automated tests added/updated

  • config/scripts/xterm-image-wasm-budget-contract.test.mjs: 4/4 after the fix, 3/4 fail on the released bundle.

  • xterm-image, regenerate-xterm-patches and pane-manager suites: 85 files, 940 passed, 1 skipped.

  • terminal-capability-replies, terminal-inline-image-da1, terminal-appearance and terminal-ime-xterm-transaction-events: 71/71 passed.

  • regenerate-xterm-patches.mjs --check: in sync. oxlint and oxfmt clean.

  • After rebasing on the latest main: the contract test and regenerate test pass (37/37), and the patches are in sync.

  • Platforms: the change is pure renderer JavaScript, so it behaves the same on macOS, Linux and Windows, and for local, SSH, WSL and folder workspaces. Probes ran on macOS.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security: no new inputs are trusted, and an allocation failure now fails closed by dropping the image. Cross-platform: renderer JS only. SSH: the parser runs in the renderer, so remote terminals get the same fix. Mobile: not affected. Backwards compatibility: SIXEL color-register behavior is kept. Performance: covered in Trade-offs.

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)

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 14c3ba20-c5aa-4ff8-9b4a-205e1b4b967b

📥 Commits

Reviewing files that changed from the base of the PR and between 5f33bfcdfc5d7c19d655a99a5753fc9ed30ccbc7 and b8e864a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The xterm image patch changes IIP and SIXEL decoder lifetimes and adds allocation-failure handling. It adds capacity and input-size checks for Kitty image decoding. It also updates image rendering and bitmap cleanup. Contract tests cover decoder use, palette state, image painting, and terminal writes under allocation failure. The regeneration documentation describes the decoder changes and names the contract test.

Estimated code review effort

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 5f33b

The SIXEL decoder pool can still hold on to WebAssembly memory, and a failed decoder initialization may still throw through the parser. Both undercut the stated goal of the PR. Fix them before merging.

Architecture Summary

Architecture risk: 🔵 Low · up to 5f33b

The change affects 2 systems.

Changed systems: config, docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — config (service) was modified; 2 changed files map to changed impact.
  • observed — docs (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in config/scripts/xterm-image-wasm-budget-contract.test.mjs: Adds xterm and addon setup, SIXEL and IIP image fixtures, and imports for Vitest assertions and cleanup.
  • observed — Modified behavior in config/scripts/xterm-image-wasm-budget-contract.test.mjs: Adds a tracked bitmap and canvas/browser-global stubs that capture painted image data.
  • observed — Modified behavior in config/scripts/xterm-image-wasm-budget-contract.test.mjs: Adds a terminal factory that loads the image addon with configurable options and exposes its SIXEL and IIP handlers.
  • observed — Modified behavior in config/scripts/xterm-image-wasm-budget-contract.test.mjs: Adds helpers for awaiting terminal writes, detecting a write that remains pending for two seconds, and reading an image’s first pixel; restores stubbed globals after each test.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: preventing inline-image decoders from exhausting the renderer's WebAssembly memory budget.
Description check ✅ Passed The description is detailed and mostly complete. It covers the user impact, root cause, implementation, rationale, testing, trade-offs, compatibility considerations, visual-proof rationale, and checkl…
Full details: Docstring Coverage

Explanation

Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

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.

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

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

  • Shared SIXEL decoder pool. SixelHandler no longer creates a per-terminal decoder at activation; terminals borrow one from a process-global pool while a sequence is open, and color registers move onto the handler so they still survive between images.
  • IIP decoder release. KEEP_DATA drops to 0, so the base64 and QOI decoders free their wasm memory after each image; init() and QOI decode() failures now drop the image instead of escaping the parser.
  • KITTY init guard. A failed Base64Decoder.init() aborts the upload and replies ENOMEM (once, and only when an i= id is present) rather than throwing into the parser.
  • Contract test + docs. xterm-image-wasm-budget-contract.test.mjs pins idle-terminal wasm hold (300 terminals), per-image decoder release, color-register persistence, and non-wedging under stubbed wasm exhaustion.

I confirmed the patch is self-consistent: pnpm install --frozen-lockfile applies the new 5379dd79… hash, regenerate-xterm-patches passes (33/33), and the four image contract suites plus the new wasm-budget test pass locally (25/25). The applied source and bundle agree.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

🟠 Major · Fix the pool release: a decoder can be pooled… · @[email protected]:256-265

config/patches/xterm-src/@[email protected]:256-265
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fix the pool release: a decoder can be pooled after release(), and the idle list can overflow.

releaseDecoder calls dec.release() when memoryUsage exceeds MEM_PERMA_LIMIT. It then still pushes the decoder into the idle list. The pooled decoder has no memory, which is acceptable only if init() reallocates it. The idle list is capped at MAX_IDLE_DECODERS. A decoder that does not fit is dropped without release(). That decoder keeps its wasm memory until garbage collection. This defeats the purpose of the PR, because V8 caps live wasm memories.

Release the decoder when the pool is full.

Proposed fix
 function releaseDecoder(dec: Decoder, memoryLimit: number): void {
   if (dec.memoryUsage > MEM_PERMA_LIMIT) {
     dec.release();
   }
   const idle = idleDecoders.get(memoryLimit) ?? [];
   if (idle.length < MAX_IDLE_DECODERS) {
     idle.push(dec);
     idleDecoders.set(memoryLimit, idle);
+  } else {
+    dec.release();
   }
 }
🟠 Major · Guard this._dec.init() against allocation… · @[email protected]:330

config/patches/xterm-src/@[email protected]:330
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard this._dec.init() against allocation failure.

acquireDecoder is inside a try/catch. init() on a pooled decoder is not. init() can allocate wasm memory and throw a RangeError. That error escapes through the parser and wedges the write queue. This is the failure the PR tries to prevent. The decoder also stays in this._dec until the next _returnDecoder.

Wrap init() in the same try/catch. On failure, set _aborted and return the decoder.

Proposed fix
-    this._dec.init(fillColor, this._palette, this._opts.sixelPaletteLimit);
+    try {
+      this._dec.init(fillColor, this._palette, this._opts.sixelPaletteLimit);
+    } catch (e) {
+      console.warn(`SIXEL: could not initialize decoder - ${e}`);
+      this._aborted = true;
+      this._returnDecoder();
+    }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: f68a1efb-d143-40df-9475-0e64f6eec50c

📥 Commits

Reviewing files that changed from the base of the PR and between 3123d62 and 5f33bfcdfc5d7c19d655a99a5753fc9ed30ccbc7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)

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

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

✅ No new issues found.

Reviewed changes

  • Added _qoiDec.release() to the IIP QOI decode failure path, so a throw from decode() frees the QOI wasm instance alongside the base64 one — closing the last path that could pin a wasm memory after a failed QOI image.
  • Regenerated the addon bundle patch and repointed the lockfile patch hash (5379dd79… → e5254a46…).

The delta is self-consistent: regenerate-xterm-patches.mjs --check reports the source and bundle patches are in sync, and the new lockfile hash equals the sha256 of the regenerated bundle patch. The prior review's QOI-release concern is addressed; its thread is resolved.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High risk] Patches terminal image decoder memory management in a dependency.

The PR appears safe to merge, though the previously reported idle-decoder pool growth concern remains.

Findings

  1. P2 Idle decoder pool can grow ▶

Summary

This PR changes the xterm image add-on so idle terminals do not retain image-decoder wasm memories and allocation failures drop an image rather than interrupt terminal output.

  • SIXEL decoders are borrowed from a shared pool; IIP decoders are released after images.
  • Kitty, IIP, and SIXEL allocation-failure paths are guarded, with a new contract test and regenerated patch artifacts.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Terminal[Terminal receives image] --> Borrow{Decoder available?}
  Borrow -->|Yes| Decode[Decode image]
  Decode --> Release[Release or pool decoder]
  Borrow -->|No| Drop[Drop image]
  Release --> Continue[Continue terminal output]
  Drop --> Continue
Loading

Reviews (2) · Last reviewed commit: "fix(terminal): stop inline-image decoder..."

Comment on lines +260 to +264
+ const idle = idleDecoders.get(memoryLimit) ?? [];
+ if (idle.length < MAX_IDLE_DECODERS) {
+ idle.push(dec);
+ idleDecoders.set(memoryLimit, idle);
+ }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Idle decoder pool can grow If addons use different pixelLimit values over a renderer’s lifetime, this pool keeps up to two idle SIXEL decoders for each value, even after the terminals are disposed. Each decoder retains a wasm memory, so those memories can accumulate and eventually consume the process-wide budget. Consider a global pool limit or a way to release unused entries.

…asm memory budget

V8 reserves an 8 GiB guard region per wasm memory inside its 1 TiB sandbox,
so an Electron renderer can hold only ~124 live wasm memories regardless of
free RAM. @xterm/addon-image instantiated a SIXEL decoder per terminal at
activation (and kept IIP decoders after the first image), so ~120+ terminals
exhausted the budget: new panes raised 'WebAssembly.instantiate(): Out of
memory' rejections, and the next Kitty/IIP image threw 'WebAssembly.Memory():
could not allocate memory' out of the parser, permanently wedging that
terminal's write queue.

The addon-image source patch now borrows SIXEL decoders from a shared pool
only while a sequence is open (color registers stay on the terminal), drops
IIP decoders after each image, and turns a failed decoder allocation into a
dropped image instead of a parser throw. Bundles regenerated with
regenerate-xterm-patches.mjs --write.
@nwparker
nwparker force-pushed the fix/terminal-wasm-reservation-exhaustion branch from 5f33bfc to b8e864a Compare September 29, 2026 08:04
@nwparker
nwparker merged commit e1362ad into main Sep 29, 2026
47 checks passed
@nwparker
nwparker deleted the fix/terminal-wasm-reservation-exhaustion branch September 29, 2026 08:20
brennanb2025 added a commit that referenced this pull request Sep 29, 2026
…3745, #23783, #22971, #22565, #22846, #23724, #23721, #23693, #23810) into #23059

#23671 (group chat rows by the turn that produced them) is ported onto
#23059's turn-scope model, so there is one grouping mechanism, not two:

- A host that states each row's turn scope groups by that scope, as
  before. #23671's journal-order derivation (rows between one turn record
  and the next belong to it) moves from the timing selector into
  src/shared/native-chat-turn-grouping.ts and runs only for a host that
  states no scope, replacing the positional fallback there.
- #23671's anchor rules live in structuredAgentTurnAnchors, which
  membership, settled timing and the live clock all read: a turn whose
  opener key nothing resolves yet takes the send still in flight ahead of
  its record (Codex before its echo), else its own record.
- The live turn is one key again. #23671 made row liveness follow the
  owning turn, so the bar key and the liveness key are always the same;
  nativeChatTurnMembership now returns only liveTurnKey (barTurnKey,
  activeTurnOpenedBy and turnKeysByItemId are gone).
- A turn with no user bubble draws its bar above its first row
  (nativeChatTurnBarRows, desktop and mobile), and a turn's diff rollup
  goes under its last row.
- The Codex full-history restore writes each record ahead of its items;
  that also fixes the derived turn scope on #23059's journal.

#23026 (Stop from the moment a message is sent) is ported onto #23059's
command turns: the cancel paths ask the translator for a command's
provider turn instead of the removed compaction tracker, and a Stop that
names no turn still ends a running /compact through its child.
performCancel moved to structured-agent-session-turns-cancel.ts to keep
the turns module under the line limit.

#22090's awaitingInput replaces showTurnStatus/showLiveTurnActivity; the
waiting-behind-/compact rows are kept.
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.

2 participants