Skip to content

perf(web): switching project keeps Diagnostics and Providers mounted - #17122

Merged
Yash-Singh1 merged 2 commits into
pingdotgg:mainfrom
flamboh:t3/perf-settings-scope-remount
Oct 10, 2026
Merged

Yash-Singh1 merged 2 commits into
pingdotgg:mainfrom
flamboh:t3/perf-settings-scope-remount

Conversation

@flamboh

@flamboh flamboh commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Note

🤖 Claude Opus 5.5 on behalf of Oliver

Problem

The Settings layout keys its content on the whole scope search, so changing the project scope remounts the page. Diagnostics and Providers belong to an environment and don't change with project. Every project switch rebuilt them from scratch.

Fix

On Diagnostics and Providers, the layout now keys its content on the resolved environment (useSettingsScope().environment?.environmentId) plus the restore signal. Other pages keep the full scope key. Switching project keeps those two pages mounted. They still reset when the environment changes, including an implicit change with no machine in the URL, and when the environment disconnects.

Since those pages no longer remount on a project switch, the scope menus now close when you pick an item (closeOnClick). Other pages already closed them by remounting.

This PR is independent of #17120 and based on main.

Switch project scope Before → after (CPU task time)
Diagnostics, production 455 → 210 ms
Diagnostics, dev 286 → 157 ms
Providers, production 210 → 100 ms
Providers, dev 167 → 64 ms

Each median comes from 6 interleaved before/after runs in headless Chromium, on an isolated dev server and on the production build. Production runs use 4× CPU throttling. These were measured while this branch was still stacked on #17120, so both sides include #17120's shared Diagnostics tooltip, and the after side used an earlier environment key. Either key leaves the page mounted on a project switch, so the comparison holds, but I have not re-measured this rebuilt branch.

Before and after

Diagnostics, switching project scope three times. Before rebuilds the page on every switch; after keeps it mounted. In this take the three switches took 540 / 483 / 397 → 294 / 166 / 205 ms.

https://gh-file-drop-api-prod-galwoqjslzlnws6s.oliver-boorstein.workers.dev/f/9f4be9bdbd01efd1/pr17122-before-after.mp4

Production build, headless Chromium, CPU throttled 4× during the interaction. Before is main. After is the earlier stacked version of this branch (a86c58b9ca), which behaves the same on a project switch. These are single takes, so treat the timings as illustrative; the table above has the medians.

Scope and approval

I found no existing issue or discussion about Settings performance, so no maintainer has approved this yet. It is a focused performance improvement with no intended behavior change, which CONTRIBUTING lists among the changes most likely to be accepted. It is part of a Settings performance series: #17119, #17120, #17121, #17122 and #17123.

Validation

  • Web typecheck passes and targeted lint is clean. 207 tests pass across 17 settings test files.
  • settingsScopeRetention.test.tsx checks that Diagnostics and Providers keep their state across a project switch. It also checks that they reset on an environment switch, an implicit environment change and a disconnect, and that Keybindings still resets on a project switch. Against main's layout, 5 of its 8 cases fail. Against the earlier machine key, the implicit-change and disconnect cases fail.
  • Earlier headless checks on the stacked version covered all 18 scope switches per page. They have not been re-run on this rebuilt branch.
  • Not exercised: a second live environment.

Implemented by GPT-6.1 Sol (Codex harness, delegated through T3 Code). Split, verified, opened and given regression tests by Claude Opus 5.5 (Claude Code). Rebuilt on main after review by Claude Opus 5.5 via Claude Code in T3 Code.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 8, 2026
@flamboh
flamboh marked this pull request as ready for review October 8, 2026 08:43
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 8, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 2e74ff6

Macroscope's review found this PR approvable — This is a small, localized settings UI optimization: Diagnostics and Providers retain their state across project switches while still resetting for environment changes, with regression coverage for the relevant transitions. It introduces no schema, deployment, security, billing, default, or static-analysis changes.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 918b1d98-7fe0-47da-95cd-cfc6cbd3031a

📥 Commits

Reviewing files that changed from the base of the PR and between 9e40195 and 2e74ff6.


📒 Files selected for processing (3)
  • apps/web/src/components/settings/SettingsScopeSentence.tsx
  • apps/web/src/components/settings/settingsScopeRetention.test.tsx
  • apps/web/src/routes/settings.tsx

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



📝 Walkthrough

Walkthrough

Settings scope menu items now close when selected. Diagnostics and providers key their content by the selected environment ID. Tests check how outlet state responds to scope changes.

Changes

Settings scope behavior

