Skip to content

Fix #1214: workspace refresh on profile switch and #1212: OAuth provider detection#1221

Closed
bergeouss wants to merge 2 commits intonesquena:masterfrom
bergeouss:fix/1214-1212-profile-switch-oauth-providers
Closed

Fix #1214: workspace refresh on profile switch and #1212: OAuth provider detection#1221
bergeouss wants to merge 2 commits intonesquena:masterfrom
bergeouss:fix/1214-1212-profile-switch-oauth-providers

Conversation

@bergeouss
Copy link
Copy Markdown
Contributor

Summary

Two small fixes for recent bugs:

#1214 - Workspace panel stale after profile switch (empty session)

When switching profiles on a session with no messages yet, the workspace file tree panel kept showing files from the previous profile workspace.

Fix: Added loadDir('.') call in switchToProfile() Case B (S.messages.length === 0) so the workspace panel refreshes to show the new profile files.

#1212 - OAuth providers show as unconfigured in Settings

Some OAuth/token-based providers were missing from the hardcoded _OAUTH_PROVIDERS set (copilot-acp, qwen-oauth). More importantly, providers authenticated via hermes auth (e.g. Anthropic via OAuth) that are not in the set were never detected.

Fix:

  • Expanded _OAUTH_PROVIDERS with copilot-acp and qwen-oauth
  • Added a fallback in get_providers() that calls get_auth_status() live for providers with no API key and not in the hardcoded set

Test results

85 passed - provider + profile switch tests
JS syntax check: OK
Python compile: OK

…s 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 nesquena#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.
@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Thanks for the double-fix PR, @bergeouss! Both issues are clearly described and the approach looks sound.

#1214 (workspace refresh): Adding loadDir('.') in switchToProfile() Case B (empty session) is the right minimal fix — it ensures the file tree reflects the new profile without touching the non-empty-session path.

#1212 (OAuth provider detection): Expanding _OAUTH_PROVIDERS with copilot-acp and qwen-oauth plus the live get_auth_status() fallback for uncategorized providers is a good defense-in-depth approach. The fallback means new OAuth providers won't silently show as unconfigured without a code change.

The 85-test pass with JS syntax and Python compile checks is a solid baseline. A few things to verify before merge:

  1. The get_auth_status() fallback in get_providers() — does it add meaningful latency on providers that are not OAuth-authenticated? Worth confirming it short-circuits quickly for the common case (API-key providers).
  2. For the workspace fix, does loadDir('.') gracefully handle the case where the new profile has no workspace path configured yet?

Overall this looks clean and well-scoped. Thanks for tackling two open issues in one PR!

Avoids unnecessary latency on the Settings page by restricting the
OAuth auth-status fallback to providers that are not in _PROVIDER_ENV_VAR.

Review feedback (PR nesquena#1221): the get_auth_status() call in the else branch
was firing for every unconfigured API-key provider (openai, anthropic, etc.),
adding a network round-trip per provider. Now it only runs for providers
that are not known API-key providers (custom/OAuth-capable providers).
@bergeouss
Copy link
Copy Markdown
Contributor Author

Review Feedback Addressed

  • Issue (1): @nesquena-hermes asked whether the get_auth_status() fallback adds meaningful latency for non-OAuth (API-key) providers.

  • Fix: Changed the else: branch to elif pid not in _PROVIDER_ENV_VAR: — this skips the network call entirely for all known API-key providers (openai, anthropic, google, deepseek, etc.). The fallback now only fires for providers that are neither known OAuth nor known API-key providers (i.e. custom/OAuth-capable providers). This eliminates unnecessary round-trips on the Settings page while preserving the defense-in-depth detection for uncategorized OAuth providers.

  • Issue (2): @nesquena-hermes asked whether loadDir('.') gracefully handles the case where the new profile has no workspace path configured.

  • Confirmation: Yes — the guard if (S.session && S.session.workspace) (line 2104) ensures loadDir('.') is only called when a workspace exists. If the new profile has no workspace, the condition short-circuits and the workspace panel is left untouched.

  • Files: api/providers.py (fallback branch guard added)

🤖 AI-assisted via Hermes Agent

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Thanks for addressing the review feedback, @bergeouss! The two questions from the last review are both answered cleanly:

Issue (1) — OAuth fallback latency: The elif pid not in _PROVIDER_ENV_VAR: guard is the right fix. Skipping the network call entirely for known API-key providers (openai, anthropic, google, deepseek, etc.) eliminates the unnecessary round-trip. The fallback now only fires for truly uncategorized providers where the detection is worth the latency. Good approach.

Issue (2) — loadDir('.') with no workspace: The if (S.session && S.session.workspace) guard (line 2104) is confirmed to short-circuit safely when the new profile has no workspace configured. The file tree is left untouched rather than erroring, which is the correct behavior.

Both answers are clear and the PR description is self-documenting. This looks ready for maintainer review and merge. 🎉

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Merged in v0.50.237 via #1243. Thank you @bergeouss! 🎉

GeoffBao pushed a commit to GeoffBao/hermes-webui that referenced this pull request Apr 29, 2026
Avoids unnecessary latency on the Settings page by restricting the
OAuth auth-status fallback to providers that are not in _PROVIDER_ENV_VAR.

Review feedback (PR nesquena#1221): the get_auth_status() call in the else branch
was firing for every unconfigured API-key provider (openai, anthropic, etc.),
adding a network round-trip per provider. Now it only runs for providers
that are not known API-key providers (custom/OAuth-capable providers).
JKJameson pushed a commit to JKJameson/hermes-webui that referenced this pull request Apr 29, 2026
Avoids unnecessary latency on the Settings page by restricting the
OAuth auth-status fallback to providers that are not in _PROVIDER_ENV_VAR.

Review feedback (PR nesquena#1221): the get_auth_status() call in the else branch
was firing for every unconfigured API-key provider (openai, anthropic, etc.),
adding a network round-trip per provider. Now it only runs for providers
that are not known API-key providers (custom/OAuth-capable providers).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants