Skip to content

fix(desktop): harden update handoff home resolution - #61093

Closed
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/desktop-update-handoff-home
Closed

fix(desktop): harden update handoff home resolution#61093
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/desktop-update-handoff-home

Conversation

@konsisumer

Copy link
Copy Markdown
Contributor

Desktop update handoff now resolves the staged updater, update marker, and updater environment from the same Hermes home, including base-home fallback when the desktop was launched from a profile-scoped home.

Shared root cause

  • The desktop handoff path assumed one active HERMES_HOME for every update artifact. When the app was launched with a profile-scoped or inherited home, resolveUpdaterBinary() could miss the staged hermes-setup(.exe), marker parking could be read from a different home than the updater wrote, and recovery handoffs could run against the wrong managed checkout.
  • The fix adds a small Hermes-home candidate ladder for Electron update handoff: active home first, then the base home for <root>/profiles/<name> layouts. The staged updater is resolved from that ladder, the updater process receives the home that contains it, PATH is built from that same home, and pre-written update markers cover every home a relaunched desktop may inspect.

How this fixes each issue

How to test

  • node --check apps/desktop/electron/main.cjs
  • node --test apps/desktop/electron/windows-hermes-resolution.test.cjs apps/desktop/electron/update-marker.test.cjs
  • /opt/homebrew/bin/timeout -k 30 480 node --test apps/desktop/electron/windows-hermes-resolution.test.cjs apps/desktop/electron/update-marker.test.cjs apps/desktop/electron/windows-child-process.test.cjs
  • git diff --check
  • python scripts/check-windows-footguns.py apps/desktop/electron/main.cjs apps/desktop/electron/windows-hermes-resolution.test.cjs
  • Required broad suite attempted: /opt/homebrew/bin/timeout -k 30 480 sh -c 'pytest tests/ -q -x --timeout=60 "$@"' sh; it aborted during collection because the local Python environment lacks fastapi/uvicorn and pip lazy-install is blocked by PEP 668/external management before these changed Electron tests could run.
  • ESLint could not be run locally because no node_modules/.bin/eslint exists in this checkout.

What platforms tested on

  • macOS on darwin-arm64 (local)

This coordinated PR bundles a fix that spans several issues. Happy to split it back into focused per-issue PRs if you'd prefer to review them separately.

Refs #46076
Refs #46755
Refs #46782

@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows P3 Low — cosmetic, nice to have labels Jul 8, 2026
@konsisumer

Copy link
Copy Markdown
Contributor Author

Rebased onto current origin/main and resolved the desktop update-handoff conflict on the renamed Electron TypeScript files (main.ts and windows-hermes-resolution.test.ts, the rebased equivalents of this PR's original files). python scripts/check-windows-footguns.py apps/desktop/electron/main.ts apps/desktop/electron/windows-hermes-resolution.test.ts and git diff --check passed; broader desktop TypeScript verification and the bounded pytest tests/ -q -x --timeout=60 run were blocked locally because this checkout lacks the JS toolchain (tsc/node_modules) and Python web deps (fastapi/uvicorn).

@konsisumer
konsisumer force-pushed the fix/desktop-update-handoff-home branch from 2134b0d to 6fa91f5 Compare July 9, 2026 06:33
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for tracing the profile-scoped updater handoff. Current main still looks up the updater only at apps/desktop/electron/main.ts:2271-2275, while its two handoff paths also pin cwd, child HERMES_HOME, PATH, and markers to that active home (apps/desktop/electron/main.ts:2585-2607, 2663-2681). The proposed candidate ladder addresses that mismatch.

Problems

Suggested changes

  • Add behavioral coverage for profile/base candidate ordering, non-profile homes, handoff env/cwd/PATH, and both marker locations.
  • Narrow the issue references or split the unrelated recovery/relaunch work into focused follow-ups.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 10, 2026
@konsisumer
konsisumer force-pushed the fix/desktop-update-handoff-home branch from 6fa91f5 to f3d07ee Compare July 10, 2026 21:28
@konsisumer

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Addressed in this push:

Validated with node --test apps/desktop/electron/windows-hermes-resolution.test.ts, git diff --check, and the bounded pytest command. Desktop typecheck could not run because this checkout has no tsc installed.

@konsisumer

Copy link
Copy Markdown
Contributor Author

Rebased onto current origin/main and corrected the updater-handoff spawn options typing that blocked the desktop TypeScript check. The profile/base-home handoff regression test, bounded pytest tests/ -q -x --timeout=60 run, Windows footgun check, and git diff --check passed locally. The desktop typecheck itself could not be rerun because the local dependency tree has no tsc and npm ci is blocked by an existing non-empty node_modules directory.

@konsisumer
konsisumer force-pushed the fix/desktop-update-handoff-home branch 2 times, most recently from 816f61d to 0da92cc Compare July 12, 2026 17:27
@konsisumer

Copy link
Copy Markdown
Contributor Author

Rebased onto current origin/main and resolved the in-scope Electron import conflict while preserving the updater-handoff implementation and upstream's execFile import. The behavioral updater-handoff regression test, bounded pytest tests/ -q -x --timeout=60 run, Windows-footgun check, and git diff --check passed locally. Desktop typecheck could not be rerun locally because tsc is not installed.

@konsisumer

Copy link
Copy Markdown
Contributor Author

Rebased onto current origin/main and resolved the in-scope Electron conflict. The updater handoff now remains profile/base-home consistent in main.ts; upstream's obsolete source-text test deletion was preserved. git diff --check and the Windows-footgun check pass. Desktop TypeScript/Vitest dependencies and Python FastAPI/Uvicorn are unavailable locally, so the desktop typecheck and full pytest collection could not run.

@konsisumer
konsisumer force-pushed the fix/desktop-update-handoff-home branch 2 times, most recently from f4f4ecc to b514ac5 Compare July 17, 2026 10:13
@konsisumer

Copy link
Copy Markdown
Contributor Author

Rebased onto current origin/main and resolved the in-scope updater-handoff conflict in apps/desktop/electron/main.ts. The profile/base-home candidate selection now uses upstream's shared detached-updater helper for both handoff paths. git diff --check and the bounded pytest command completed cleanly; the Windows-footgun checker completed cleanly but scans Python only, so this TypeScript-only diff produced no scanned files. Desktop typecheck could not run because this checkout has no tsc installed.

@teknium1 teknium1 added the area/install-update Installer, updater, packaging, wheels, doctor label Jul 19, 2026
@konsisumer
konsisumer force-pushed the fix/desktop-update-handoff-home branch from b514ac5 to c325ee5 Compare July 25, 2026 07:12
@konsisumer

Copy link
Copy Markdown
Contributor Author

Rebased onto current origin/main and resolved the sole in-scope conflict in apps/desktop/electron/main.ts. The resolution retains upstream's state-db preflight while preserving the PR's selected-home updater handoff context. git diff --check and the Windows-footgun checker pass (the latter scans Python, so this TypeScript-only diff has no scanned files). Desktop typecheck and Vitest could not run because this checkout lacks tsc and vitest; the bounded Python suite could not collect because fastapi/uvicorn are missing and the environment blocks their lazy install under PEP 668.

@konsisumer

Copy link
Copy Markdown
Contributor Author

Rebased onto current origin/main and resolved the updater-handoff conflict in apps/desktop/electron/main.ts. The shared update gate now checks markers across the existing active-profile/base-home candidate ladder, preserving the PR's handoff behavior alongside upstream's gate refactor. node --experimental-strip-types --check apps/desktop/electron/main.ts, python scripts/check-windows-footguns.py apps/desktop/electron/main.ts, and git diff --check pass. Desktop typecheck/lint could not run because this checkout lacks node_modules (tsc/eslint); the configured Python suite cannot collect because fastapi is unavailable.

@konsisumer
konsisumer force-pushed the fix/desktop-update-handoff-home branch from c325ee5 to abbe424 Compare July 29, 2026 12:20
@konsisumer

Copy link
Copy Markdown
Contributor Author

Closing — on reflection, This coordinated PR bundles a fix that spans several issues. overstates the one-file diff's scope. If this still seems valuable, please reopen with feedback on what to change.

@konsisumer konsisumer closed this Jul 29, 2026
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/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants