From ae2ed1a4e78444e34c4b50b4c7fdd05075e95ca6 Mon Sep 17 00:00:00 2001 From: bergeouss Date: Tue, 28 Apr 2026 10:30:02 +0000 Subject: [PATCH] Fix #1214: refresh workspace on profile switch when session is empty Add loadDir('.') call in switchToProfile() Case B so the workspace file tree panel reflects the new profile's workspace instead of showing stale files from the previous profile. Fix #1212: detect OAuth providers not in hardcoded set Expand _OAUTH_PROVIDERS with copilot-acp and qwen-oauth. Add fallback in get_providers() that checks hermes auth live status for providers that have no API key and are not in the hardcoded set (e.g. Anthropic connected via OAuth), so the Providers tab shows them as configured. --- api/providers.py | 19 ++++++++++++++++++- static/panels.js | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/api/providers.py b/api/providers.py index bf13cf1a..de038552 100644 --- a/api/providers.py +++ b/api/providers.py @@ -52,8 +52,10 @@ _PROVIDER_ENV_VAR: dict[str, str] = { # through the Hermes CLI, not via API keys. The WebUI cannot set these. _OAUTH_PROVIDERS = frozenset({ "copilot", - "openai-codex", + "copilot-acp", "nous", + "openai-codex", + "qwen-oauth", }) # SECTION: Helper functions @@ -310,6 +312,21 @@ def get_providers() -> dict[str, Any]: key_source = "config_yaml" else: key_source = "config_yaml" + else: + # Fallback: provider may be authenticated via hermes auth even + # though it is not in the hardcoded _OAUTH_PROVIDERS set + # (e.g. Anthropic connected via OAuth). Check live auth + # status so the Providers tab agrees with the model picker + # (#1212). + try: + from hermes_cli.auth import get_auth_status as _gas + status = _gas(pid) + if isinstance(status, dict) and status.get("logged_in"): + has_key = True + key_source = status.get("key_source", "oauth") + is_oauth = True + except Exception: + pass models = _PROVIDER_MODELS.get(pid, []) # Also include models from config.yaml providers section diff --git a/static/panels.js b/static/panels.js index c9bba4b3..408a1915 100644 --- a/static/panels.js +++ b/static/panels.js @@ -2099,6 +2099,9 @@ async function switchToProfile(name) { // No messages yet — just refresh the list and topbar in place await renderSessionList(); syncTopbar(); + // Refresh workspace file tree so the right panel shows the new + // profile's workspace, not the previous one (#1214). + if (S.session && S.session.workspace) loadDir('.'); showToast(t('profile_switched', name)); }