Repository navigation
feat(settings): host-owned settings panes choose their host explicitly - #27265
Conversation
Settings gets a Host menu (this computer or a saved server). Provider accounts, agent detection and terminal capabilities follow it instead of the Active Server setting, which is only the menu's starting value. A server that is no longer saved reads unavailable and never falls back to another host. The provider-account client now takes the owner target instead of settings.
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Switching the Settings host can briefly show the previous server's accounts. Selecting or removing one during that time can send its account ID to the newly selected server. The Agents pane also tries to detect agents on a server that has been removed instead of showing it as unavailable. Fix both before merging. Pre-merge checks |
|
A Settings account switch on the chosen host flagged panes on the focused host instead. markLiveCodexSessionsForRestart and its lane matcher now take the owner target explicitly; Settings passes the picker's host, the status bar its focused target, and local sign-in this computer.
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ee3dbc41-55c8-49da-a3ad-a75e0ba2bb8c
📒 Files selected for processing (38)
config/owner-routing-baseline.txtsrc/renderer/src/components/agent/AgentSettingsDialog.tsxsrc/renderer/src/components/settings/AccountsPane.owner-scope.test.tsxsrc/renderer/src/components/settings/AccountsPane.section-lifetime.test.tsxsrc/renderer/src/components/settings/AccountsPane.test.tsxsrc/renderer/src/components/settings/AccountsPane.tsxsrc/renderer/src/components/settings/AgentsPane.test.tsxsrc/renderer/src/components/settings/AgentsPane.tsxsrc/renderer/src/components/settings/SettingsHostScopePicker.tsxsrc/renderer/src/components/settings/accounts-pane-account-actions.tssrc/renderer/src/components/settings/accounts-pane-claude-section.test.tsxsrc/renderer/src/components/settings/accounts-pane-claude-section.tsxsrc/renderer/src/components/settings/accounts-pane-codex-account-row.tsxsrc/renderer/src/components/settings/accounts-pane-codex-section.tsxsrc/renderer/src/components/settings/accounts-pane-removal-dialogs.tsxsrc/renderer/src/components/settings/accounts-pane-types.tssrc/renderer/src/components/settings/provider-account-scope.test.tssrc/renderer/src/components/settings/provider-account-scope.tssrc/renderer/src/components/settings/settings-capability-section-renderers.tsxsrc/renderer/src/components/settings/settings-host-scope.test.tssrc/renderer/src/components/settings/settings-host-scope.tssrc/renderer/src/components/settings/settings-page-renderer.tsxsrc/renderer/src/components/settings/use-settings-store-model.tssrc/renderer/src/components/settings/use-settings-terminal-model.tssrc/renderer/src/components/status-bar/ClaudeSwitcherMenu.tsxsrc/renderer/src/components/status-bar/codex-sign-in-action.tssrc/renderer/src/components/status-bar/codex-status-sign-in.test.tsxsrc/renderer/src/components/status-bar/use-codex-switcher-controller.tssrc/renderer/src/i18n/en-runtime-required.jsonsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/codex-pane-selection-lane.test.tssrc/renderer/src/lib/codex-pane-selection-lane.tssrc/renderer/src/lib/codex-session-restart-account-recheck.test.tssrc/renderer/src/lib/codex-session-restart-shell-flap.test.tssrc/renderer/src/lib/codex-session-restart.test.tssrc/renderer/src/lib/codex-session-restart.tssrc/renderer/src/runtime/runtime-provider-accounts-client.test.tssrc/renderer/src/runtime/runtime-provider-accounts-client.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| wslCapabilitiesLoading | ||
| }: AgentsPaneProps): React.JSX.Element { | ||
| const activeServerEnvironmentId = settings.activeRuntimeEnvironmentId?.trim() || null | ||
| const activeServerEnvironmentId = getSettingsHostScopeEnvironmentId(hostScope) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Stop agent detection for a removed host.
When the selected server is no longer saved, hostScope.available is false, but this code still passes its environment ID to useDetectedAgents. The Agents pane then attempts detection for the removed server instead of showing the unavailable notice used by Accounts. Gate detection on availability and show the unavailable state in both Settings and AgentSettingsDialog.
| <AccountsPane | ||
| settings={model.settings} | ||
| updateSettings={model.updateSettings} | ||
| hostScope={model.settingsHostScope} |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Reset AccountsPane state when the selected host changes.
When a user switches between two saved hosts, this branch keeps the same AccountsPane instance. Its previous roster and pending removal dialog remain visible while watchProviderAccounts loads the new host. A selection or confirmation during that interval sends a previous host’s account ID to the new accountOwner. Key the pane by owner, or reset its roster and pending dialogs before users can act on the new scope.
ELI5
Settings has panes that describe one particular machine: which AI provider accounts are signed in, which agents are installed, and which terminal shells exist. Until now those panes silently showed whatever server you last focused ("Active Server"). To look at this computer's accounts you had to switch your default server away and back. Now Settings has a Host menu at the top, and those panes show the host you pick there.
What Changed
Before: With a paired server focused, Settings › AI Provider Accounts listed the server's accounts, and the only way to see or change this computer's accounts was to switch the default server in Settings › Remote Orca Servers. That also moved new projects and every other focus-routed action. Agent detection in Settings › Agents and the Windows terminal capabilities (WSL, PowerShell, Git Bash) followed the same setting.
After:
Mechanism:
settings-host-scope.tsresolves the page's host from the user's choice. The setting is only the starting value. A server missing from the saved list resolves as unavailable, and an unloaded list is not treated as missing.AccountsPane,AgentsPaneand the terminal-capabilities model as an explicit prop.runtime-provider-accounts-client(watch, fetch, select, remove, owner key) now takes the ownerRuntimeClientTargetinstead of a settings object. The status-bar switchers pass the target they already computed, so their behaviour does not change.owner) explicitly, instead of reading the focused server. Settings passes the chosen host. The status-bar switch passes its focused target, and the status-bar sign-in (a local call) passes this computer. Without this, switching a local account in Settings while a server is focused would have flagged the server's panes and missed the local ones.Why
The design rule is that "the source is never chosen by focus" (D4-12). An in-page menu was chosen over two alternatives:
Starting on the setting keeps today's view, and the menu removes the need to move focus at all. Only saved Orca servers are listed. An SSH host has no account service (D4-1), and the RPC target type cannot name an SSH host behind a server yet.
Adapted from the design: the design lists GeneralPane, CLI skill setup and the Linear skill CTA here as well. They stay as they are and follow up separately:
Linked Issue
None. This is D4-V7a of the owner-routing stack. No open issue is closed by this alone.
Visual Proof
The new UI is a single shadcn
Selectrow above the settings content, shown only when a server is saved. Screenshots were not captured because this machine is load-capped (no local Electron). The control is the existingSelectprimitive, and the design-system gate passed on all changed lines.Testing
settings-host-scope.test.ts: the setting is only the starting value, a choice sticks, and a removed server is unavailable rather than falling back. An unloaded saved-server list is not treated as missing.AccountsPane.owner-scope.test.tsx: with focus on another server, the pane lists and watches the chosen host only. Late results stay with the server they were sent to.AgentsPane.test.tsx: detection uses the chosen host, not the focused server.codex-session-restart.test.ts: a switch on this computer while a server is focused flags the local pane.pnpm tc, focused vitest overcomponents/settings,components/status-bar,components/agentand the accounts client (301 files, 2209 tests),oxlint,pnpm run check:code-quality:changed, the owner-routing and max-lines ratchets, and the localization catalog checks.AI Disclosure
Claude (Opus 5.5).
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)