fix(desktop): resolve a Hermes-capable interpreter for the .desktop Exec - #92088
autumn8-builds wants to merge 1 commit into
Conversation
resolve_exec_command() previously prefixed the resolved launcher with sys.executable whenever the script's shebang pointed outside the running interpreter's directory. When Hermes is launched via an interpreter that cannot import hermes_cli (e.g. a uv-managed or system python shim), the generated .desktop fails silently under Terminal=false: clicking the pinned launcher does nothing. Now the prefix interpreter is chosen by capability, not blindly from sys.executable: 1. sys.executable, only if it can import hermes_cli 2. the installed venv-backed wrapper on PATH (e.g. ~/.local/bin/hermes) 3. sys.executable -m hermes_cli.main Also set StartupNotify=false: the Electron startup token does not propagate through the wrapper, so a true value leaves a pinned launcher spinning forever. Adds regression tests covering the "sys.executable lacks hermes_cli" and "no wrapper available" paths. Refs NousResearch#92086
Capability-based selection is the right instinct: probing whether Substantive points:
|
|
I have #92090 open against the same issue with a different theory, and I would rather put the overlap in front of you than let two PRs race. Short version: I think your capability gate is correct and covers a case mine does not, and I think one expression inside it is load-bearing in a way that currently breaks it on the default POSIX layout. Your theory is real and I do not handle it. If The expression. Every branch of if _can_import_hermes_cli(Path(sys.executable).resolve()):
return [str(Path(sys.executable).resolve()), str(script), "desktop"]
wrapper = shutil.which("hermes")
if wrapper:
return [str(Path(wrapper).resolve()), "desktop"]
return [str(Path(sys.executable).resolve()), "-m", "hermes_cli.main", "desktop"]On POSIX,
This is measured, not theoretical. @uncrayon ran an affected host on #92090 (Ubuntu 26.04, git/uv install, symlinked The resolved one raises The fix is a substitution, not a redesign. Probe and emit Worth knowing this cannot reproduce on Windows: Windows venvs copy the interpreter into There is a second half in #92090 you may want regardless: I have no preference about which PR carries the combined fix and I am not asking you to close this one. If maintainers prefer yours as the base, I will port One unrelated observation while I was reading: |
|
Closing in favor of #92122 (same fix, cleaner history + the abspath hardening from the review). Thanks! |
Summary
Fixes the Linux
.desktoplauncher failing silently when Hermes is launched via an interpreter that cannot importhermes_cli(e.g. a uv-managed or system python shim). Closes #92086.resolve_exec_command()previously prefixed the resolved launcher withsys.executablewhenever the script's shebang pointed outside the running interpreter's directory. Whensys.executableitself lackshermes_cli, the generated entry dies onimport hermes_cli— invisibly, becauseTerminal=false. Clicking the pinned launcher does nothing.Fix
The prefix interpreter is now chosen by capability, not blindly from
sys.executable:sys.executable, only if it can importhermes_cli~/.local/bin/hermes)sys.executable -m hermes_cli.mainAlso sets
StartupNotify=false: the Electron startup token does not propagate through the wrapper, sotrueleaves a pinned launcher spinning forever.Test plan
-m).tests/hermes_cli/test_linux_desktop_entry.pypasses (18 passed, 2 platform-skipped) on a venv install wheresys.executableis a uv shim.