Skip to content

feat(web): per-device provider settings - #4479

Merged
t3dotgg merged 8 commits into
mainfrom
t3code/add-device-provider-controls
Aug 7, 2026
Merged

feat(web): per-device provider settings#4479
t3dotgg merged 8 commits into
mainfrom
t3code/add-device-provider-controls

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Jul 24, 2026

Copy link
Copy Markdown
Member

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

  • Lists every registered execution environment (primary, T3 Connect, SSH, desktop-local) and lets you pick one.
  • Scopes provider reads, settings writes, status refreshes, provider updates, and instance creation to the selected environment.
  • Adds honest states for loading config, offline/reconnecting, connection errors, no environments, and known read-only sessions.
  • Coalesces nullable remote provider snapshots before existing array logic.
  • Keeps shared model favorites/preferences intact when deleting or resetting provider config on one device.

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 — passed
  • pnpm --filter @t3tools/web test — 172 files / 1,519 tests passed
  • Lint on changed files — passed
  • Browser check of /settings/providers: provider rows render, add-instance dialog opens/cancels, refresh completes, no Providers-specific console errors

New 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 refactor with new session-scope gating and optimistic permission fallbacks; incorrect access classification could expose controls that RPC rejects, though writes remain server-enforced.

Overview
Providers settings are no longer tied to the primary device. The panel is extracted into ProviderSettingsPanel and, when more than one execution environment exists, adds a Devices picker (primary, T3 Connect, SSH, etc.) with connection status on each row.

All provider actions are scoped to the selected environmentId: settings read/write, refresh, one-click updates, and the add-instance dialog. Server commands already carried environmentId; the UI now passes it consistently.

Access is gated before showing editable controls: connection phase, whether server config is loaded, and whether the session has orchestration:operate (via new per-environment /api/auth/session atoms in client-runtime and useEnvironmentSessionState on web). Missing permission shows the real layout read-only (inert) with a limited-permissions notice; disconnected or loading devices get explicit unavailable/loading copy instead of broken controls.

Other behavior tweaks: deleting or resetting a provider instance on one device no longer clears shared favorites/model preferences in the same settings patch; default provider slots on older remote servers can omit legacy driver blobs without breaking the panel. Single primary-only setups keep the previous layout without the Devices section.

Reviewed by Cursor Bugbot for commit 688524b. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add per-device provider settings with environment selection to the Providers settings panel

  • Replaces the single primary-environment ProviderSettingsPanel with a multi-device aware version in ProviderSettingsPanel.tsx that lets users select an execution environment and manage providers per device.
  • Adds access-gating logic in ProviderSettingsPanel.logic.ts to classify each environment as editable, read-only, loading, unavailable, or error based on connection phase, config availability, and session scopes.
  • Extends createEnvironmentSessionAtoms in packages/client-runtime/src/state/session.ts with sessionStateAtom and sessionStateValueAtom that fetch /api/auth/session per environment using SWR semantics (30s stale, 5m idle TTL).
  • Adds useEnvironmentSessionState hook in apps/web/src/state/session.ts exposing auth session data with isPending/hasError flags for UI gating.
  • Moves utility functions (durationToSeconds, normalizeIntervalSeconds, backgroundActivityOverrideSettings) from SettingsPanels.tsx to SettingsPanels.logic.ts and removes the old ProviderSettingsPanel implementation from SettingsPanels.tsx.
  • Risk: ProviderSettingsPanel is no longer exported from SettingsPanels.tsx; the import path is updated in settings.providers.tsx but any other consumer importing from the old path will break at runtime.

Macroscope summarized 688524b.

Summary by CodeRabbit

  • New Features

    • Added environment-specific provider settings, including environment selection, access controls, connection status, health refresh, model preferences, and provider instance management.
    • Added read-only, loading, unavailable, error, and update-failure states.
    • Added policy explanation tooltips in settings.
    • Added clearer connection-status indicators and transition animations.
  • Bug Fixes

    • Provider settings now correctly read and update the selected environment’s configuration.
  • Tests

    • Added coverage for environment routing, access states, provider settings, and reset behavior.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ 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.

1 participant