Layer / File(s) Summary
Close scope menus after selection
apps/web/src/components/settings/SettingsScopeSentence.tsx
All-environments, individual-environment, all-projects, and individual-project radio items close their menus when clicked.
Key settings content by route scope
apps/web/src/routes/settings.tsx, apps/web/src/components/settings/settingsScopeRetention.test.tsx
Diagnostics and providers use the selected environment ID as the content key. Other settings pages use serialized search state. Tests check state retention for project changes and resets for environment, implicit-environment, and disconnect changes.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge


Merge Risk: ⚪ Minimal · up to 2e74f

The change keeps Diagnostics and Providers mounted when the project changes, and closes the scope menus after a selection. No concrete merge-blocking risk was identified.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 2e74f

The retained state remains environment-owned. Environment changes still reset the affected pages, and privileged actions continue to carry an explicit environment identity and use permission checks. No material security risk introduced or worsened by this change was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed lifetime reaches environment-sensitive diagnostics and provider-management actions, but inspected dispatch paths retain explicit environment targets. A project-only switch does not select a new command destination or grant additional authority; an environment switch changes outlet identity.

Trust Boundaries and Controls

  • observed — Diagnostics process signaling checks maintenance permission before initiation, rejects re-entry, and after confirmation rechecks environment identity, permission and process start time. Environment RPC commands bind execution to the supplied environment and invoke authorization before guarded dispatch, including a destination authorization callback.

Resilience and Maintainability Implications

  • observed — Started commands are not coupled to component-unmount cancellation by the unchanged command hook; runtime execution mounts and waits in its own scope. Failures settle into command results, queries are keyed by environment and input, and provider refreshes use environment-sensitive single-flight keys. The PR therefore does not remove an existing hook-level unmount cancellation control.


Pre-merge checks | Passed 4
✅ 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 main change: keeping Diagnostics and Providers mounted when switching projects.
Description check Passed The description is mostly complete. It explains the problem, fix, scope rationale, performance results, validation, limitations, and implementation details. It includes a before-and-after recording, b…


✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@flamboh
flamboh force-pushed the t3/perf-settings-scope-remount branch from a86c58b to 1a616c0 Compare October 8, 2026 16:37
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Oct 8, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 8, 2026 16:38

Dismissing prior approval to re-evaluate 1a616c0

@flamboh
flamboh force-pushed the t3/perf-settings-scope-remount branch from 1a616c0 to b14dd4c Compare October 9, 2026 06:52
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Oct 9, 2026
@flamboh
flamboh force-pushed the t3/perf-settings-scope-remount branch 2 times, most recently from 6e81c34 to 9e40195 Compare October 9, 2026 06:59
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Oct 9, 2026
Key their settings content on the resolved environment instead of the whole scope search, and close the scope menus on selection since those pages no longer remount.
@flamboh
flamboh force-pushed the t3/perf-settings-scope-remount branch from 9e40195 to 2e74ff6 Compare October 10, 2026 00:22
@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Oct 10, 2026
@Yash-Singh1
Yash-Singh1 merged commit 8bf0a38 into pingdotgg:main Oct 10, 2026
31 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 10, 2026
## What's Changed
* fix(web): align compact button touch targets by @Yash-Singh1 in pingdotgg/t3code#17748
* fix(server): t3_thread_launch refuses a new worktree whose base ref has no commit by @tris203 in pingdotgg/t3code#17791
* fix(web): omit underlines on markdown image links by @Saikrishna1876 in pingdotgg/t3code#17728
* fix(server): restore auto resume for wrapped Claude gateway rate limits by @tzachbon in pingdotgg/t3code#17778
* fix(opencode): name OpenCode 2 sessions after their thread by @nkoynov in pingdotgg/t3code#17414
* fix(web): find update settings from the command palette by @sergical in pingdotgg/t3code#17396
* fix(provider-opencode): tell OpenCode Zen and Go models apart by @mr-karan in pingdotgg/t3code#17424
* fix(server): a pull that fast-forwards no longer fails on large Git output by @ScottN-PV in pingdotgg/t3code#17376
* fix(web): cancel question auto-advance after navigation by @maxwellyoung in pingdotgg/t3code#17364
* fix(server): a bare repository name resolves to the signed-in account again by @ScottN-PV in pingdotgg/t3code#17379
* fix(web): a maximized right panel stays maximized when you return to its thread by @jamesvillarrubia in pingdotgg/t3code#17327
* fix(mobile): allow starting a task with only an image by @Claudesaul in pingdotgg/t3code#17409
* fix(server): PR watch no longer reports passed while a second run of a check is still going by @ScottN-PV in pingdotgg/t3code#17344
* fix(server): say why a thread can't be settled by @DylanTX in pingdotgg/t3code#17258
* fix(server): prevent busy terminals from starving history persistence by @StiensWout in pingdotgg/t3code#17181
* feat(server): use macOS .icns app icons as project icons by @psv2522 in pingdotgg/t3code#17149
* fix(mobile): usage reset icon lines up with its row by @Aforno in pingdotgg/t3code#17175
* fix(web): paths pasted after @ keep their underscores by @derektrimm in pingdotgg/t3code#16619
* fix(server): settle every OpenCode subagent call one report answers by @nkoynov in pingdotgg/t3code#17134
* perf(web): switching project keeps Diagnostics and Providers mounted by @flamboh in pingdotgg/t3code#17122
* perf(web): Open Source Licenses downloads its manifest once per session by @flamboh in pingdotgg/t3code#17119
* fix(server): restore OpenCode adapter test typecheck by @Yash-Singh1 in pingdotgg/t3code#17810
* fix(server): Claude subagents show the reasoning effort they run at by @RakshithBhat03 in pingdotgg/t3code#17496

