Skip to content

feat(cli): add restart-based profile switching to /profile - #6753

Closed
stephenschoettler wants to merge 2 commits into
NousResearch:mainfrom
stephenschoettler:feat/profile-slash-switcher
Closed

feat(cli): add restart-based profile switching to /profile#6753
stephenschoettler wants to merge 2 commits into
NousResearch:mainfrom
stephenschoettler:feat/profile-slash-switcher

Conversation

@stephenschoettler

@stephenschoettler stephenschoettler commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • extend the interactive /profile slash command to support listing and switching profiles
  • switch profiles with a restart-based re-exec instead of unsafe in-process HERMES_HOME mutation
  • add focused CLI tests covering no-arg display, list, switch, same-profile no-op, and error handling
  • document the new interactive CLI /profile behaviors in the slash-command reference and profiles guide

Why

  • /profile already existed but only exposed status, leaving a clear UX gap for people using multiple Hermes profiles
  • restart-based switching is the safe implementation because profile selection affects import-time config, paths, dotenv loading, and state initialization

Existing work checked

  • searched open PRs for overlapping work before finalizing the PR updates
  • searched open issues for matching feature requests / duplicates
  • no overlapping open PR or clearly matching existing issue found for interactive /profile switching

How to test

  • run: python -m pytest tests/hermes_cli/test_commands.py tests/hermes_cli/test_profiles.py tests/test_cli_profile_command.py -q -o addopts=''
  • launch Hermes and exercise:
    • /profile
    • /profile list
    • /profile use <name>
    • /profile <name>
    • /profile <current-profile>
    • /profile use
    • /profile list extra

Details

  • /profile now shows the active profile using profile helpers instead of inferring from path shape alone
  • /profile list prints available profiles and marks the active one
  • /profile use <name> and /profile <name> set the sticky profile, then restart Hermes with --profile <name>
  • same-profile requests are treated as a no-op and do not restart
  • shared slash-command registry metadata was intentionally left unchanged to avoid advertising CLI-only semantics in gateway/help/menu surfaces
  • docs now cover the new CLI-only /profile list/switch flows and note restart-on-switch behavior

Platforms tested

  • Linux (Arch)
  • Python 3.14.3

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (feat(cli): ..., docs(cli): ...)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this feature
  • I've run pytest tests/ -q and all tests pass
  • I've run targeted pytest coverage for the changed area: python -m pytest tests/hermes_cli/test_commands.py tests/hermes_cli/test_profiles.py tests/test_cli_profile_command.py -q -o addopts=''
  • I've added tests for my changes
  • I've manually tested the interactive CLI behavior
  • I've tested on my platform: Arch Linux

Documentation & Housekeeping

  • I've updated relevant documentation (website/docs/reference/slash-commands.md, website/docs/user-guide/profiles.md)
  • I've updated cli-config.yaml.example if needed — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if needed — N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide
  • I've updated tool descriptions/schemas if needed — N/A

Scope notes

  • CLI-only. Gateway /profile switching remains out of scope.
  • The current conversation remains in the old profile state store; the restarted CLI starts a fresh session in the new profile.
  • Cross-platform impact was considered because this touches process restart behavior, but the implementation intentionally uses Python-level re-exec logic rather than shell-specific behavior.

@stephenschoettler stephenschoettler changed the title feat: add restart-based profile switching to /profile feat(cli): add restart-based profile switching to /profile Apr 9, 2026
@stephenschoettler

Copy link
Copy Markdown
Contributor Author

Manual verification is now complete.

Confirmed in the interactive Hermes CLI:

  • /profile shows the correct active profile
  • /profile list marks the active profile correctly
  • /profile <current-profile> is a no-op
  • /profile use shows usage
  • /profile list extra shows usage
  • /profile <different-profile> switches profiles and restarts cleanly

So the focused pytest coverage and a real interactive smoke test are both green.

@stephenschoettler

Copy link
Copy Markdown
Contributor Author

Ran the full test suite locally with python -m pytest tests/ -q. It is not green in this environment.

Result:

  • 8707 passed
  • 68 failed
  • 6 errors
  • 62 skipped

The failures appear to be pre-existing / unrelated to this /profile change and cluster in other areas, including:

  • ACP tests (ModuleNotFoundError: acp)
  • Matrix gateway tests
  • delegate tool tests
  • transcription / managed media gateway tests
  • logging / provider-resolution / env-loader tests

The targeted tests for this PR still pass, and manual interactive verification of /profile behavior is complete.

@stephenschoettler
stephenschoettler force-pushed the feat/profile-slash-switcher branch from 6eec433 to 81d2d45 Compare April 9, 2026 18:31
@stephenschoettler

Copy link
Copy Markdown
Contributor Author

Follow-up: I found the branch had picked up unrelated context-engine commits in its history. I cleaned the PR branch and force-updated it so the diff is now limited to the intended files only:

  • cli.py
  • tests/test_cli_profile_command.py
  • website/docs/reference/slash-commands.md
  • website/docs/user-guide/profiles.md

Targeted verification after cleanup:

  • pytest -q tests/test_cli_profile_command.py tests/hermes_cli/test_commands.py tests/hermes_cli/test_profiles.py -o addopts=''
  • result: 186 passed

Given the cleaned diff, the unrelated full-suite failures do not appear to come from this /profile work.

@stephenschoettler
stephenschoettler force-pushed the feat/profile-slash-switcher branch from 81d2d45 to c794878 Compare April 9, 2026 18:57
@stephenschoettler
stephenschoettler force-pushed the feat/profile-slash-switcher branch from c794878 to 540a218 Compare April 9, 2026 19:07
@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels Apr 29, 2026
@stephenschoettler

Copy link
Copy Markdown
Contributor Author

Closing this as shelved cleanup. The branch still represents restart-based interactive /profile switching, but that is feature scope rather than a current bugfix, and current main has moved a lot around profile/home handling.

If we decide we still want CLI profile switching, it should be rebuilt fresh against current startup/profile semantics rather than keeping this old branch open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants