Skip to content

fix(web): defer diff worker startup until diff opens#934

Merged
juliusmarminge merged 4 commits intopingdotgg:mainfrom
binbandit:t3code/fix-browser-worker-init-test
Mar 13, 2026
Merged

fix(web): defer diff worker startup until diff opens#934
juliusmarminge merged 4 commits intopingdotgg:mainfrom
binbandit:t3code/fix-browser-worker-init-test

Conversation

@binbandit
Copy link
Contributor

@binbandit binbandit commented Mar 11, 2026

Summary

  • defer diff worker pool mounting until the diff UI is opened
  • keep the diff panel mounted after first open within a thread so close and reopen behavior stays stable
  • remove the eager chat-route worker pool mount that was triggering browser worker initialization during non-diff flows

Validation

  • bun run test:browser -- --maxWorkers=1
  • bun fmt
  • bun lint
  • bun typecheck

Note

Defer diff worker pool startup until the diff panel is first opened

  • The DiffWorkerPoolProvider is moved out of the chat route layout and into a new LazyDiffPanel component, so the worker pool is only instantiated when the diff panel is first opened.
  • ChatThreadRouteView tracks a hasOpenedDiff flag so the diff panel stays mounted (warm) after first open, avoiding re-initialization on close or thread switch.
  • Introduces DiffPanelShell, DiffPanelHeaderSkeleton, and DiffPanelLoadingState components to show a structured skeleton UI while the diff panel and worker pool load, replacing plain text fallbacks.
  • DiffLoadingFallback is updated to use these new skeleton components for both inline and sheet modes.

Macroscope summarized a532709.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0aedede2-db3a-420f-bb7b-a28871f8a332

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@github-actions github-actions bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Mar 11, 2026
@binbandit
Copy link
Contributor Author

@juliusmarminge #2 -- this fixes a flaky browser test

Copy link
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

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

this now creates 1 worker per thread though?

@github-actions github-actions bot added the size:M 30-99 changed lines (additions + deletions). label Mar 12, 2026
@binbandit
Copy link
Contributor Author

this now creates 1 worker per thread though?

Good catch. The previous version did reset the deferred mount on thread changes. I removed that reset so the worker pool still initializes lazily, but it stays warm across thread switches instead of being recreated per thread.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Mar 13, 2026
@juliusmarminge
Copy link
Member

@macroscope-app review this

@juliusmarminge juliusmarminge merged commit ac0d1f5 into pingdotgg:main Mar 13, 2026
11 checks passed
aaditagrawal added a commit to aaditagrawal/t3code that referenced this pull request Mar 13, 2026
Upstream features:
- Selective file staging in commit dialog (pingdotgg#872)
- Compact Codex tool-call icons in chat timeline (pingdotgg#988)
- Replace worktree toggle with Select dropdown (pingdotgg#1001)
- Timestamp format override setting (pingdotgg#855)
- Preferred editor resolver + useLocalStorage helper (pingdotgg#662)
- Extract reusable clipboard hook and media queries (pingdotgg#1006)
- Default thread env mode setting (pingdotgg#892)
- Block image uploads during plan mode (pingdotgg#621)

Upstream bug fixes:
- Prompt editor + Plan mode cursor fixes (pingdotgg#867)
- Composer @file autocomplete cursor/spacing bugs (pingdotgg#936)
- Diff panel unclosable after retainSearchParams (pingdotgg#937)
- Fix agent response duration always 1ms (pingdotgg#866)
- Defer diff worker startup until diff opens (pingdotgg#934)
- Fix new-thread shortcuts when terminal focused (pingdotgg#984)
- PlanSidebar memory leak fix (pingdotgg#949)
- WebSocket error logging (pingdotgg#948)
- Desktop "Check for Updates" dialog (pingdotgg#955)
- macOS logo alignment fix (pingdotgg#960)

Upstream tooling:
- Upgrade oxfmt/oxlint versions (pingdotgg#1010)
- Update @vitejs/plugin-react to 6.0.0 (pingdotgg#1002)
- Upgrade marketing app to Astro 6 (pingdotgg#1005)

Conflict resolutions:
- workspaceEntries.ts: kept our zortos-ported fuzzy search (better
  ranked insertion) over upstream's pingdotgg#256
- appSettings.ts: merged our display settings with upstream's timestamp
  format and env mode settings
- MessagesTimeline.tsx: merged our showCommandOutput gating with
  upstream's compact tool-call icons
- DiffPanel.tsx: fixed duplicate useAppSettings import
- open.test.ts: added missing node:fs/os/path imports for new test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants