feat(desktop): scope Settings to Runtime Hosts - #3131
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review. 📝 WalkthroughProblem solvedDesktop Settings now scopes Host-owned pages to an explicitly selected Runtime Host. Host switching does not change the default Host, new-task target, or existing Sessions. Desktop-owned preferences, including Appearance, locale, keep-awake, and bot configuration, remain global. Source of truthThe PR extends the existing Runtime Host routing model. It reuses It does not create a parallel Host-selection path. Shared preload contracts, ownership helpers, target context, and bridge adapters route Host-owned operations through the selected Host. Scope and complexityThe change is the smallest coherent solution shown by the diff. The added context, ownership helpers, persistent client-settings IPC, Host-aware bridge adapters, stale-request protection, and unavailable-Host state are necessary to keep Desktop-owned and Host-owned settings on separate storage and routing paths. The persistent Settings mount preserves the current Host snapshot while Host and connection data refresh. This prevents background invalidations from discarding in-progress edits. Simplification opportunitiesThe PR removes duplicated settings-patch logic and obsolete connection props. No further deletion is identified without weakening Host isolation, unavailable-Host handling, stale-request protection, or regression coverage. Risks and validationConcrete risks include:
Added tests cover client-settings IPC filtering and keep-awake behavior without a Runtime Host. The PR reports successful Local and remote Host switching, typecheck, 893 Desktop tests, lint, formatting, build, and diff checks. These results remain unverified without direct check output. Review-relevant risksThe current diff changes user-visible Settings behavior. Material changes in this area require independent human review under repository policy. The current diff changes public preload contracts and IPC routing. Material public-contract changes require independent human review under repository policy. The current diff changes Runtime Host target verification and settings isolation. Material security changes require independent human review under repository policy. The person performing the merge reviews the final diff. A maintainer makes the final determination. WalkthroughThe change separates client-owned settings from Runtime Host settings. It adds persistent client-settings IPC, explicit Runtime Host selection, host-aware preload routing, and host-scoped settings operations across the desktop settings surface. ChangesRuntime Host settings
Estimated code review effort: 4 (Complex) | ~60 minutes Merge Risk: 🟠 High · up to This change routes settings and stored data to explicitly selected Runtime Hosts, but current code can show or save memory and project data under the wrong Host and may route settings to a disabled Host. These cross-Host correctness and data-isolation risks make the PR unsafe to merge until addressed. Sequence Diagram(s)sequenceDiagram
participant SettingsSurface
participant PreloadBridge
participant RuntimeHost
participant SettingsStore
SettingsSurface->>PreloadBridge: call operation with DesktopRuntimeHostRef
PreloadBridge->>RuntimeHost: resolve selected host
RuntimeHost->>SettingsStore: read or update host settings
SettingsStore-->>RuntimeHost: settings result
RuntimeHost-->>PreloadBridge: routed response
PreloadBridge-->>SettingsSurface: render host-scoped state
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
fa1e865 to
b4bc838
Compare
b4bc838 to
103645b
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d774a84c-4d41-4925-99fe-ea8ca59293fa
📒 Files selected for processing (32)
apps/desktop/src/main/__tests__/client-settings-ipc-main.test.tsapps/desktop/src/main/client-settings-ipc-main.tsapps/desktop/src/main/runtime-host-boot.tsapps/desktop/src/main/runtime-host-settings-ipc-main.tsapps/desktop/src/preload/bridge-contract.d.tsapps/desktop/src/preload/preload.tsapps/desktop/src/renderer/app-shell-overlays.tsxapps/desktop/src/renderer/app-shell.tsxapps/desktop/src/renderer/locales/settings-shared-copy.tsapps/desktop/src/renderer/settings/claude-subscription-card.tsxapps/desktop/src/renderer/settings/daily-review-settings-page.tsxapps/desktop/src/renderer/settings/general-settings-page.tsxapps/desktop/src/renderer/settings/projects-settings-page.tsxapps/desktop/src/renderer/settings/provider-connection-detail.tsxapps/desktop/src/renderer/settings/provider-oauth-section.tsxapps/desktop/src/renderer/settings/providers-panel.tsxapps/desktop/src/renderer/settings/runtime-host-settings-bridge.tsapps/desktop/src/renderer/settings/runtime-host-settings-target.tsxapps/desktop/src/renderer/settings/settings-modal.tsxapps/desktop/src/renderer/settings/settings-nav.tsapps/desktop/src/renderer/settings/settings-surface.tsxapps/desktop/src/renderer/settings/use-connection-detail.tsapps/desktop/src/renderer/settings/use-memory-settings-controller.tsapps/desktop/src/renderer/settings/web-search-settings-page.tsxapps/desktop/src/renderer/styles/settings/nav-sidebar.cssapps/desktop/src/shared/settings-ownership.tsapps/desktop/stories/settings/provider-settings.stories.tsxapps/desktop/stories/settings/settings-pages.stories.tsxdocs/architecture/runtime-host-architecture.mddocs/architecture/runtime-host-architecture.zh-CN.mddocs/astryx-surface-file-inventory.mddocs/astryx-surface-file-inventory.paths
💤 Files with no reviewable changes (1)
- apps/desktop/src/renderer/app-shell.tsx
Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.
e670856 to
b63e275
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0787ad48-b7cb-49d2-8428-3e67c610bcc9
📒 Files selected for processing (12)
apps/desktop/src/main/__tests__/use-keep-system-awake.test.tsapps/desktop/src/preload/preload.tsapps/desktop/src/renderer/app-shell-effects.tsapps/desktop/src/renderer/settings/general-settings-page.tsxapps/desktop/src/renderer/settings/personalization-settings-section.tsxapps/desktop/src/renderer/settings/projects-settings-page.tsxapps/desktop/src/renderer/settings/runtime-host-settings-target.tsxapps/desktop/src/renderer/settings/settings-nav.tsapps/desktop/src/renderer/settings/settings-surface.tsxapps/desktop/src/renderer/use-keep-system-awake.tsapps/desktop/src/renderer/use-shell-appearance.tsapps/desktop/stories/settings/settings-pages.stories.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
- apps/desktop/src/renderer/settings/settings-nav.ts
- apps/desktop/stories/settings/settings-pages.stories.tsx
- apps/desktop/src/renderer/settings/settings-surface.tsx
- apps/desktop/src/preload/preload.ts
Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/settings/settings-surface.tsx (1)
211-227: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winKeep the selected Runtime Host enabled.
If
next.defaultProfileIdidentifies a disabled entry, Line 486 selects it although Lines 570-576 exclude disabled entries from the selector. Lines 211-227 then create aDesktopRuntimeHostRefwithout checkingentry.enabled. Runtime Host pages can route to a disabled Host, or show unavailable while an enabled Host exists.Select the default only when it is enabled. Otherwise select an enabled entry or leave the selection unset. Also reject disabled entries when deriving
selectedRuntimeHost.Proposed fix
const selectedRuntimeHostEntry = runtimeHosts?.entries.find( - (entry) => entry.profile.id === selectedProfileId, + (entry) => entry.profile.id === selectedProfileId && entry.enabled, ); ... + const fallback = next.entries.find( + (entry) => + entry.profile.id === next.defaultProfileId && entry.enabled, + ) ?? next.entries.find((entry) => entry.enabled); return next.defaultProfileId; + return fallback?.profile.id;This violates the PR objective that Settings are scoped to enabled Runtime Hosts. As per path instructions: “Review the diff adversarially against the problem it claims to solve.”
Also applies to: 479-487
Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: cfb45646-cabe-4fa4-871e-7f0a43308792
📒 Files selected for processing (5)
apps/desktop/src/main/__tests__/client-settings-ipc-main.test.tsapps/desktop/src/main/client-settings-ipc-main.tsapps/desktop/src/renderer/app-shell-effects.tsapps/desktop/src/renderer/settings/settings-surface.tsxapps/desktop/src/renderer/use-shell-appearance.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- apps/desktop/src/main/tests/client-settings-ipc-main.test.ts
- apps/desktop/src/renderer/app-shell-effects.ts
- apps/desktop/src/main/client-settings-ipc-main.ts
- apps/desktop/src/renderer/use-shell-appearance.ts
Included review availability: Your plan includes up to 3 reviews per rolling hour; 2 remain after this review.
29f5b47 to
fb7557c
Compare
Host-owned Settings previously followed the default Host, making multi-host configuration ambiguous. Add explicit target selection while keeping client preferences and bot configuration Desktop-owned. Route reads, writes, events, connections, and credentials through the verified target scope without changing the default Host or existing Sessions. Generated-by: OpenAI Codex
Bind asynchronous Host settings and connection snapshots to their selected target so late or failed loads cannot surface data from another Host. Keep Desktop-owned preferences available independently, preserve every-Host connection events, and make profile catalog failures recoverable. Generated-by: Codex
Keep Desktop appearance and client-setting events independent from Runtime Host availability. Make Host resource reloads settle through their owned error state so a failed refresh cannot misreport a successful mutation, and preserve newly submitted bot credentials at the update response boundary. Generated-by: Codex
Preserve the selected Host snapshot while its settings and connections refresh, so background invalidations cannot discard in-progress edits. Route Host-backed diagnostics, imports, and configuration through that same target instead of silently falling back to the default Host. Generated-by: OpenAI Codex
fb7557c to
10fbac9
Compare
|
I have manually verified the changes in the current PR and found no obvious issues. Given that there are currently no users for the remote runtime host, and the current changes have a minor impact and are easy to roll back, I have decided to merge them, and I take responsibility for the outcome. |
Keep native path actions and display metadata bound to the Runtime Host selected in Settings. Filter selected-Host events against the live target epoch so reconnects do not silently disable refreshes. Generated-by: OpenAI Codex
There was a problem hiding this comment.
Pull request overview
Scopes Desktop Settings pages to an explicitly selected Runtime Host, enabling per-Host configuration (connections, credentials, memory, search, Daily Review, etc.) without changing the default Host/new-task target or existing Sessions. This extends the existing multi-Host identity + target-epoch fencing model into settings routing, while keeping Desktop-owned preferences (appearance/locale/etc.) independent.
Changes:
- Added a Runtime Host settings target context + host-scoped bridges, and updated settings pages to pass/consume an explicit Host target for Host-owned reads/writes.
- Split Desktop-owned settings reads/writes into
settings.getClient()/settings.updateClient()with new client-settings IPC wiring, and updated shell hydration/subscriptions accordingly. - Updated docs and Storybook stories to reflect the new Host-scoped Settings behavior and surfaces inventory.
Reviewed changes
Copilot reviewed 40 out of 41 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/astryx-surface-file-inventory.paths | Registers the new settings target module in the surface inventory. |
| docs/astryx-surface-file-inventory.md | Updates inventory totals and settings surface entries. |
| docs/architecture/runtime-host-architecture.md | Documents Host-scoped Settings behavior (explicit Host selector; client prefs remain global). |
| docs/architecture/runtime-host-architecture.zh-CN.md | Same as above for zh-CN architecture guide. |
| apps/desktop/stories/settings/settings-pages.stories.tsx | Updates Storybook bridge mocks for split client/host settings and runtime host profiles. |
| apps/desktop/stories/settings/provider-settings.stories.tsx | Wraps provider story in RuntimeHostSettingsTarget for host-scoped pages. |
| apps/desktop/src/shared/settings-ownership.ts | Introduces shared helpers to separate client-owned vs host-owned settings patches and projections. |
| apps/desktop/src/renderer/use-shell-appearance.ts | Hydrates appearance/locale from client settings and host-owned fields from host settings. |
| apps/desktop/src/renderer/use-keep-system-awake.ts | Moves keep-awake toggle to client settings so it works while hosts are offline. |
| apps/desktop/src/renderer/styles/settings/nav-sidebar.css | Adds layout class for the runtime host selector in the header. |
| apps/desktop/src/renderer/settings/web-search-settings-page.tsx | Routes web search test/query calls through the selected runtime host target. |
| apps/desktop/src/renderer/settings/use-memory-settings-controller.ts | Scopes memory state/mutations to the selected runtime host. |
| apps/desktop/src/renderer/settings/use-connection-detail.ts | Scopes OAuth flows and provider actions to the selected runtime host. |
| apps/desktop/src/renderer/settings/settings-surface.tsx | Implements host selector, per-host resource loading, and split client/host settings state management. |
| apps/desktop/src/renderer/settings/settings-nav.ts | Adds section scope classification (client/mixed/runtime-host) to drive host selector + gating. |
| apps/desktop/src/renderer/settings/settings-modal.tsx | Removes default-host connection props; SettingsSurface now self-loads per selected host. |
| apps/desktop/src/renderer/settings/runtime-host-settings-target.tsx | Adds context + hooks for selected Runtime Host settings target propagation. |
| apps/desktop/src/renderer/settings/runtime-host-settings-bridge.ts | Adds host-scoped connections bridge and OAuth-login bridge wrappers. |
| apps/desktop/src/renderer/settings/providers-panel.tsx | Uses injected bridge for set-default connection (host-scoped). |
| apps/desktop/src/renderer/settings/provider-oauth-section.tsx | Scopes OAuth subscription state/actions to the selected runtime host. |
| apps/desktop/src/renderer/settings/provider-connection-detail.tsx | Scopes GitHub Copilot re-login action to the selected runtime host. |
| apps/desktop/src/renderer/settings/projects-settings-page.tsx | Scopes projects catalog/subscriptions/actions to the selected runtime host and adds unavailable-state banner. |
| apps/desktop/src/renderer/settings/personalization-settings-section.tsx | Gates host-owned identity fields behind runtime-host availability. |
| apps/desktop/src/renderer/settings/permission-center-page.tsx | Scopes permission/capability snapshots and actions to the selected runtime host. |
| apps/desktop/src/renderer/settings/import-tasks-settings-page.tsx | Scopes external session sources/list/import to the selected runtime host. |
| apps/desktop/src/renderer/settings/health-center-page.tsx | Scopes health snapshot to the selected runtime host. |
| apps/desktop/src/renderer/settings/general-settings-page.tsx | Adds runtime-host availability gating and routes network proxy testing + defaults to host-scoped bridges. |
| apps/desktop/src/renderer/settings/data-settings-page.tsx | Scopes app info + config import/export to selected host and adds unavailable-state banner/gating. |
| apps/desktop/src/renderer/settings/daily-review-settings-page.tsx | Scopes Daily Review config reads/writes to the selected runtime host. |
| apps/desktop/src/renderer/settings/claude-subscription-card.tsx | Scopes Claude subscription actions to the selected runtime host. |
| apps/desktop/src/renderer/locales/settings-shared-copy.ts | Adds localized copy for runtime host selector/unavailable states. |
| apps/desktop/src/renderer/app-shell.tsx | Stops passing default-host connections into settings overlay (settings now self-resolve). |
| apps/desktop/src/renderer/app-shell-overlays.tsx | Removes settings modal props tied to default-host connection state. |
| apps/desktop/src/renderer/app-shell-effects.ts | Adds subscription for client settings changes and adjusts settings refresh wiring. |
| apps/desktop/src/preload/preload.ts | Adds host-scoped invocation/subscription helpers and splits settings client vs host APIs. |
| apps/desktop/src/preload/bridge-contract.d.ts | Introduces DesktopRuntimeHostRef and updates bridge signatures to accept optional host targets. |
| apps/desktop/src/main/runtime-host-settings-ipc-main.ts | Reuses shared ownership helpers; keeps client-owned patches in Desktop store while applying runtime policy to host. |
| apps/desktop/src/main/runtime-host-boot.ts | Registers new client settings IPC + shifts bots/settings notifications to client-owned channels. |
| apps/desktop/src/main/client-settings-ipc-main.ts | New IPC for client settings get/update with patch filtering and masked responses. |
| apps/desktop/src/main/tests/use-keep-system-awake.test.ts | Adds coverage for keep-awake toggle remaining functional without host settings bridge. |
| apps/desktop/src/main/tests/client-settings-ipc-main.test.ts | Adds coverage ensuring client settings IPC filters host-owned policy and returns submitted secrets. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
English
Summary
Desktop Settings can now target any enabled Runtime Host without changing the default Host, new-task target, or existing Sessions. Host-owned pages use an explicit Host selector, while Client-owned preferences and bot configuration remain a single Desktop concern.
The same verified profile/root identity and target-generation fence used by multi-Host session routing now scopes settings, connections, credentials, projects, memory, search, and Daily Review.
Refs #2522
Verification
npm --workspace @maka/desktop run typechecknpm --workspace @maka/desktop test— 893 passednpm run lintnpm run format:checknpm run buildgit diff --checkAI use
Tool(s) and scope: OpenAI Codex implemented the Desktop, preload, and Runtime Host settings routing changes and ran the listed validation under maintainer direction.
Checklist
Does this PR entail a change in behavior?
中文
摘要
Desktop Settings 现在可以显式选择任意已启用的 Runtime Host,而不会改变默认 Host、新任务目标或已有 Session。Host-owned 页面显示 Host selector;Client-owned 偏好和 Bot 配置仍由 Desktop 唯一拥有。
设置、模型连接、凭据、项目、记忆、联网搜索和每日回顾均复用 Multi-Host Session 路由已有的 profile/root identity 与 target-generation fence。
关联 #2522
验证
AI 使用
OpenAI Codex 在维护者指导下实现 Desktop、preload 与 Runtime Host 的设置路由变更,并执行上述验证。