Skip to content

Fix the Hermes CLI readiness probe, and tear the CLI down on uninstall - #9663

Merged
spencerbull merged 6 commits into
omacom:quattrofrom
spencerbull:fix/hermes-prompt-probe
Sep 2, 2026
Merged

spencerbull merged 6 commits into
omacom:quattrofrom
spencerbull:fix/hermes-prompt-probe

Conversation

@spencerbull

@spencerbull spencerbull commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Two fixes to the Hermes CLI lifecycle.

The readiness probe keyed on a flag no release ever carried. hermes_prompt_ready in omarchy-install-hermes-cli grepped hermes chat --help for --oneshot — but no released Hermes defines that flag under chat: it lived at the top level through v0.20.6, and chat only gained its own in v0.21.0. So a fully bootstrapped install read as not ready on every release in circulation: --check failed forever, the default-agent flow looped back into the floating installer, and the install pass dead-ended with "Launch Hermes Desktop once to finish installing it" on a machine where it already had. The probe now asks for --tui and --query, the flags omarchy-agent actually passes to seed an interactive session, and a flag counts only when the help defines it — followed by the usage bracket, the gap before same-line help text, an uppercase metavar, or the line end — so prose like "With --tui:" in another option's description, or a --tui-theme/--tui_mode sibling, never answers for the option itself. It stays a help probe rather than a parse of a real invocation on purpose: a release that ignores unknown arguments would turn that probe into a live session.

Remove Hermes left the mise CLI stranded. omarchy-remove-ai-hermes dropped the desktop package and the ~/.hermes runtime but never touched the mise-installed CLI, on the assumption the install-time desktop takeover had removed it; a CLI the app never superseded — an interrupted install, or the terminal CLI from before the app existed — stayed on PATH after uninstall. A new --remove mode in omarchy-install-hermes-cli tears it down and Remove Hermes calls it. The whole teardown turns on the ownership marker, exactly as replacement already does: without the marked stub nothing proves a mise environment is Omarchy's rather than one the user built against the same spec, so both are left alone. It attempts every step and then judges by what is left — the marked stub still present, or mise still resolving the tool — and a failure names the commands that finish the job by hand, since a rerun that no longer finds the marked stub would own nothing. Remove Hermes tolerates a failed teardown until the runtime and user data are handled, then carries the failure in its exit code. The tool spec and the ownership marker stay defined in one place, so the takeover and the teardown cannot drift.

Closes #9705.

🤖 Generated by Fable 5 in Claude Code. Reviewed by Codex XHigh.

Hermes v0.20 removed chat's --oneshot flag, which hermes_prompt_ready
used as its capability marker. A fully bootstrapped Hermes Desktop
install then read as not ready: --check failed forever, the default
agent flow looped back into the installer, and --now dead-ended with
"Launch Hermes Desktop once to finish installing it" on a machine
where it already had.

Probe for --tui and --query instead: the flags omarchy-agent actually
passes to seed an interactive session, rather than one that merely
shipped alongside them.
spencerbull and others added 2 commits September 1, 2026 15:53
Review follow-up on the readiness probe. The two greps were fixed-string
substring matches, so a future release listing only --tui-theme or
--query-log while dropping the bare --tui/--query omarchy-agent passes
would read as ready -- the same false verdict inverted. Anchor both to a
flag boundary.

Add a regression case pinning that a substring-only help is rejected,
and one exercising --check through a mise-installed hermes in both
capability directions: the desktop and foreign cases only covered their
own wrappers, and the mise path is what a machine without the app runs.

Co-Authored-By: Claude <noreply@anthropic.com>
Remove Hermes dropped the desktop package and its ~/.hermes runtime but
never touched the mise CLI, on the assumption the install-time handoff
had already removed it. A CLI the app never superseded -- an interrupted
install, or the terminal CLI from before the app existed -- was left
stranded on PATH after uninstall.

Add a --remove mode to omarchy-install-hermes-cli that performs the same
teardown the desktop takeover already does (mise rm -g + mise uninstall,
and the marked stub), and call it from omarchy-remove-ai-hermes. The tool
spec and ownership marker stay defined in one place, so the takeover and
teardown paths cannot drift. Scoped to what Omarchy owns: a Hermes the
user installed themselves is left alone.

Co-Authored-By: Claude <noreply@anthropic.com>
@spencerbull spencerbull changed the title Probe Hermes readiness by the flags omarchy-agent passes Fix the Hermes CLI readiness probe, and tear the CLI down on uninstall Sep 2, 2026
spencerbull and others added 2 commits September 1, 2026 23:32
The teardown removed the Omarchy tool spec from mise unconditionally,
so removing Hermes Desktop could destroy a mise environment the user
had built against the same spec while sparing their wrapper -- the very
command the removal claims to preserve, broken behind its back. The
whole teardown now turns on the marked stub, as replacement already
does; the desktop takeover keeps its own bargain, where a second Hermes
goes whoever built it and the app still provides the command after.

Also close the probe over underscores -- _ continues a flag name just
as - does, so --tui_mode no longer answers for --tui -- and pin the
gaps review found in the tests: each flag must match on its own (either
grep could be deleted before without a failure), a foreign wrapper's
mise environment must survive --remove, and Remove Hermes must tear
down the CLI in the interrupted-install case, not only after the app's
runtime landed.

Findings from an independent codex review at xhigh, each verified
against the source and proven by mutation before landing.

Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Two review follow-ups. The probe counted any mention of --tui/--query in
the help as support -- Hermes already writes "With --tui:" into --dev's
description, so a release that dropped the option while keeping the
prose would still read as ready. A flag now counts only when followed by
a shape argparse prints after a definition: the usage bracket, the gap
before same-line help text, an uppercase metavar, or the line end. Not
probed by parsing a real invocation on purpose -- a release that ignores
unknown arguments would turn the probe into a live session.

And the teardown trusted its commands: a stub rm that failed aborted
Remove Hermes under set -e before any ~/.hermes handling, while mise
failures vanished into || true. --remove now attempts every step, then
judges by what is left -- the marked stub still present, or mise still
resolving the tool -- and Remove Hermes tolerates the failure until the
runtime is handled, then carries it in its exit code.

Findings from the same codex review at xhigh, verified and proven by
mutation before landing.

Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5, with an independent second opinion from Codex at xhigh reasoning. Nothing here blocks it. What was checked, and the two things worth knowing:

The probe fix is right, and it was verified against the artifact users actually install. PyPI's latest hermes-agent is 0.19.0 today, which is what pipx:hermes-agent[extras=all] resolves. I pulled that wheel, rendered its real hermes chat --help from the shipped hermes_cli/_parser.py, and ran both probes against it: the old grep -qF -- '--oneshot' fails — that is #9705, reproduced — and the new --tui/--query pair passes, at every terminal width from 20 to 120 columns. The same holds for the release hermes-desktop pins today, tag v2026.8.18 (Hermes Agent v0.20.4), whose chat subparser defines -q/--query and --tui as well. Both flags have been on chat since at least v2026.7.20 (v0.19.0), so no Hermes in circulation reads as not-ready under the new probe.

The cause recorded in the commit message and the PR body is backwards, though. chat did not lose --oneshot in v0.20 — it never had it. Through v0.20.6 --oneshot was top-level only (-z, --oneshot PROMPT), and chat gained its own --oneshot for the first time in v2026.8.31 (v0.21.0), as the opt-out from the seeded-interactive -q that landed in the same release. So the probe on quattro was written against a flag that no released Hermes carried under chat. Worth correcting, because the next person debugging this will read that sentence: bumping hermes-desktop to the newest tag would make the old probe start passing on the desktop path and look like a packaging fix, while the mise path on PyPI 0.19.0 would still fail.

One thing I suspected and disproved, in case it comes up: pre-0.21 help calls -q "Single query (non-interactive mode)", which reads as though the flags could be present without the seeded session working. It works. At 0.19.0 --tui routes through _launch_tui, which exports HERMES_TUI_QUERY, and the bundled TUI submits it as the first turn and stays interactive (hermes_cli/tui_dist/entry.js). chat --tui --query= is the right thing to probe for.

Small things, none worth holding the PR for:

  • help_defines_flag can false-positive on wrapped prose. The $ branch matches a flag name that happens to end a wrapped help line, so an option whose description mentions --query could answer for a --query that no longer exists. Codex reproduced this at COLUMNS=25. It is not reachable against any current Hermes help — the only prose mention is --dev's "With --tui:", and the colon blocks every branch — so this is robustness rather than a bug today.
  • The same helper fails on coloured output. With PYTHON_COLORS=1, Python 3.14's argparse emits an ANSI reset immediately after each option name even through a pipe, and both greps then miss; I confirmed that against the real 0.19.0 parser. Also not reachable today, since the installer pins Python 3.13 and Hermes declares <3.14.
  • When --remove fails it says "Remove ~/.local/bin/hermes and the mise tool ..., then run omarchy-install-hermes-cli --remove again", but rm -f has already taken the marked stub by then, so a second --remove finds nothing it owns and exits 0 without touching mise. The advice cannot do what it says.
  • AGENTS.md asks for atomic commits, and two here staple the two bodies of work together: c462aad9 mixes the teardown's ownership gate with the probe's underscore matching, and 46cfc4ad mixes the teardown's judge-by-what-is-left with help-definition matching. The first three commits are cleanly split. Codex read the commits the same way independently, though its independence is not currently guaranteed.

Codex also flagged that mise where might report failure merely because mise rm -g had removed the config reference, which would let a surviving environment read as cleanly removed. That does not hold: tested on a worker against mise 2026.8.15, mise where still resolves the installed path after mise rm -g and only fails once mise uninstall --all has actually removed it. The residual check works as written.

Tests, run on a disposable worker rather than here: test/shell.d/hermes-cli-test.sh (34 passed), hermes-remove-test.sh (10), hermes-cli-migration-test.sh (12), preinstalls-test.sh (12), default-agent-test.sh (30), and ./test/cli (116 ok, exit 0). Nothing was pushed to your branch.

Waiting on the maintainer. #9705 stays open until this merges; its own suggested fix, probing top-level --oneshot as well, would have kept the check keyed to a flag that says nothing about the chat session Omarchy starts.

@spencerbull

Copy link
Copy Markdown
Contributor Author

Review — head 46cfc4a

Verdict: SHIP AFTER FIX (pushed). Every finding below is fixed on this branch; waiting on maintainer review.

What it does: Repoints the Hermes CLI readiness probe at the flags omarchy-agent actually invokes, and makes Remove Hermes tear down an Omarchy-owned mise CLI it previously left stranded on PATH.

Findings (reviewed at pre-fix head 36d5225, each verified against source and each fix proven by mutation — reverting it fails exactly its regression test):

  • [high] bin/omarchy-install-hermes-cli — --remove ran mise rm -g and mise uninstall --all for the tool spec unconditionally, gating only the stub on ownership, so uninstalling Hermes Desktop could destroy a mise environment the user built against the same spec while sparing their wrapper — the command the removal claims to preserve, broken behind its back. Fixed in c462aad: the whole teardown turns on the ownership marker, matching the doctrine the install path already enforces.
  • [medium] bin/omarchy-install-hermes-cli — the probe matched --tui/--query anywhere in the help text, so a mention in another option's description ("With --tui:" already ships in --dev's help) or an underscore sibling like --tui_mode answered for the option itself. Fixed in 46cfc4a: a flag counts only in argparse definition shapes (usage bracket, pre-help gap, uppercase metavar, line end).
  • [medium] bin/omarchy-remove-ai-hermes — a failed stub removal aborted the script under set -e before any ~/.hermes handling, while mise failures vanished into || true and the script announced success. Fixed in 46cfc4a: --remove attempts every step then judges by what is left (marked stub still present, or mise still resolving the tool), and Remove Hermes tolerates the failure until runtime and user data are handled, then carries it in its exit code.
  • [low] test/shell.d — either probe grep could be deleted without any test failing (fixtures always advertised both flags or neither), and the --remove wiring was asserted only when the app's runtime had landed, so moving the call inside that branch would silently drop the interrupted-install case this change targets. Both pinned in c462aad.

Tests: ./test/all green, 225/225, run on a local dev-linked machine, not on an omabot worker — the Proxmox host is unreachable, and this is an own-branch review with no contributor code, so worker isolation was not required; saying it plainly since a skip is not a pass. The probe fix was also verified live on the machine that reproduced the dead loop, against both the app-provisioned Hermes v0.20.4 runtime and a mise/PyPI v0.19.0 install, and hermes chat --tui --query=… was confirmed to seed a live interactive session rather than one-shot.

Related: closes #9705, which reports the same defect against the current release (its diagnosis differs — --oneshot was removed in v0.20 rather than moved to the top level — but the symptom and the fix are the same). Follows the #7469 merge that introduced this code.

Codex: second opinion at xhigh reasoning, read-only, pinned to 36d5225. The high finding and the deleted-grep test vacuity were its contributions rather than confirmations, and stand on their own. Where it agreed with conclusions already drawn, that is agreement only — its independence is not currently guaranteed, since it reads the same filesystem as the session it checks. Rejected from its fix directions: a parse-only probe that runs a real invocation with a sentinel flag, because a release that ignores unknown arguments would turn the probe into a live agent session; definition-shape matching covers the same false-accepts without that risk.

For the maintainer: mise uninstall leaves the tool's version-alias symlinks and caches behind under ~/.local/share/mise; the teardown stops at mise's own commands rather than hardcoding mise's directory layout, so that inert residue is accepted. Say so if you want it pruned anyway.

🤖 Generated by Fable 5 in Claude Code. Reviewed by Codex XHigh.

A failed --remove told the user to run it again, but that advice could
never work: rm -f has usually taken the marked stub by the time the
failure is judged, and a rerun that finds nothing it owns succeeds
without touching the mise environment it was asked to finish removing.
Spell out the three commands that complete the job by hand instead.

Also correct the story the probe comment told: chat never lost
--oneshot in v0.20 -- no released Hermes defined it there. It lived at
the top level until v0.21 added chat's own, so the old probe was keyed
to a flag no release ever carried under chat, and every install read
as not ready. Recorded straight so a future hermes-desktop bump to
v0.21+, which would make the old probe pass on the desktop path alone,
cannot read as the fix.

Findings from omarchybot's review (Opus 5, with Codex at xhigh).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@spencerbull

Copy link
Copy Markdown
Contributor Author

Both actionable findings above are fixed in 21470fd: the --remove failure message now names the three commands that finish the teardown by hand — a rerun could never work once the stub was gone, exactly as described — and the probe's history is recorded straight in the code comment and the body: no released Hermes defined --oneshot under chat, so the old probe was keyed to a flag that never existed there, which is why a future hermes-desktop bump to v0.21+ must not be mistaken for the fix. The wrapped-prose and PYTHON_COLORS false-matches stay as accepted robustness debt (unreachable under the 3.13 pin and current help text), and the two mixed commits stand as pushed rather than rewriting public history.

🤖 Generated by Fable 5 in Claude Code.

@spencerbull
spencerbull merged commit f99d33a into omacom:quattro Sep 2, 2026
@spencerbull
spencerbull deleted the fix/hermes-prompt-probe branch September 2, 2026 20:21
ryanrhughes pushed a commit that referenced this pull request Sep 8, 2026
Fix the Hermes CLI readiness probe, and tear the CLI down on uninstall

(cherry picked from commit f99d33a)
(cherry picked from commit de739ea736563763150725ce33151001c5966add)
ryanrhughes pushed a commit that referenced this pull request Sep 8, 2026
Fix the Hermes CLI readiness probe, and tear the CLI down on uninstall

(cherry picked from commit f99d33a)
(cherry picked from commit de739ea736563763150725ce33151001c5966add)
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy-install-hermes-cli readiness probe never passes — --oneshot is top-level in hermes --help, not under hermes chat

3 participants