From 10fa59057d786a61f0a96df5ac890bb9a9c28503 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Sat, 13 Jun 2026 04:19:46 -0700 Subject: [PATCH] [eric] settings: boot drops the managed Pro connection when disconnected, so 'disconnect Pro -> free trial arms' actually works --- backend/apps/settings/settings.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/apps/settings/settings.py b/backend/apps/settings/settings.py index afd88925..bd501e1f 100644 --- a/backend/apps/settings/settings.py +++ b/backend/apps/settings/settings.py @@ -63,11 +63,17 @@ async def settings_lifespan(): await sync_gemini_api_key(getattr(s, "google_api_key", None) or None) await sync_openai_api_key(getattr(s, "openai_api_key", None) or None) await sync_openrouter_api_key(getattr(s, "openrouter_api_key", None) or None) + # Reconcile the managed Pro/anthropic connection symmetrically too: keep it only + # for an active pro/free-trial bearer, else REMOVE it. Without the else, disconnecting + # Pro left a zombie managed Claude connection in 9Router, so the backend kept seeing a + # model and the free trial refused to arm ("disconnect Pro -> nothing happens"). Only + # the OpenSwarm-managed Pro node is touched; a user's own Claude sub (priority 0) is safe. if getattr(s, "connection_mode", None) in ("openswarm-pro", "free-trial"): from backend.apps.settings.credentials import proxy_auth bearer, base = proxy_auth(s) - if bearer: - await sync_openswarm_pro_as_claude(bearer, base) + else: + bearer, base = None, None + await sync_openswarm_pro_as_claude(bearer, base) await sync_custom_providers(getattr(s, "custom_providers", None) or []) _asyncio.create_task(_boot_router_then_sync())