Repository navigation
Main sends one layout update per action, with only what changed (dark, layout-owner build only) - #31109
Conversation
…s a binding-only frame without a rebuild (dark, layout-owner build only) Main: when the window's spawn for a restored pane finds its process gone, the spawn that holds the pane's reservation keeps the dead binding and its fresh bind swaps it (the restart swap), so the pane is never published unbound: a same-id respawn publishes no frame, a new id one. A failed spawn still retires the dead binding. Other callers and window-owned builds retire early as before. Window: a frame that differs from the shown one only in panes' terminal bindings updates the store's pane trees as a rebuild would, falling back to a rebuild for holds and shared terminals.
…bind instead of the early retire
… resubscribes on a missed frame (dark, layout-owner build only) Main: a durable mutation (a layout.apply, the renameTabs batch, a binding write, a repair) is one operation. It names the partitions it wrote, and at its end the layout stream publishes once: one `records` frame holding only the changed records (tab rows, workspace groups, a pane tree per tab, a binding record per pane, editor files, browser tabs, removed workspaces), each keyed by main's own ids. Writes no operation scopes (window saves) still publish when their task ends. The snapshot and every records frame carry a stream epoch. Each pane's binding carries `ptyGeneration`, which rises on every binding write in this process, so a same-id respawn is one frame with one binding record. Readers beside the stream get the end of each operation and the stream's own per-partition loaded model (`workspaceLayoutReads`), so they need no second Loader pass, with or without a window. Window: the cache applies records frames to its full layouts, so the existing flush and the binding-only path are unchanged. A records frame of another epoch or out of sequence, a malformed frame, or one the cache cannot apply resubscribes at once for a fresh snapshot. Tests install main's model check, which applies each frame to what subscribers held and compares it with a fresh projection; dev builds log a mismatch, release builds run none.
…guard operation listeners (dark, layout-owner build only) - A spawn whose swap bind persisted no longer retires that pane's binding when a later commit step fails; a pane on an SSH host keeps the early retire, since its dead owner lives there. - The window resubscribes at once at most three times before a frame applies cleanly, then takes the loss path's backoff. A skipped frame of a newer type still advances its position. - A throwing operation listener is logged; it no longer fails a committed mutation. - Tests freeze the shared partition model a reader gets; the dev-build model check skips frames that only change live titles. Generation and model-check comments say what is true.
…resync storm holds it
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
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:
d43326c2-d6cb-4b1a-8ab4-c1331bbac919
📒 Files selected for processing: 61
src/main/ipc/pty-absent-pane-respawn.test.tssrc/main/ipc/pty-dead-owner-respawn.test.tssrc/main/ipc/pty-pane-owner-swap.test-fixture.tssrc/main/ipc/pty-pane-restart-replace.test.tssrc/main/ipc/pty-persisted-incarnation-repair.test.tssrc/main/ipc/pty/ipc/spawn-absent-binding-swap.tssrc/main/ipc/pty/ipc/spawn-commit-persist.tssrc/main/ipc/pty/ipc/spawn-execute.tssrc/main/ipc/pty/ipc/spawn-preflight.tssrc/main/ipc/pty/ipc/spawn-types.tssrc/main/ipc/pty/pane/absent-pane-owner.tssrc/main/ipc/pty/pane/adopt-stable.tssrc/main/ipc/pty/pane/pane-owner-replacement.tssrc/main/ipc/pty/pane/stable-owner.tssrc/main/ipc/pty/pane/stable-pane-absence-respawn.test.tssrc/main/persistence-invalid-workspace-layout-purge.test.tssrc/main/persistence/loading-store/primary-state-write-runtime.tssrc/main/persistence/loading-store/primary-state-writes.tssrc/main/persistence/loading-store/pty-binding-generations.tssrc/main/persistence/loading-store/pty-binding-persistence.tssrc/main/persistence/loading-store/pty-binding-session-update.tssrc/main/persistence/loading-store/pty-binding-span.tssrc/main/persistence/loading-store/store-runtime-state.tssrc/main/persistence/loading-store/workspace-session-write-listeners.spec.tssrc/main/persistence/loading-store/workspace-session-write-listeners.tssrc/main/persistence/loading-store/write-scheduling.tssrc/main/persistence/terminal-topology/layout-command-persistence.tssrc/main/persistence/terminal-topology/terminal-layout-rename-tabs.test.tssrc/main/runtime/folder-workspace-mixed-host-routing.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/published-pane-live-titles.tssrc/main/runtime/rpc/methods/workspace-layout.test.tssrc/main/runtime/rpc/methods/workspace-layout.tssrc/main/runtime/runtime-store-contract.tssrc/main/runtime/workspace-layout-frame-model-check.test-fixture.tssrc/main/runtime/workspace-layout-frame-model-check.tssrc/main/runtime/workspace-layout-frame-observer.tssrc/main/runtime/workspace-layout-live-titles.test.tssrc/main/runtime/workspace-layout-operation-frames.test.tssrc/main/runtime/workspace-layout-projection.tssrc/main/runtime/workspace-layout-stream-events.test-fixture.tssrc/main/runtime/workspace-layout-stream.test.tssrc/main/runtime/workspace-layout-stream.tssrc/renderer/src/runtime/runtime-layout-client.test.tssrc/renderer/src/runtime/runtime-layout-client.tssrc/renderer/src/runtime/workspace-layout-frame-binding.test.tssrc/renderer/src/runtime/workspace-layout-frame-bindings.tssrc/renderer/src/runtime/workspace-layout-frame-changes.tssrc/renderer/src/runtime/workspace-layout-frame-records.test.tssrc/renderer/src/runtime/workspace-layout-frame-sync.tssrc/renderer/src/store/workspace-layout-cache.tssrc/shared/workspace-layout/workspace-layout-disk-fields.tssrc/shared/workspace-layout/workspace-layout-load-bindings.tssrc/shared/workspace-layout/workspace-layout-load-types.tssrc/shared/workspace-layout/workspace-layout-model.tssrc/shared/workspace-layout/workspace-layout-published.tssrc/shared/workspace-layout/workspace-layout-records.test.tssrc/shared/workspace-layout/workspace-layout-records.tssrc/shared/workspace-layout/workspace-layout-stream-frames.test.tssrc/shared/workspace-layout/workspace-layout-stream-frames.tstests/e2e/helpers/workspace-layout-oracle-feed.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…no longer imports its replacement (dark, layout-owner build only)
Main's layout-owner change (#31109, dark) kept a dead process's binding for the fresh bind to swap, through the old attach helpers this branch replaced. Its hook now runs in the single attach step: stable-pane adoption holds the pane's reservation through its fresh launch, so the IPC lane passes the swap hook to adoption and the absent owner is kept instead of retired. Absence retirement keeps this branch's incarnation fence.
ELI5
In the build where the main process owns the tab layout (off in every shipped build), main tells the window about layout changes by sending it updates. Before this change, main sent a full copy of a workspace's layout after every single save. When 100 restored terminals restarted at relaunch, it sent about 200 of these, and the window rebuilt everything each time, so the window stuttered. Now main sends one small update per action, listing only what changed, and a restarted terminal's update names only that terminal. If the window ever misses an update, it notices and asks for a fresh copy.
What Changed
Layout-owner build only. With the switch off, main still sends today's whole-workspace updates; the window does not listen for them in that build.
Main sends one update per action, with only the changed parts.
The window notices a missed update and resyncs.
Headless servers and other readers.
Measured on the 100-agent relaunch harness (the relaunch restarts 100 terminals whose processes died; titles are generated):
UNGATED: 5 interleaved relaunches per build, run while the machine was busy (1-minute load 22 to 28) because it never got quiet enough for the gated run. Both builds ran under the same load, one after the other.
Why
Linked Issue
Fixes #
Visual Proof
N/A. Nothing changes in shipped builds: the change is limited to the layout-owner build, which is off everywhere. In that build, the relaunch stutter is gone; the numbers above measure it.
Testing
New tests. Each failed on the base before its fix:
Tests that import a changed file, 59 files, run with the switch off and on:
workspace-layout-fact-locations,workspace-layout-views,old-client-session-tabs-projection.Gates:
pnpm tc,check:code-quality:changed(0 findings), oxlint on changed files, the layout-writer and max-lines ratchets, andverify:rpc-params-catalog.Reviews: one adversarial review, and a review of its fix round. The review found no high-severity issue. All nine findings are fixed in this PR:
Switch-off bundle diff (unminified, base vs head, file hashes normalized):
AI Disclosure
Review
Agent skill upstream boundary
Notes
WorkspaceLayoutRecordsFrameinsrc/shared/workspace-layout/workspace-layout-stream-frames.ts.workspace-layout-records.ts.LayoutLeaf.ptyGeneration.runtime.workspaceLayoutReads.onLayoutOperationCommitted, andruntime.workspaceLayoutReads.readPartition, which returns a shared, read-only result.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)