Skip to content

Open Hermes Desktop on runtimes with the new install layout - #758

Merged
ryanrhughes merged 4 commits into
omacom:masterfrom
manuaudio:fix/hermes-desktop-current-runtime-layout
Oct 13, 2026
Merged

ryanrhughes merged 4 commits into
omacom:masterfrom
manuaudio:fix/hermes-desktop-current-runtime-layout

Conversation

@manuaudio

@manuaudio manuaudio commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes omacom/omarchy#13975.

Current Hermes runtimes no longer keep a venv/ inside ~/.hermes/hermes-agent. On Hermes main, hermes_cli/_launchers.py publishes the CLI as .hermes/bin/hermes, while the committed dependency environment lives under installs/<sha>/environments/<hash>/venv.

The desktop launcher only recognized $runtime/venv/bin/hermes and $runtime/venv/bin/python. After an update to the current layout it therefore fell back to the packaged app with HERMES_DESKTOP_IGNORE_EXISTING=1, and the app looped through first-launch bootstrap as reported in the linked issue.

hermes-desktop.sh now:

  • treats .hermes/bin/hermes as the current CLI, with venv/bin/hermes retained for older runtimes
  • asks the CLI's read-only --print-runtime-command boundary for its store interpreter
  • uses that interpreter to read pm.environments.committed_venv(runtime), then loads desktop settings with the committed environment's Python and dependencies
  • falls back to venv/bin/python for older runtimes or when the committed environment lookup returns nothing

pkgrel is bumped to 5 because 2026.9.7-4 was already published from #858 with the old launcher.

Testing

runtime-test.py now models the current layout with a real multi-line shell shim, a separate store interpreter, and a dependency available only from the committed environment. It verifies that the runtime app opens without IGNORE_EXISTING and that desktop.disable_gpu reaches the launcher.

Before the implementation, that regression failed with gpu: None: the per-line parser could not parse the multi-line shim and the bare store interpreter could not load runtime dependencies. With this change:

  • runtime-test.py passes against the pinned 2026.9.7 source (2237be3).
  • bash -n pkgbuilds/hermes-desktop/hermes-desktop.sh passes.
  • shellcheck -S warning pkgbuilds/hermes-desktop/hermes-desktop.sh passes.
  • python3 -m py_compile pkgbuilds/hermes-desktop/runtime-test.py passes.
  • git diff --check passes.

I have not run this against a live runtime on the new layout. My local install still uses the older layout, which remains covered by the existing test cases.

@Quantman1974

Copy link
Copy Markdown

The exec-line parser fails on a real shim. On this machine ~/.hermes/hermes-agent/.hermes/bin/hermes is #!/bin/sh + exec <python> -I -c '<multi-line script>' …, so the per-line shlex.split raises ValueError: No closing quotation. 2>/dev/null || true swallows it, runtime_python ends up empty, and once venv/ is gone the launcher runs /usr/bin/python with runtime="" — the app still opens, but desktop.* settings are silently ignored.

The parsed interpreter also isn't enough on its own: the bare tool Python lacks the dependency env (load_config → ModuleNotFoundError: No module named 'ruamel', caught as defaults). What works here, using only read-only entry points: take argv[0] from hermes --print-runtime-command (documented in _launchers.py as the machine boundary), then pm.environments.committed_venv(runtime) → <env>/bin/python, which loads the full config.

Filed by Claude Opus 5.5 via Claude Code.

@manuaudio
manuaudio force-pushed the fix/hermes-desktop-current-runtime-layout branch from d7b3852 to 01c653a Compare October 4, 2026 13:01
@manuaudio

Copy link
Copy Markdown
Contributor Author

Thanks — both points were right. I replaced the per-line shim parser with the CLI's --print-runtime-command machine boundary, then use its store interpreter to resolve pm.environments.committed_venv(runtime) and load settings with that environment's Python.

The regression now uses a real multi-line shim plus a dependency available only in the committed environment. It failed on the previous commit with gpu: None; the focused runtime test now passes. Updated in 01c653a.

@spencerbull

Copy link
Copy Markdown
Contributor

Thanks @manuaudio. I reviewed this at 01c653a together with Codex XHigh as a second opinion. The approach is right: --print-runtime-command is the interface upstream documents for consumers of the published launcher, and pm.environments.committed_venv is the environment the runtime itself runs on. Read against Hermes main at 63d0b941, pm.environments and hermes_constants import under the bare store Python with -I, committed_venv raising RuntimeError is caught by the || true, and _desktop_launch_options imports cleanly from the committed environment. The checksums match the files, and the new block in runtime-test.py would fail with the launcher change reverted, since it removes the legacy CLI and requires gpu="1" from the committed environment.

Two things stop it landing as it is:

  1. pkgrel=4 is already taken. Rebuild packages with mismatched cached archives #858 (a1ad25b) bumped hermes-desktop to 2026.9.7-4 on master after this branch forked, and that release, with the old launcher, is what edge ships now. Built with bin/build --package hermes-desktop --mirror edge on a worker, this head ends at hermes-desktop - already up to date and builds nothing, so merging it would publish nothing and every installed -4 would keep the bootstrap loop. It needs a rebase onto master and pkgrel=5.
  2. A leftover venv/bin/python wins over the committed environment. hermes-desktop.sh:35 asks for the committed environment only when venv/bin/python is absent. On a runtime that has the new .hermes/bin/hermes shim and still has something executable at venv/bin/python, the launcher reads the current checkout's settings with that interpreter. The workaround in hermes-desktop launcher falls back to the stale packaged app forever on the new Hermes runtime layout (no runtime/venv), causing an infinite first-launch bootstrap loop omarchy#13975 creates exactly that: it links venv/bin/python to one generation's interpreter, and after the next hermes update the link keeps pointing at the superseded generation until it is collected. When the current code needs something that environment lacks, _desktop_launch_options swallows the import failure and returns its defaults, so desktop.disable_gpu and the rest are silently ignored. Codex XHigh found this. It also points out that upstream's generation commit records the new environment without removing the in-tree venv/; the end-to-end run below will show which way that goes. The fix is to prefer the committed environment whenever the shim is there, and fall back to venv/bin/python only when that lookup gives nothing.

Codex XHigh also flagged a race: the launcher picks a generation and runs it without upstream's lease, so an update collecting that generation in between could fail the launch. I'm not acting on it. It needs a concurrent hermes update to collect a day-old generation inside the launcher's few hundred milliseconds, and the worst case is one launch that opens nothing. On the pkgrel finding it agreed with a conclusion I had already reached, and since it can read this session, that agreement is not guaranteed to be independent.

I'll push both fixes to this branch with a regression test for the second. Then I'll check it end to end on fresh Omarchy workers on quattro: install Hermes through Omarchy, reproduce the loop with -4 after hermes update, then open the app from the launcher on -5 on both the old and new runtime layouts. I'll report back here. After that it waits on a maintainer, both to label the PR build-approved so CI builds it and to decide on the merge.

🤖 Generated by Opus 5.5 in T3 Code. Reviewed by Codex XHigh.

spencerbull and others added 3 commits October 12, 2026 23:04
Master's omacom#858 already published 2026.9.7-4 with the old launcher, so a -4 carrying this one is never offered to anyone who has it: the release builder answers "already up to date" and builds nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The launcher asked PM for the committed environment only when venv/bin/python was absent, so a runtime on the new layout that still had one read the current checkout's settings with it. The workaround in omacom/omarchy#13975 leaves exactly that: venv/bin/python linked to one generation, which after the next update is the superseded one until it is collected. When the current code needs something that environment lacks, _desktop_launch_options returns its defaults and desktop.* settings are silently ignored. The committed environment is now asked for whenever the .hermes/bin/hermes shim is there, and venv/bin/python is used only when that gives nothing.

Co-Authored-By: Codex XHigh <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@spencerbull

Copy link
Copy Markdown
Contributor

I pushed three commits to this branch and ran it end to end. At 6c00028 it does what it says in every runtime state I could produce.

  • 1e437ec merges master in, with no conflicts.
  • cae4e30 sets pkgrel=5, so it ships over the -4 that edge already has.
  • 6c00028 asks for the committed environment whenever .hermes/bin/hermes is there, and falls back to venv/bin/python only when that lookup gives nothing. It adds a regression to runtime-test.py. On a worker, that regression fails against the launcher at 01c653a (gpu: None) and against master's launcher (which falls back to /opt), and your original test still passes on the new launcher.

Built on a worker with bin/build --package hermes-desktop --mirror edge at 6c00028: check() passes and the packaged /usr/bin/hermes-desktop is byte for byte the branch's launcher.

End to end, on fresh Omarchy workers on quattro, I installed Hermes through Omarchy with omarchy-install-hermes-cli --now, which seeds v0.21.1 on the old layout. desktop.disable_gpu: true was set throughout, and every launch went through the launcher icon.

  • Old layout: -4 and -5 both open the runtime's own app with HERMES_DESKTOP_DISABLE_GPU=1.
  • After hermes update --yes to main (63d0b941, v0.21.7+279): the update leaves venv/ in place, a Python 3.11 interpreter from the original install, beside .hermes/bin/hermes and the committed environment on the store's Python 3.14.7. On a runtime Omarchy installed, master's launcher therefore keeps opening the right app after an update, but reads settings with that leftover 3.11 interpreter. With a sentinel standing in for it, -5 never runs it and opens normally, while the launcher at 01c653a runs it and exits 1 without opening anything.
  • No venv/ at all: this is what upstream's current installer leaves on a fresh install, and the state in hermes-desktop launcher falls back to the stale packaged app forever on the new Hermes runtime layout (no runtime/venv), causing an infinite first-launch bootstrap loop omarchy#13975. I produced it twice: by moving venv/ aside on the updated runtime, and on a worker where Hermes was installed fresh with upstream's install.sh at main followed by hermes desktop --build-only. Both gave the same result:
    • -4 runs /opt/hermes-desktop/Hermes with HERMES_DESKTOP_IGNORE_EXISTING=1 and without the GPU setting, logs falling through to bootstrap, and ends on "Hermes couldn't start: Timed out connecting to Hermes backend". Its Repair install button is the loop the issue describes.
    • -5 runs the runtime's own app with HERMES_DESKTOP_DISABLE_GPU=1, logs Using Hermes at ~/.hermes/hermes-agent, and reaches provider setup with the backend ready in about three seconds.

Codex XHigh reviewed 6c00028 as a second round and found nothing. The run above confirmed its round-1 point that an update keeps venv/.

Two lines of the description are now out of date: pkgrel is 5, and venv/bin/python is the fallback rather than the first choice. @manuaudio, I've left the description for you to update.

This now waits on a maintainer. For a pull request from an outside author, the build-approved label both starts the CI build and arms auto-merge once the checks pass, so applying it is the merge decision. My first comment described those as two separate steps.

🤖 Generated by Opus 5.5 in T3 Code. Reviewed by Codex XHigh.

@spencerbull spencerbull added the build-approved Maintainer approved this PR to build on the self-hosted pool label Oct 13, 2026
@ryanrhughes
ryanrhughes enabled auto-merge (squash) October 13, 2026 04:28
@ryanrhughes
ryanrhughes merged commit 1cf4b31 into omacom:master Oct 13, 2026
12 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Publish succeeded → live

Packages: hermes-desktop (x86_64, PR artifact)

  • edge/x86_64: hermes-desktop-2026.9.7-5-x86_64

Commit 1cf4b31 · run

@manuaudio

Copy link
Copy Markdown
Contributor Author

I updated the description to match the merged head: pkgrel=5, and venv/bin/python is now only the fallback after the committed environment lookup. The final correction is in 6c000281; your worker regression and end-to-end run cover both the stale-venv and no-venv states. Thanks for carrying this through.

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

Labels

build-approved Maintainer approved this PR to build on the self-hosted pool

Projects

None yet

4 participants