Skip to content

hermes update reports success when desktop rebuild silently fails #44580

Closed

Description

@wsygwr

Bug: hermes update reports success when desktop rebuild silently fails

Summary

hermes update runs hermes desktop --build-only to rebuild the packaged Electron app, but if that rebuild exits non-zero the failure is printed as a warning and the update flow continues to ✓ Code updated! → ✓ Update complete! — leaving the user with a stale desktop binary and no error to act on.

Steps to reproduce

  1. Install Hermes Desktop 0.15.1 on Windows
  2. Cause hermes desktop --build-only to fail (e.g. npm not on PATH, or the Electron binary download is blocked by a CDN — common in mainland China)
  3. Run hermes update
  4. Observe the output: "⚠ Desktop build failed (non-fatal; run hermes desktop to retry)" followed by "✓ Code updated!" and "✓ Update complete!"
  5. Restart the desktop app — it crashes on launch with Invalid file descriptor to ICU data received because icudtl.dat and friends are missing from release/win-unpacked/.

Actual vs expected

  • Actual: update exits 0, prints "Update complete!", user thinks everything is fine.
  • Expected: update exits non-zero (or, at minimum, prints a hard failure banner and stays in the broken state rather than pretending success).

Root cause

hermes_cli/main.py lines 8629-8639 (commit afe53708e):

print("→ Checking if desktop app needs rebuilding...")
_desktop_build_cmd = [sys.executable, "-m", "hermes_cli.main", "desktop", "--build-only"]
build_result = subprocess.run(_desktop_build_cmd, cwd=PROJECT_ROOT, check=False)
if build_result.returncode != 0:
    build_result = subprocess.run(_desktop_build_cmd, cwd=PROJECT_ROOT, check=False)
if build_result.returncode != 0:
    print("  ⚠ Desktop build failed (non-fatal; run `hermes desktop` to retry)")
# ... continues to "✓ Code updated!" regardless ...

The retry-once helps transient races but the final if only prints a warning and falls through. The exit code of the parent hermes update process is 0, and the user-facing message is "Update complete!".

Impact

