feat(web): per-device provider settings#4479
Conversation
Providers settings were hardwired to the primary backend, so remote boxes reached through T3 Connect or app.t3.codes could not be configured. - List every registered execution environment and let one be selected - Scope provider reads, settings writes, refreshes, updates, and instance creation to the selected environment - Gate controls on raw server config, connection phase, and operate scope - Keep shared model preferences intact when removing per-device config Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This PR introduces a significant new feature (per-device provider settings) with substantial new code including new components, environment selection logic, and access control. There is also an unresolved comment identifying a potential bug in the access control flow for remote environments. You can customize Macroscope's approvability policy. Learn more. |
Addresses review findings on the per-device providers panel. - Treat unresolved primary session scopes as loading instead of editable, so controls are never offered before permissions are known - Render provider status rows for read-only sessions instead of replacing the whole panel with a blocking message - Distinguish a hydrating environment catalog from having no devices Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Addressed all three Bugbot findings in 6a822e6. Unknown operate access treated as editable (medium) — Read-only blocked provider viewing (medium) — read-only sessions now render a Loading catalog looked empty (low) — the panel now reads Verification: |
| // Remote connection brokers request the standard client scopes, which include | ||
| // orchestration:operate. The environment RPC layer remains authoritative if a | ||
| // custom remote credential grants less access. | ||
| const operateAccess: ProviderOperateAccess = !isPrimary |
There was a problem hiding this comment.
🟡 Medium settings/ProviderSettingsPanel.tsx:303
operateAccess is hardcoded to "granted" for every non-primary environment, so a remote environment connected with a credential that lacks orchestration:operate renders the full editable UI instead of ReadOnlyProviderSettings. The user is offered edit controls that the authoritative environment RPC will reject, producing failed writes. As the adjacent comment notes, lower-scope remote credentials are a supported case, so remote access must be derived from that environment's actual session scopes rather than assumed.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/settings/ProviderSettingsPanel.tsx around line 303:
`operateAccess` is hardcoded to `"granted"` for every non-primary environment, so a remote environment connected with a credential that lacks `orchestration:operate` renders the full editable UI instead of `ReadOnlyProviderSettings`. The user is offered edit controls that the authoritative environment RPC will reject, producing failed writes. As the adjacent comment notes, lower-scope remote credentials are a supported case, so remote access must be derived from that environment's actual session scopes rather than assumed.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6a822e6. Configure here.
- Extract resolvePrimaryOperateAccess so SWR revalidation no longer reports pending while cached session data is available, which was unmounting the provider editor and discarding in-progress edits - Carry a reason on the loading state so waiting on permissions is not described as waiting on device configuration - Name read-only provider rows with deriveProviderInstanceEntries so multiple instances of one driver stay distinguishable Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Addressed the latest findings in 370174b. Session refresh unmounts editor (high, Bugbot) — Real regression from my previous fix, thanks. Loading copy misstates wait reason (low, Bugbot) — The loading state now carries Read-only names ignore labels (medium, Bugbot) — Non-primary Verification: typecheck passes; 172 files / 1,524 tests pass (4 new cases for the access-resolution paths); lint clean on changed files. |

Problem
Providers settings were hardwired to the primary backend. When working through T3 Connect or app.t3.codes, remote boxes could not be configured — controls were missing or ineffective.
What this does
Single local-primary setups keep the existing Providers layout with no extra device section.
No contracts, server RPC, relay, or permission-scope changes — the environment-scoped commands already carry
environmentId.Verification
pnpm --filter @t3tools/web typecheck— passedpnpm --filter @t3tools/web test— 172 files / 1,519 tests passed/settings/providers: provider rows render, add-instance dialog opens/cancels, refresh completes, no Providers-specific console errorsNew tests cover environment ordering/selection fallback, all access states, non-primary command routing, add-instance scoping, nullable snapshots, and shared-preference preservation. Interactive multi-device and disconnected-device checks were blocked by single-environment runtime state and are covered by those tests instead.
🤖 Generated with Claude Code
Note
Medium Risk
Large settings UI move with per-environment writes and permission-sensitive edit vs read-only paths; delete/reset semantics changed for shared model prefs without backend changes.
Overview
Providers settings are no longer tied to the primary device. The panel lives in
ProviderSettingsPaneland adds a Devices picker (hidden when only the local primary is registered) so reads, writes, refreshes, updates, and add-instance flow all go throughenvironmentId.Connection and orchestration:operate gating drive editable vs read-only status rows vs loading/unavailable/error UI.
AddProviderInstanceDialogtakesenvironmentIdandenvironmentLabel; copy names the target environment.Behavior change: deleting a custom instance or resetting a default driver on one device only patches
providerInstances(and legacyproviderson reset)—favoritesandproviderModelPreferencesare left alone on that environment. Nullable remote provider atoms are coalesced to[]before existing card logic runs.Reviewed by Cursor Bugbot for commit 370174b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add per-device environment selection to provider settings
ProviderSettingsPanelto support selecting among multiple environments, routing all provider reads, writes, and commands to the selected environment viauseEnvironmentSettings/useUpdateEnvironmentSettings.SelectedEnvironmentProviderSettingsto gate editability based on connection state and operate permissions, surfacing read-only and loading/error states via newReadOnlyProviderSettingsandclassifyProviderEnvironmentAccesslogic.AddProviderInstanceDialognow requiresenvironmentIdandenvironmentLabelprops, scoping provider instance creation to a specific environment and displaying the environment label in the dialog description.providerModelPreferences; resetting the default instance no longer clears shared preferences.Macroscope summarized 370174b.