fix(profile): honor renamed root alias in CLI/profile helpers#21134
Closed
0xDevNinja wants to merge 1 commit into
Closed
fix(profile): honor renamed root alias in CLI/profile helpers#211340xDevNinja wants to merge 1 commit into
0xDevNinja wants to merge 1 commit into
Conversation
53ac6a7 to
954f04a
Compare
Threads the optional ~/.hermes/default_profile_name alias through normalize_profile_name so all downstream helpers (get_profile_dir, profile_exists, resolve_profile_env, delete_profile, set_active_profile, create_profile) auto-route the alias to the root profile without each having to know about it. list_profiles and get_active_profile_name surface the alias as the display name while keeping is_default=True, so dashboards/CLI mark the root row correctly. The alias is silently dropped when invalid, equal to "default", or colliding with a real profiles/<name>/ directory — the named profile wins so it stays reachable. The CLI surface for *setting* the alias (renaming the root profile, creating a wrapper) is intentionally out of scope for this PR. Fixes NousResearch#21105
954f04a to
691b45c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Threads the optional
~/.hermes/default_profile_namerenamed-root alias through the CLI/profile helpers so a renamed root profile (e.g.kinni) resolves to~/.hermesconsistently —hermes profile list,hermes profile show kinni,hermes -p kinni …, and the WebUI/profile API all see the alias as the root profile.The fix routes the alias through
normalize_profile_name, so every downstream helper (get_profile_dir,profile_exists,resolve_profile_env,delete_profile,set_active_profile,create_profile,rename_profile) auto-handles it without each having to be aware of the alias.list_profilesandget_active_profile_namesurface the alias as the display name while keepingis_default=True.defaultcontinues to resolve to the root for back-compat.The alias is silently ignored when:
_PROFILE_ID_REvalidationdefaultprofiles/<alias>/directory exists (named profile wins so it stays reachable)The CLI surface for setting the alias — renaming the root profile, creating a
~/.local/bin/<alias>wrapper — is intentionally out of scope for this PR. The alias file is treated as input only; once any flow lands that writes it, this resolution layer already supports it.Related Issue
Fixes #21105
Type of Change
Changes Made
hermes_cli/profiles.py_get_root_alias()reader for~/.hermes/default_profile_namewith strict id validation, default-collision guard, and named-profile-wins fallbacknormalize_profile_nameresolves the alias todefaultso callers stay alias-agnosticlist_profilesdisplays the alias as the root row'sname(stillis_default=True)get_active_profile_namereturns the alias whenHERMES_HOMEresolves to roottests/hermes_cli/test_profiles.pyTestRenamedRootAliasclass (13 cases) covering all helpers, collision/invalid/empty cases, and unaffected behavior of ordinary named profilesHow to Test
hermes profile create coder hermes -p coder config path # ~/.hermes/profiles/coder/config.yamlCode Checklist
feat:,fix:,docs:)pytest tests/ -q)Documentation Checklist
README.mdordocs/if user-visible behavior changedcli-config.yaml.exampleif any new YAML keys were introducedCONTRIBUTING.mdorAGENTS.mdif architecture changed