fix(karpathy-self-improve): CLI subcommands resolve profile from global --profile (#180) - #181
Merged
Merged
Conversation
…l --profile, not a stripped subcommand flag (#180) hermes karpathy bootstrap|pause|resume|propose declared their own --profile required=True, but main._apply_profile_override strips --profile from argv before argparse. Read the active profile via get_active_profile_name() instead; usage is 'hermes --profile <name> karpathy <cmd>'. Fixes misleading 'required: --profile' error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Closes #180.
hermes karpathy bootstrap|pause|resume|proposefailed with a misleadingerror: the following arguments are required: --profileeven when--profile <name>was supplied.Root cause (verified, not the one in the issue body)
The issue speculated the handlers/
set_defaultswere dropped at merge. They weren't —_cmd_bootstrap/_cmd_pause/_cmd_resume/_cmd_proposeall exist and the CLI dispatches via acmd == ...ladder (this parser never usedset_defaults(func=...), sogrep set_defaults → 0is expected, not a defect).The real cause: the top-level
hermesCLI consumes--profile/-pbefore argparse —main._apply_profile_override()(hermes_cli/main.py:339) scans argv broadly (even after the subcommand), setsHERMES_HOME, and strips--profilefromsys.argv. So a subcommand-local--profile required=Truecan never receive a value; argparse then reports it missing. This pre-strip predates the #176 work (from PR NousResearch#34097); the #176 subcommands simply declared their own--profilein violation of the CLI's convention (profile is always global — same ashermes --profile <name> gateway run).init/status/collect/daemonwere unaffected because none require--profile. The HTTP pause/resume endpoints takeprofileas a path param →db.set_pauseddirectly (no argparse), so they were never affected.Fix
--profileflag from thepropose/bootstrap/pause/resumesubparsers._resolve_cli_profile(cmd)— resolves the target from the global active profile viahermes_cli.profiles.get_active_profile_name()(HERMES_HOME, the per-process runtime profile), and exits2with an actionable message when no named profile is selected.daemon.pyand the_wiring.pyfail-fast to the real syntax:hermes --profile <name> karpathy <cmd>.Usage (unchanged convention, corrected form)
Tests (187 passed, +2)
test_resolve_cli_profile_reads_global_active_profile— resolves fromget_active_profile_name().test_resolve_cli_profile_errors_without_named_profile—default/empty →SystemExit(2)with the actionable message.Verified live
hermes --profile hermes-switch karpathy bootstrapnow succeeds — wroteplugins.karpathy_self_improve.profiles.hermes-switch(target_relpath: SOUL.md,profile_root,live_sessions_target: 10,paused: true) to config.yaml and setcontrols.hermes-switch = paused.hermes karpathy statusreflects it.