From 39b1f928f49aadc013f2ff967f5c6b9a18406eef Mon Sep 17 00:00:00 2001 From: Hermes Team Date: Fri, 21 Aug 2026 08:00:42 +0700 Subject: [PATCH] fix(wizard): restore Antigravity OAuth by matching the 3-tuple session API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 0d9005f changed start_profile_oauth to return (session_id, auth_url, port) and updated the tests, but not its callers. The wizard still unpacked two values, so every Antigravity connection raised ValueError inside _init_antigravity_oauth, the handler swallowed it, and the authorization URL never appeared — the primary onboarding flow has been dead since that commit. Also stores the listener port as wizard.oauth_port, which the single-session invariance test reads to prove that repeat "open browser" clicks reuse the existing listener instead of binding a new one. Both defects were caught only by tests that the headless run skips, which is why they survived several reviews. Co-Authored-By: Claude Opus 5 --- legacy/gui_server.py | 2 +- src/antigravity_provider/router/ui/add_account_wizard.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/legacy/gui_server.py b/legacy/gui_server.py index 9c44df7..079a1e4 100644 --- a/legacy/gui_server.py +++ b/legacy/gui_server.py @@ -233,7 +233,7 @@ def start_oauth(req: StartOAuthRequest) -> Dict[str, Any]: raise HTTPException(status_code=400, detail="Нет свободных слотов для Antigravity аккаунтов") try: - session_id, auth_url = start_profile_oauth(profile_id) + session_id, auth_url, _port = start_profile_oauth(profile_id) display_name, _, _ = AutoAssigner.get_display_name_and_role(profile_id) return { "success": True, diff --git a/src/antigravity_provider/router/ui/add_account_wizard.py b/src/antigravity_provider/router/ui/add_account_wizard.py index 5bebdb5..abd3664 100644 --- a/src/antigravity_provider/router/ui/add_account_wizard.py +++ b/src/antigravity_provider/router/ui/add_account_wizard.py @@ -48,6 +48,7 @@ class AddAccountWizard(HubModal): # Session tracking self.oauth_session_id: Optional[str] = None self.oauth_url: Optional[str] = None + self.oauth_port: Optional[int] = None self.codex_session_id: Optional[str] = None self.codex_url: Optional[str] = None @@ -83,6 +84,7 @@ class AddAccountWizard(HubModal): except Exception: pass self.oauth_session_id = None + self.oauth_port = None if self.codex_session_id: try: @@ -340,9 +342,10 @@ class AddAccountWizard(HubModal): def _init_antigravity_oauth(self): try: from antigravity_provider.router.profile_oauth import start_profile_oauth - session_id, auth_url = start_profile_oauth(self.target_slot) + session_id, auth_url, port = start_profile_oauth(self.target_slot) self.oauth_session_id = session_id self.oauth_url = auth_url + self.oauth_port = port self.oauth_url_entry.delete(0, "end") self.oauth_url_entry.insert(0, auth_url)