feat(cli): maestro-bridge for hermes maestro subcommands - #1
Open
VertexDevelopments wants to merge 1 commit into
Open
feat(cli): maestro-bridge for hermes maestro subcommands#1VertexDevelopments wants to merge 1 commit into
VertexDevelopments wants to merge 1 commit into
Conversation
`hermes maestro plan|approve|status|doctor|...` now bridges to a sibling `maestro` package via three-step resolution: 1. Already importable (PYTHONPATH / cwd / site-packages) 2. `MAESTRO_REPO_ROOT` env var 3. `~/Hermes-Zen-Agent` (documented default checkout) Fixes the failure mode where `hermes maestro doctor --json` exits with `argparse: invalid choice: 'doctor'` because a stale `~/Hermes-Zen-Agent` checkout (e.g. an operator working in a worktree under `.claude/worktrees/<branch>/`) was silently resolved as the bridge root. The new `maestro_bridge.py`: - Honors `MAESTRO_REPO_ROOT` BEFORE any import attempt and purges `sys.modules['maestro*']` if a different root was already loaded - Walks up from `os.getcwd()` looking for a checkout that contains the maestro package, so worktree shells resolve to their own Maestro sources rather than a stale parent checkout - Swallows registration failures (logged at DEBUG) so upstream installs without the maestro package keep working unchanged Verified on Hermes v0.14.0 (tag v2026.5.16): `hermes maestro --help` lists the full verb set (plan/approve/status/pause/resume/abort/doctor/followup-status) References: - `~/Hermes-Zen-Agent/docs/upstream-patches/hermes-cli-maestro-bridge.md` for the operator-side rationale + PR NousResearch#36 R10 codex defect closure Co-Authored-By: Claude Opus 4.7 (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.
Summary
hermes_cli/maestro_bridge.pythat wireshermes maestro plan|approve|status|doctor|...into the CLI argparse tree via three-step resolution: importable →MAESTRO_REPO_ROOTenv var →~/Hermes-Zen-Agentdefault.hermes_cli/maestro.pythin shim that re-exportsmaestro.clisymbols (so the bridge keeps a stable import surface for downstream tooling).hermes_cli/main.pyimmediately afterdoctor_parser.set_defaults(func=cmd_doctor)with atry/exceptthat swallows failures at DEBUG so upstream installs without the maestro package keep working unchanged.Why
Operators running the documented deploy gate
could not satisfy the gate without setting
MAESTRO_REPO_ROOTby hand. Codex review of PR NousResearch#36 R10 found a HIGH defect: a host where~/Hermes-Zen-Agentwas a stale checkout (e.g. operator now develops in a worktree under~/Hermes-Zen-Agent/.claude/worktrees/<branch>/) silently resolved the bridge root to that stale tree.hermes maestro --helpthen listed the old verb set, andhermes maestro doctor --jsonexited withargparse: invalid choice: 'doctor'.Two consequences:
MAESTRO_REPO_ROOTset, ifmaestro.cliwas already loaded earlier in the process from a stale path, the env var was ignored —import maestro.clishort-circuited at the first call.What this fixes
The new bridge:
MAESTRO_REPO_ROOTBEFORE any import attempt and purgessys.modules['maestro*']if a different root was already loaded — so the env var truly takes precedence.os.getcwd()looking for a directory that contains the maestro package, so worktree shells resolve to their own Maestro sources rather than a stale parent checkout.Test plan
hermes maestro --helplistsplan|approve|status|pause|resume|abort|doctor|followup-status(verified on Hermes v0.14.0 / tag v2026.5.16)hermes maestro doctor --jsonruns from a worktree shell and resolves to the worktree's maestro sources (not the parent checkout)MAESTRO_REPO_ROOT=/path/to/alt hermes maestro --helpresolves to the alt root even when a different root was already loaded earlier in the same Python process~/Hermes-Zen-Agentcheckout,hermes --helpstill works (bridge registration silently skipped)cmd_doctorbehavior unchanged (registration is appended, not inserted)References
Hermes-Zen-Agent/docs/upstream-patches/hermes-cli-maestro-bridge.md🤖 Generated with Claude Code