Skip to content

fix(dashboard): persist and scope profile switching - #13823

Open
kiss-kedaya wants to merge 4 commits into
NousResearch:mainfrom
kiss-kedaya:fix/dashboard-profile-switching
Open

fix(dashboard): persist and scope profile switching#13823
kiss-kedaya wants to merge 4 commits into
NousResearch:mainfrom
kiss-kedaya:fix/dashboard-profile-switching

Conversation

@kiss-kedaya

Copy link
Copy Markdown

Summary

  • add a profile switcher to the dashboard and persist the selected profile across reloads
  • scope dashboard session/detail APIs to the selected Hermes profile
  • reload cron job storage under the selected profile so cron lists stop leaking across agents
  • add regression coverage for profile-scoped sessions and cron jobs

Test Plan

  • pytest tests/hermes_cli/test_web_server.py -q
  • npm run build
  • verified /api/sessions and /api/cron/jobs return different data for default, minion1, and okx-trader

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 22, 2026
@curtisszmania-cytocync

Copy link
Copy Markdown

Would love to see this merged.

@alt-glitch alt-glitch added comp/dashboard Web dashboard / control panel UI (dashboard/, landing) and removed comp/cli CLI entry point, hermes_cli/, setup wizard labels Jun 27, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the dashboard profile-scoping work. The stated dashboard behavior is now implemented on current main, but this branch also contains unrelated image-backend changes that need separation before any salvage.

Problems

  • Current main already scopes sessions and analytics via hermes_cli/web_server.py:9583-9608 and regression coverage at tests/hermes_cli/test_web_server.py:1154-1291; commit 62b4618e9 introduced that guarantee. Current profile persistence is handled by web/src/contexts/ProfileProvider.tsx:42-79, and cron profile storage by hermes_cli/web_server.py:10092-10170.
  • The CPA addition introduces HERMES_IMAGE_BACKEND at tools/image_generation_tool.py:508; behavioral configuration must remain in config.yaml.
  • The CPA output path at tools/image_generation_tool.py:640 hardcodes ~/.hermes, bypassing profile isolation.
  • The PR's request scope mutates process-global HERMES_HOME (hermes_cli/web_server.py:150 on the PR head). Current main documents why await-safe context-local scoping is required at hermes_cli/web_server.py:13118-13148.

Suggested changes

  • Split and rework the CPA integration against the established image-provider plugin path; retain config.yaml configuration and get_hermes_home() paths.

Automated hermes-sweeper review.

Comment thread hermes_cli/web_server.py
@contextlib.contextmanager
def _cm():
old = os.environ.get("HERMES_HOME")
os.environ["HERMES_HOME"] = str(profile_home)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mutates process-global process state for an HTTP request. Because handlers using this scope can await, concurrent requests can read or restore the wrong profile. Please use the current context-local/direct-profile-open approach instead; current main documents the await-safety requirement in _config_profile_scope.


def _resolve_image_backend() -> str:
cfg = _load_image_gen_config()
raw = str(cfg.get("backend") or os.getenv("HERMES_IMAGE_BACKEND") or "fal").strip().lower()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HERMES_IMAGE_BACKEND is a new user-facing non-secret behavior setting. Please keep backend selection solely in image_gen config.yaml; .env is reserved for credentials.

ext = mime.split("/", 1)[1]
except Exception:
pass
out_dir = Path.home() / ".hermes" / "images"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hardcodes the default ~/.hermes path and writes a selected profile's generated image into the wrong home. Use get_hermes_home() / "images" so output remains profile-isolated.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit area/profiles Multi-profile isolation, HERMES_HOME scoping labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P3 Low — cosmetic, nice to have sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants