Skip to content

fix(updates): report backend update failures truthfully - #82658

Closed
alexgunsberg wants to merge 1 commit into
NousResearch:mainfrom
alexgunsberg:fix/backend-update-visibility-current
Closed

fix(updates): report backend update failures truthfully#82658
alexgunsberg wants to merge 1 commit into
NousResearch:mainfrom
alexgunsberg:fix/backend-update-visibility-current

Conversation

@alexgunsberg

@alexgunsberg alexgunsberg commented Aug 9, 2026

Copy link
Copy Markdown

Summary

Backend update checks now distinguish “already current” from “could not determine update state.” This preserves the independent Backend status needed by Desktop PR #82608.

What changed

  • return structured backend update facts instead of collapsing Git failures into zero-behind
  • classify repository ownership and writable-install failures without exposing raw command output
  • surface truthful update capability and error codes through the Dashboard API
  • retain remote-target-aware update facts

Scope

Backend only: hermes_cli/banner.py, hermes_cli/web_server.py, and three focused Python test files. Desktop UI changes remain isolated in PR #82608.

Verification at exact head 9d0e565

  • 256 related banner, updater, and Dashboard admin endpoint tests passed
  • the ownership regression fails against untouched base 244d296646909aca1dd16c9759491da0ef4cd163 (missing structured checker), proving it detects the old behavior
  • Ruff passed on all five touched files
  • git diff --check passed
  • Real classifier probe: clean candidate returned behind=0, repo_writable=true; root-owned /opt/hermes-agent returned the intentional update-available-without-count sentinel with repo_writable=false, which the API maps to update_available=true, can_apply=false

@Riccardo-Vecchi Riccardo-Vecchi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new structured status is a good direction, but the fallback currently erases the ownership/permission failure it is meant to surface.

Comment thread hermes_cli/banner.py
# via ls-remote against the official HTTPS remote. No local writes.
checked = _check_via_rev(head_rev)
if checked is not None:
return checked, None, head_rev

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Preserve fetch ownership/permission failures after the read-only compare

When fetch fails, this return converts any successful ls-remote comparison into (checked, None, head_rev), discarding fetch_error. A deterministic ownership case is: the ownership-relaxed HEAD probe succeeds; fetch without safe.directory fails with dubious ownership; the public ls-remote succeeds; this branch returns an available/current result with no error. If the install is writable despite the owner mismatch (for example root or group-writable), repo_install_writable() is also true, so /api/hermes/update/check still reports can_apply=true even though the update command cannot pass Git's ownership guard. Preserve the fetch error/capability failure while still returning the read-only availability fact, and add coverage for a successful ls-remote following a git-ownership/git-permission fetch failure.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) area/install-update Installer, updater, packaging, wheels, doctor P3 Low — cosmetic, nice to have labels Aug 9, 2026
@alexgunsberg

Copy link
Copy Markdown
Author

Superseded by #83181 which integrates this PR's structured _git_run / check_for_updates_details / ownership + Dashboard facts and the v2 shallow safety contract (no passive lock unlinks, absolute depth target, fail-closed FETCH_HEAD).

Closing as duplicate/superseded so the two patches cannot overwrite each other. Branch/head preserved if anything needs cherry-picking.

@alexgunsberg

Copy link
Copy Markdown
Author

Superseded by #83181 (integrated + shallow safety v2).

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

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants