feat(web): switch saved environments off instead of removing them #11478
Mergedt3dotgg(GitHub profile, opens in a new tab)merged 4 commits into
main fromrefs/pull/11478/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx line 168Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -163,4 +165,4 @@163165 user is signed out — the component gates discovery itself. */}164166 <CloudEnvironmentRows165167 connectedCloudEnvironments={connectedCloudEnvironments}166- onReconnectEnvironment={onReconnectEnvironment}168+ onSetEnvironmentEnabled={onSetEnvironmentEnabled}packages/client-runtime/src/connection/catalog.ts line 125Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -113,9 +115,11 @@113115 return {114116 target: registration.target,115117 profile: Option.none(),118+ enabled: true,116119 };117120 case "BearerConnectionRegistration":118121 case "SshConnectionRegistration":119122 return {120123 target: registration.target,121124 profile: Option.some(registration.profile),125+ enabled: true,apps/web/src/components/settings/ConnectionsSettings.tsx line 3635Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -3536,17 +3614,4 @@3536- <Tooltip>3537- <TooltipTrigger3538- render={3539- <DialogTrigger3540- render={3541- <Button3542- size="xs"3543- variant="ghost"3544- className="font-normal text-muted-foreground/60 hover:text-muted-foreground"3545- aria-label="Add environment"3546- >3547- <PlusIcon className="size-3" />3548- <span>Add environment</span>3549- </Button>3550- }3551- />3552- }3614+ <div className="flex items-center gap-1">3615+ {savedServerUpdateTargets.length > 0 ? (3616+ <ServerUpdatesAction3617+ targets={savedServerUpdateTargets}packages/client-runtime/src/connection/registry.ts line 690Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -632,0 +665,21 @@665+ if (!(yield* Ref.get(platformEnvironmentIds)).has(environmentId)) {666+ yield* registrations.setEnabled(environmentId, enabled);667+ }668+ const next: ConnectionCatalogEntry = { ...entry, enabled };669+ // Update the lease in place so the supervisor keeps its generation and670+ // durable streams; `installEntryLocked` would tear it down instead.671+ const lease = (yield* SubscriptionRef.get(serviceScopes)).get(environmentId);672+ if (lease !== undefined) {673+ yield* SubscriptionRef.update(serviceScopes, (current) => {674+ const nextScopes = new Map(current);675+ nextScopes.set(environmentId, { ...lease, entry: next });676+ return nextScopes;677+ });678+ }679+ yield* SubscriptionRef.update(entries, (current) => {680+ const nextEntries = new Map(current);681+ nextEntries.set(environmentId, next);682+ return nextEntries;683+ });684+ if (lease !== undefined) {685+ yield* enabled ? lease.supervisor.connect : lease.supervisor.disconnect;
- apps/web/src/components/settings/ConnectionsSettings.tsx lines 2470 to 2474OutdatedResolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -2381,11 +2457,18 @@2381- title: "Could not connect backend",2457+ title: `Could not switch backend ${enabled ? "on" : "off"}`,23822458 description: message,23832459 }),23842460 );23852461 }23862462 },2387- [retryEnvironment],2463+ [setEnvironmentEnabled],23882464 );238924652466+ // Removing forgets the pairing, credentials, and cached threads on this2467+ // device. Switching off is the reversible path, so removal always confirms.23902468 const handleRemoveSavedBackend = useCallback(2391- async (environmentId: EnvironmentId) => {2469+ async (environment: EnvironmentPresentation) => {2470+ const confirmed =2471+ (await requestConfirmDialog(2472+ `Remove ${environment.label} from this device?\nThis forgets its pairing, credentials, and cached threads here. Switch it off instead to keep it saved.`,2473+ { variant: "destructive" },2474+ )) ?? true;
- apps/web/src/components/settings/ConnectionsSettings.tsx line 2487OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2381,11 +2470,18 @@2381- title: "Could not connect backend",2470+ title: `Could not switch backend ${enabled ? "on" : "off"}`,23822471 description: message,23832472 }),23842473 );23852474 }23862475 },2387- [retryEnvironment],2476+ [setEnvironmentEnabled],23882477 );238924782479+ // Removing forgets the pairing, credentials, and cached threads on this2480+ // device. Switching off is the reversible path, so removal always confirms.23902481 const handleRemoveSavedBackend = useCallback(2391- async (environmentId: EnvironmentId) => {2482+ async (environment: EnvironmentPresentation) => {2483+ const confirmed =2484+ (await requestConfirmDialog(2485+ `Remove ${environment.label} from this device?\nThis forgets its pairing, credentials, and cached threads here. Switch it off instead to keep it saved.`,2486+ { variant: "destructive" },2487+ )) ?? true;
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.





Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
af2bacc· PR result:02f5b2d· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.