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.
This commit is contained in:
bergeouss
2026-04-28 10:30:02 +00:00
committed by Hermes Agent
parent 24d65a1efa
commit ae2ed1a4e7
2 changed files with 21 additions and 1 deletions
+18 -1
View File
@@ -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
+3
View File
@@ -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));
}