## New Contributors
* @tzachbon made their first contribution in pingdotgg/t3code#17778
* @sergical made their first contribution in pingdotgg/t3code#17396
* @mr-karan made their first contribution in pingdotgg/t3code#17424
* @Claudesaul made their first contribution in pingdotgg/t3code#17409
* @DylanTX made their first contribution in pingdotgg/t3code#17258
* @psv2522 made their first contribution in pingdotgg/t3code#17149

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261010.2922...v0.0.46-nightly.20261010.2935

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261010.2935
github-actions Bot added a commit to davidvanderklay/t3code-flake that referenced this pull request Oct 10, 2026
## What's Changed
* fix(web): align compact button touch targets by @Yash-Singh1 in pingdotgg/t3code#17748
* fix(server): t3_thread_launch refuses a new worktree whose base ref has no commit by @tris203 in pingdotgg/t3code#17791
* fix(web): omit underlines on markdown image links by @Saikrishna1876 in pingdotgg/t3code#17728
* fix(server): restore auto resume for wrapped Claude gateway rate limits by @tzachbon in pingdotgg/t3code#17778
* fix(opencode): name OpenCode 2 sessions after their thread by @nkoynov in pingdotgg/t3code#17414
* fix(web): find update settings from the command palette by @sergical in pingdotgg/t3code#17396
* fix(provider-opencode): tell OpenCode Zen and Go models apart by @mr-karan in pingdotgg/t3code#17424
* fix(server): a pull that fast-forwards no longer fails on large Git output by @ScottN-PV in pingdotgg/t3code#17376
* fix(web): cancel question auto-advance after navigation by @maxwellyoung in pingdotgg/t3code#17364
* fix(server): a bare repository name resolves to the signed-in account again by @ScottN-PV in pingdotgg/t3code#17379
* fix(web): a maximized right panel stays maximized when you return to its thread by @jamesvillarrubia in pingdotgg/t3code#17327
* fix(mobile): allow starting a task with only an image by @Claudesaul in pingdotgg/t3code#17409
* fix(server): PR watch no longer reports passed while a second run of a check is still going by @ScottN-PV in pingdotgg/t3code#17344
* fix(server): say why a thread can't be settled by @DylanTX in pingdotgg/t3code#17258
* fix(server): prevent busy terminals from starving history persistence by @StiensWout in pingdotgg/t3code#17181
* feat(server): use macOS .icns app icons as project icons by @psv2522 in pingdotgg/t3code#17149
* fix(mobile): usage reset icon lines up with its row by @Aforno in pingdotgg/t3code#17175
* fix(web): paths pasted after @ keep their underscores by @derektrimm in pingdotgg/t3code#16619
* fix(server): settle every OpenCode subagent call one report answers by @nkoynov in pingdotgg/t3code#17134
* perf(web): switching project keeps Diagnostics and Providers mounted by @flamboh in pingdotgg/t3code#17122
* perf(web): Open Source Licenses downloads its manifest once per session by @flamboh in pingdotgg/t3code#17119
* fix(server): restore OpenCode adapter test typecheck by @Yash-Singh1 in pingdotgg/t3code#17810
* fix(server): Claude subagents show the reasoning effort they run at by @RakshithBhat03 in pingdotgg/t3code#17496

## New Contributors
* @tzachbon made their first contribution in pingdotgg/t3code#17778
* @sergical made their first contribution in pingdotgg/t3code#17396
* @mr-karan made their first contribution in pingdotgg/t3code#17424
* @Claudesaul made their first contribution in pingdotgg/t3code#17409
* @DylanTX made their first contribution in pingdotgg/t3code#17258
* @psv2522 made their first contribution in pingdotgg/t3code#17149

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261010.2922...v0.0.46-nightly.20261010.2935

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261010.2935
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 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