Suggested fix

  • Minimum: when hermes desktop --build-only exits non-zero, exit the whole hermes update with a non-zero code, so the in-app update button surfaces a real "Update didn't finish" error instead of "Update complete!".
  • Better: detect that the packaged executable is now older than the freshly-pulled source (compare release/win-unpacked/Hermes.exe mtime to git HEAD's commit-time) and emit a hard-fail banner even if the rebuild-child itself somehow exited 0.

Environment

  • Hermes Desktop 0.15.1, Windows 10
  • afe53708e (main)
  • ~/.hermes/logs/bootstrap-installer.log and update.log reproduced

Activity

  1. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    comp/cliCLI entry point, hermes_cli/, setup wizard
    area/configConfig system, migrations, profiles
    on Jun 12, 2026
  2. AIalliAI commented on Jun 12, 2026

    @AIalliAI

    Verified on current main (9102d4a) — the report is accurate, with two small corrections.

    Confirmed:

    • The quoted snippet is verbatim at hermes_cli/main.py:8635-8639: hermes desktop --build-only failure (after one retry) only prints ⚠ Desktop build failed (non-fatal; ...) and falls through to ✓ Code updated! (line 8642) and ✓ Update complete! (line 8885). cmd_update propagates no status, so the process exits 0.
    • The child really does exit non-zero on failure (main.py:5322 sys.exit(build_result.returncode or 1), plus artifact-existence checks at 5343/5348), so the parent's warning-only handling is the exact suppression point.
    • It's actually slightly worse than reported: in --gateway mode the updater unconditionally writes "0" to ~/.hermes/.update_exit_code (main.py:8946-8951) after the rebuild step, so the desktop in-app update button also reports plain success.

    Two corrections:

    1. The "npm not on PATH" repro takes a different path: the whole rebuild block is gated on shutil.which("npm") at main.py:8628, so with npm missing it's skipped silently — no warning at all, straight to "Update complete!". Same outcome (stale binary, exit 0), but the quoted warning never prints.
    2. Step 5's launch crash (icudtl.dat missing) requires the failed pack to have half-destroyed the previous win-unpacked tree — that destruction is hermes update destroys Hermes Desktop executable on failed Electron rebuild (desktop shortcut becomes dead link) #44225, a sibling bug. If the pack fails before touching release/, you get a stale-but-working binary instead. This issue is the reporting gap; hermes update destroys Hermes Desktop executable on failed Electron rebuild (desktop shortcut becomes dead link) #44225 is the destruction gap.

    Also worth noting: the build path already auto-retries via npmmirror.com when the GitHub Electron download looks blocked (main.py:5297-5313), so a persistent CDN failure has to defeat both hosts — but when it does, the suppression here is exactly as described.

    Context on why it's non-fatal: the comment at main.py:8608-8612 deliberately treats post-venv steps as "non-core". That's reasonable for the exit-the-update-early question, but it shouldn't erase the failure from the final summary and the .update_exit_code marker. A minimal fix that keeps the non-fatal design: track a desktop_build_failed flag, print ⚠ Update complete — with warnings: desktop rebuild FAILED (binary is stale; run \hermes desktop`)instead of the plain success line, and write a non-zero/warning status to.update_exit_code` so the in-app button can surface it. The mtime-vs-commit staleness detection suggested under "Better" is what PR #42382 already implements — probably best kept there.

    Related: #38161 is the same "update reports success despite a broken non-core step" pattern for npm deps.

  3. szzhoujiarui-sketch commented on Jun 12, 2026

    @szzhoujiarui-sketch

    Taking this one. Plan:

    • Minimum fix: track desktop_build_failed flag, print ⚠ Update complete — with warnings: desktop rebuild FAILED (binary is stale; run \hermes desktop`)instead of plain✓ Update complete!, and write a non-zero/warning status to .update_exit_code` so the in-app update button can surface it.
    • Won't mix in unrelated changes (mtime staleness detection is PR fix(desktop): detect stale builds and surface rebuildNeeded in update UI #42382's scope).

    Will submit a PR shortly.

  4. added a commit that references this issue on Jun 12, 2026
    3df96f1
  5. liuhao1024 commented on Jun 12, 2026

    @liuhao1024

    This is fixed by #44591 — propagates desktop build failure to hermes update exit code.

  6. szzhoujiarui-sketch commented on Jun 13, 2026

    @szzhoujiarui-sketch

    Confirmed: #44591 is still open and addresses this issue correctly. I'll step back and let that PR proceed — no need for a separate fix from my side. Thanks @liuhao1024 for picking this up!

  7. Hugh-24041820 commented on Jun 15, 2026

    @Hugh-24041820

    I'm experiencing what appears to be the same root cause on Windows 11.

    Environment

    • OS: Windows 11 (Home), mainland China
    • Hermes version: v0.16.0 (2026.6.5)
    • Installed at: C:\Users\16535\AppData\Local\hermes
    • Git installed at: D:\Program Files\Git\ (non-default drive)

    Symptoms

    Every time I launch the Hermes desktop app, it immediately triggers:

    [bootstrap] handed off bootstrap-needed recovery to updater:
    hermes-setup.exe --update --branch main
    [updates] exiting desktop to release app.asar

    The setup.exe runs (I see the installer window), exits with code 0, but on the next launch the same bootstrap recovery triggers again — infinite loop.

    Evidence

    • .update_check shows {"behind": 0, "ver": "0.16.0"} — no actual update needed
    • .update_exit_code shows 0 — setup exits "successfully" but doesn't fix the condition
    • desktop.log shows the same [bootstrap] → [updater] → exit pattern repeating across every launch

    Likely cause

    I'm in mainland China, so the Electron binary download from GitHub's CDN during the desktop rebuild phase likely fails silently (as noted in the issue description about "common in mainland China"). The update reports success but the desktop is never actually rebuilt, so Hermes keeps detecting the inconsistency.

    This also causes the session context bar to reset to 0/1.0M 0% on every launch, since the desktop process is killed and recreated.

  8. alt-glitch commented on Jun 26, 2026

    @alt-glitch

    This was generated by AI during triage.

    Kept open: the cited "fixed by #44591" PR is still open/unmerged, so the silent-success-on-failure bug is not yet on main (verified verbatim at hermes_cli/main.py:8635-8639 on main@9102d4a). Competing open fixes for a maintainer to pick: #44591 (propagate desktop build failure to the hermes update exit code) and #50267 (report the failure in the final summary + exit code; re-file of closed #44608). Both target this issue.

  9. added
    comp/desktopElectron desktop app (apps/desktop/*)
    P1High — major feature broken, no workaround
    P2Medium — degraded but workaround exists
    and removed
    area/configConfig system, migrations, profiles
    P2Medium — degraded but workaround exists
    P1High — major feature broken, no workaround
    on Jun 26, 2026
  10. alt-glitch commented on Jul 19, 2026

    @alt-glitch

    This was generated by AI during triage.

    Related to open #44591, which propagates the confirmed Desktop rebuild failure into hermes update's final result and exit code.

  11. GottZ commented on Jul 29, 2026

    @GottZ

    This was generated by AI during triage.

    Summary

    One open PR addresses #44580: #44591 propagates nonzero desktop rebuild results into the final update message, gateway status file, and process exit code, but it does not detect the installed-desktop/no-resolvable-npm path that also causes silent success.

    Related pull requests

    Suggested consolidation

    Merge #44591 after rebasing its status propagation onto the current rebuild block, preserving the captured build-log tail, and treating an installed desktop with no resolvable npm as a rebuild failure with regression coverage. There are no listed duplicate PRs to close.

    Complex graph

    flowchart LR
        classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
        classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
        classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
        classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
        classDef best stroke-width:3px,stroke:#b45309
        classDef target stroke-width:3px,stroke:#4338ca
        I44580(["issue #44580 (open)"])
        P44591["PR #44591 (open)"]
        P44591 -->|best fix| I44580
        class I44580 open
        class I44580 target
        class P44591 open
        class P44591 best
        click I44580 "https://github.com/NousResearch/hermes-agent/issues/44580"
        click P44591 "https://github.com/NousResearch/hermes-agent/pull/44591"
    
    Loading

    Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed or no verify verdict yet (state tag in the node label).

    Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 9 kB of PR diffs, 6 kB of issue/PR text, 6 kB of discussion (6 comments), 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

  12. mr-NFA commented on Aug 5, 2026

    @mr-NFA

    Fresh reproduction — Aug 5 2026, Hermes v0.20.0 (2026.8.3), Windows 11 Home 26200

    Real-world case from today. Same failure family as #44580 and #64567; this occurrence shows two additional gaps:

    1. Update failures are silent and leave a broken desktop state.
    Four hermes update attempts today (11:49, 12:00, 12:11, 12:21). The 11:49 run aborted on the venv-lock check (three hermes\scripts\cmd relay processes holding the venv — the common retry scenario: users retry until it "goes through", and each retry can leave a different partial state). The 12:00 run pulled the new code but then failed, from update.log:

    === hermes update started 2026-08-05T12:00:57 ===
      Local changes detected - stashing before update...
      Git update failed: Command '['C:\\Users\\leigh\\AppData\\Local\\hermes\\bin\\uv.exe', 'pip', 'install', '-e', '.']' returned non-zero exit status 2.
    

    The failure is only a terminal line — nothing persistent tells the user or the desktop app that the install is now in a half-updated state.

    2. Stale/absence detection did not trigger even though the packaged app was fully gone.
    After the failed updates, the desktop app was completely absent: no apps/desktop/release/win-unpacked/Hermes.exe, no release/ dir at all, no dist/, no node_modules/ under apps/desktop. Every shortcut dead, zero user-facing error. The last successful desktop build in update.log was 2026-07-26; its install-stamp.json referenced commit a97b6ff8, while current HEAD is 1be70d635 (newer) — exactly the "packaged exe older than pulled source" condition from the suggested fix in this issue, and nothing surfaced it. Manual hermes desktop --build-only rebuilt cleanly in ~10 min, confirming source and toolchain were fine.

    3. Possible rollback-path involvement.
    The Jul 26 build log shows:

    [before-pack] preserved previous unpacked dir for rollback: ...\release\win-unpacked.bak
    

    Neither win-unpacked nor win-unpacked.bak existed after the failed updates. Worth checking whether the rollback/cleanup path can remove both the good build and its backup.

    Suggested hardening (on top of #44591):

    • The desktop-needs-rebuild check should verify artifact existence, not just commit stamp: release/win-unpacked/Hermes.exe missing entirely must count as "needs rebuild", and rebuild failure should hard-fail the update (per fix(cli): propagate desktop build failure to hermes update exit code #44591).
    • Update failures (venv lock, pip install) should leave a persistent "desktop app may be broken" flag that the desktop app itself surfaces at next launch — instead of a silently dead shortcut.
    • On the earlier lock-abort path (the 11:49 run), the update should not leave the user with a stale desktop binary and no breadcrumb.

    Environment: Hermes Agent v0.20.0 (2026.8.3), Python 3.11.15, Windows 11 Home Single Language build 26200, install at C:\Users\leigh\AppData\Local\hermes\hermes-agent. Recovery was hermes desktop --build-only (run detached), which rebuilt release/win-unpacked/Hermes.exe successfully.

    Impact note: a user without a technical assistant is simply stuck — broken shortcut, no error message, and the fix requires knowing the hermes desktop incantation.

  13. added
    sweeper:risk-compatibilitySweeper risk: may break existing users, config, migrations, defaults, or upgrades
    on Aug 5, 2026
  14. OutThisLife commented on Sep 24, 2026

    @OutThisLife

    Verified on current main (d350422b15): a failed Desktop rebuild no longer ends in ✓ Update complete!. 6907c97847 first replaced that banner with an "Update partially complete" warning; since the PM refactor (26c4e8b160) the update builds the desktop app in build_update_products() (hermes_cli/source_build.py) through run_contained, which raises on a non-zero exit, so a failed rebuild aborts the update instead of reporting success.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/install-updateInstaller, updater, packaging, wheels, doctorcomp/cliCLI entry point, hermes_cli/, setup wizardcomp/desktopElectron desktop app (apps/desktop/*)sweeper:risk-compatibilitySweeper risk: may break existing users, config, migrations, defaults, or upgradestype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions