Skip to content

feat(settings): host-owned settings panes choose their host explicitly - #27265

Merged
OrcaWin merged 3 commits into
mainfrom
OrcaWin/d4-d4-v7a
Oct 10, 2026
Merged

OrcaWin merged 3 commits into
mainfrom
OrcaWin/d4-d4-v7a

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • If you have at least one saved server, Settings shows a Host menu above the panes, listing this computer and each saved server. It starts on the "Active Server" setting, so nothing changes until you choose. Picking a host changes only what Settings shows. It does not change the default server.
  • AI Provider Accounts (list, switch, remove, OpenCode/Devin data accounts, Antigravity), Agents detection, and the terminal capabilities that Settings loads all follow the chosen host.
  • If the chosen server is removed while Settings is open, the menu shows " (unavailable)" and the Accounts pane says so. It never falls back to this computer or to another server, so an account switch can never reach a machine you did not pick.
  • The remote-accounts notice now says to choose this computer in the Host menu, instead of telling you to switch the default server.

Mechanism:

  • settings-host-scope.ts resolves 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.
  • The Settings page model owns the choice. It passes the scope to AccountsPane, AgentsPane and the terminal-capabilities model as an explicit prop.
  • runtime-provider-accounts-client (watch, fetch, select, remove, owner key) now takes the owner RuntimeClientTarget instead of a settings object. The status-bar switchers pass the target they already computed, so their behaviour does not change.
  • Codex "restart this pane" notices after an account change now take the host that was written (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.
  • The owner-routing ratchet drops from 223 to 211 focus-routed call sites (12 removed, none added).

Why

The design rule is that "the source is never chosen by focus" (D4-12). An in-page menu was chosen over two alternatives:

  • Always defaulting to this computer would silently move a remote user's Accounts pane to local accounts. Someone could then switch an account on the wrong machine.
  • Keeping the focus setting is the bug this PR fixes.

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:

  • GeneralPane: its worktree-visibility defaults are hydrated and written by the settings store for the focused owner. Moving them needs a store change, not a pane change.
  • CLI skill setup and the Linear skill CTA: they build a command for the terminal that a new tab opens on the default host. They belong to the default-creation-host read, not to this menu.

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 Select row 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 existing Select primitive, and the design-system gate passed on all changed lines.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated
    • 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.
    • Updated the provider-accounts client and status-bar tests for the target-based signature.
  • pnpm tc, focused vitest over components/settings, components/status-bar, components/agent and 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH: account mutations are never sent to an SSH host. The menu lists only this computer and saved Orca servers.
  • Web client: the menu is hidden and the scope stays on its server, as before.
  • Windows/WSL: the terminal capabilities load for the chosen host, and they are not loaded at all for an unavailable one.
  • Mixed versions: no RPC or wire change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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.
@OrcaWin
OrcaWin requested a review from brennanb2025 as a code owner October 10, 2026 15:24
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Walkthrough

Settings now includes a host picker that resolves local or runtime-environment scope and tracks whether a selected environment is available. Settings panes use that scope for account ownership, agent detection, and capability loading. Provider-account APIs and Codex session restart handling now receive explicit runtime targets or owners.


Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 98b18

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 | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 17.95% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 39 functions across 35 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: host-owned Settings panes can choose their host explicitly.
Description check Passed The description is detailed and covers the user impact, implementation, rationale, testing, compatibility notes, and checklist. It notes that no linked issue or screenshots are available and that manu…
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.

Full details: Docstring Coverage

Explanation

Docstring coverage is 17.95% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 39 functions across 35 files. (3 skipped: 3 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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

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.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ee3dbc41-55c8-49da-a3ad-a75e0ba2bb8c
📥 Commits

Reviewing files that changed from the base of the PR and between ba1474f and 98b18f3.

📒 Files selected for processing (38)
  • config/owner-routing-baseline.txt
  • src/renderer/src/components/agent/AgentSettingsDialog.tsx
  • src/renderer/src/components/settings/AccountsPane.owner-scope.test.tsx
  • src/renderer/src/components/settings/AccountsPane.section-lifetime.test.tsx
  • src/renderer/src/components/settings/AccountsPane.test.tsx
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/components/settings/SettingsHostScopePicker.tsx
  • src/renderer/src/components/settings/accounts-pane-account-actions.ts
  • src/renderer/src/components/settings/accounts-pane-claude-section.test.tsx
  • src/renderer/src/components/settings/accounts-pane-claude-section.tsx
  • src/renderer/src/components/settings/accounts-pane-codex-account-row.tsx
  • src/renderer/src/components/settings/accounts-pane-codex-section.tsx
  • src/renderer/src/components/settings/accounts-pane-removal-dialogs.tsx
  • src/renderer/src/components/settings/accounts-pane-types.ts
  • src/renderer/src/components/settings/provider-account-scope.test.ts
  • src/renderer/src/components/settings/provider-account-scope.ts
  • src/renderer/src/components/settings/settings-capability-section-renderers.tsx
  • src/renderer/src/components/settings/settings-host-scope.test.ts
  • src/renderer/src/components/settings/settings-host-scope.ts
  • src/renderer/src/components/settings/settings-page-renderer.tsx
  • src/renderer/src/components/settings/use-settings-store-model.ts
  • src/renderer/src/components/settings/use-settings-terminal-model.ts
  • src/renderer/src/components/status-bar/ClaudeSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/codex-sign-in-action.ts
  • src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx
  • src/renderer/src/components/status-bar/use-codex-switcher-controller.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/codex-pane-selection-lane.test.ts
  • src/renderer/src/lib/codex-pane-selection-lane.ts
  • src/renderer/src/lib/codex-session-restart-account-recheck.test.ts
  • src/renderer/src/lib/codex-session-restart-shell-flap.test.ts
  • src/renderer/src/lib/codex-session-restart.test.ts
  • src/renderer/src/lib/codex-session-restart.ts
  • src/renderer/src/runtime/runtime-provider-accounts-client.test.ts
  • src/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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ 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.

@OrcaWin
OrcaWin merged commit 865183c into main Oct 10, 2026
29 checks passed
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.

1 participant