Skip to content

fix: resolve right sidebar freeze on Windows - #598

Merged
Jinwoo-H merged 4 commits into
mainfrom
Jinwoo-H/right-sidebar-windows
Apr 13, 2026
Merged

Jinwoo-H merged 4 commits into
mainfrom
Jinwoo-H/right-sidebar-windows

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #512

Summary

  • Debounce terminal refit — Replace RAF-based batching with a 150ms trailing-edge debounce on the ResizeObserver in use-terminal-pane-global-effects.ts. The synchronous xterm scrollback reflow (fitAddon.fit() → terminal.resize()) blocks the renderer for 500ms–2s on Windows with large scrollback buffers; deferring it 150ms lets the layout settle first so the reflow runs once instead of per-frame.
  • Parallelize auth cache rebuild — rebuildAuthorizedRootsCache now runs git worktree list + realpath() for all repos concurrently via Promise.all instead of sequentially. With 3 repos on Windows, this cuts wall-clock time from ~2–3s to ~500ms–1s.
  • Suppress CSS transition on sidebar mount — Added a isMounting guard that applies transition-none on the sidebar's first render, preventing Chromium from animating width from auto → 320px and triggering intermediate terminal resizes.

Test plan

  • Open the right sidebar on Windows with multiple worktrees active and verify the app stays responsive
  • Verify the sidebar still animates smoothly when toggling open/close after the initial mount
  • Verify terminal dimensions update correctly after sidebar open (type a long line, confirm it wraps at the right column)
  • Verify drag-resize of the sidebar still has smooth transitions
  • Verify File Explorer loads files correctly (auth cache rebuild still works)
  • Run existing test suite — confirm no new failures

🤖 Generated with Claude Code

Jinwoo-H and others added 4 commits April 13, 2026 18:55
Three changes that together eliminate the multi-second UI freeze
reported when opening the right sidebar on Windows:

1. Debounce terminal refit (150 ms trailing-edge) so the expensive
   synchronous xterm scrollback reflow runs once after layout settles
   instead of immediately on each ResizeObserver frame.

2. Parallelize auth cache rebuild — process all repos concurrently
   via Promise.all instead of sequentially, cutting wall-clock time
   from sum-of-repos to slowest-single-repo.

3. Suppress CSS width transition on sidebar mount to prevent
   Chromium from animating auto→320 px, which would trigger
   intermediate terminal resizes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When switching worktrees, all PTY output accumulated while the
terminal was in the background was written in one synchronous
terminal.write() call.  With a Claude agent running for minutes,
this buffer can reach hundreds of KB, blocking the renderer for
2–5 s on Windows.

Two changes:

1. Drain pending buffers in 32 KB chunks with setTimeout(0)
   yields between chunks so the browser can paint frames and
   process input events during the catch-up.

2. Cap the pending buffer at 512 KB (trimming oldest output)
   to bound memory usage for long-running background agents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The @parcel/watcher error callback can fire before subscribe()
resolves and assigns root.subscription.  On Windows this crashes
the main process with "Cannot read properties of null".
1. Pending buffer cap now snaps the cut point forward to the next
   newline (within 256 chars) so the trim doesn't bisect an ANSI
   escape sequence, which would garble terminal output on flush.

2. Watcher error callback can fire before subscribe() resolves.
   Track this with an errorCleanedUp flag and immediately
   unsubscribe the orphaned subscription to prevent leaking a
   native file-watcher handle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Jinwoo-H
Jinwoo-H merged commit 48c67ca into main Apr 13, 2026
1 check passed
@Jinwoo-H
Jinwoo-H deleted the Jinwoo-H/right-sidebar-windows branch April 13, 2026 23:53
brennanb2025 added a commit that referenced this pull request Apr 19, 2026
Adds Playwright coverage for two high-regression areas identified from the
last 200 PRs:

- worktree-lifecycle.spec.ts: guards removeWorktree cleanup (#532),
  worktree switch with right sidebar open (#598/#628/#726), and
  cross-worktree tab isolation (#542/#554).
- tab-close-navigation.spec.ts: guards visual-neighbor activation on
  editor/diff close (#693) and Landing fallback when the last visible
  surface closes (#677).
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

[Windows] Desktop app freezes for a few seconds when opening right sidebar panel

1 participant