hermes-agent/apps/desktop/electron
Ben 09f96b5f56
fix(desktop): reliably persist cloud org, unselect cloud on mode switch, keep Change-org button after restore
Three fixes from live testing the org persist/restore flow:

1. Org not persisting (stale closure). discoverCloud() resolves the org
   asynchronously from the NAS response and setCloudOrg() is a React state
   update, but connectCloudAgent read the cloudOrg value captured in its render
   closure — often still null when the user clicked Connect in the same tick, so
   no org was saved. Mirror the org into a ref (cloudOrgRef) updated
   synchronously alongside state; connect reads cloudOrgRef.current.

2. Cloud connection lingered after switching away. coerceDesktopConnectionConfig
   inherits existingBlock.url across mode switches (correct for remote↔local),
   so switching cloud→local/remote kept the cloud instance URL in the remote
   block — re-selecting Cloud then looked 'already connected' with no way to
   re-pick. Added a leavingCloud rule: when the saved block was cloud and the new
   mode isn't cloud, start from an empty block (drop the cloud url/org/token),
   cleanly unselecting the cloud gateway. remote↔local toggles still preserve a
   real remote URL.

3. Change-org button vanished after restore-open. It was gated on
   cloudOrgs.length > 1, but the restore path discovers straight into the saved
   org and never populates cloudOrgs. Gate on cloudOrg being set instead, via a
   new changeCloudOrg() that clears the org + agent list and re-discovers with no
   org arg (multi-org → NAS 409 picker; single-org → auto-resolve back).

Depends on NAS #550 (echo resolved org), merged + live on prod (0dc86d0b).

tsc + eslint clean; 57 node --test + 16 vitest pass; all three verified live on
Ben's host (org persists + restores, cloud unselects on switch, Change-org shows
after reopen). The benign 'Session not found' 404 on backend switch is left as-is
(already handled by isSessionGoneError → fresh draft; dev-log noise only).

cloud-auto-discovery Phase 3/4 follow-up.
2026-07-07 05:30:48 -07:00
..
backend-command.cjs refactor(desktop): adopt shared utils + app-wide cleanups 2026-07-03 13:48:44 -05:00
backend-command.test.cjs refactor(desktop): adopt shared utils + app-wide cleanups 2026-07-03 13:48:44 -05:00
backend-env.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
backend-env.test.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
backend-probes.cjs fix(desktop): probe venv python in unwrapWindowsVenvHermesCommand so Repair can escape a broken venv (#59204) 2026-07-05 19:13:33 -07:00
backend-probes.test.cjs fix(desktop): probe venv python in unwrapWindowsVenvHermesCommand so Repair can escape a broken venv (#59204) 2026-07-05 19:13:33 -07:00
backend-ready.cjs feat(cli): make hermes serve a real headless backend 2026-06-30 17:58:52 -05:00
backend-ready.test.cjs feat(cli): make hermes serve a real headless backend 2026-06-30 17:58:52 -05:00
bootstrap-platform.cjs chore(desktop): zero eslint/typecheck debt + prettier pass (#39100) 2026-06-04 14:10:38 +00:00
bootstrap-platform.test.cjs chore(desktop): zero eslint/typecheck debt + prettier pass (#39100) 2026-06-04 14:10:38 +00:00
bootstrap-runner.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
bootstrap-runner.test.cjs fix(desktop): bootstrap falls back to installed agent install.sh on GitHub 404 2026-06-07 03:46:12 -07:00
connection-config.cjs fix(desktop): Hermes Cloud sign-in uses Privy session + multi-org org picker 2026-07-07 05:30:47 -07:00
connection-config.test.cjs fix(desktop): Hermes Cloud sign-in uses Privy session + multi-org org picker 2026-07-07 05:30:47 -07:00
dashboard-token.cjs refactor(desktop): use native fetch in dashboard-token 2026-06-11 18:41:16 -05:00
dashboard-token.test.cjs refactor(desktop): fold served-token adoption + foreign-backend refusal into one helper 2026-06-11 18:33:05 -05:00
desktop-uninstall.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
desktop-uninstall.test.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
embed-referer.cjs feat(desktop): lazy embed renderers + fenced diagrams/alerts 2026-06-26 03:22:08 -05:00
entitlements.mac.inherit.plist fix(desktop): inherit microphone entitlement for macOS helpers 2026-06-03 07:32:00 +07:00
entitlements.mac.plist Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
fs-read-dir.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
fs-read-dir.test.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
gateway-ws-probe.cjs test(desktop): add injectable gateway WebSocket probe + unit tests 2026-06-04 19:49:06 -07:00
gateway-ws-probe.test.cjs test(desktop): add injectable gateway WebSocket probe + unit tests 2026-06-04 19:49:06 -07:00
git-repo-scan.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
git-review-ops.cjs fix(desktop): stop hermes desktop from clobbering tracked main.cjs (#52735) 2026-06-28 01:30:09 -04:00
git-review-ops.test.cjs feat(desktop): add git worktree and review IPC 2026-06-25 16:40:27 -05:00
git-root.cjs fix(desktop): Harden local file tree paths (#43618) 2026-06-11 10:05:59 -04:00
git-root.test.cjs fix(desktop): Harden local file tree paths (#43618) 2026-06-11 10:05:59 -04:00
git-worktree-ops.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
git-worktree-ops.test.cjs fix(desktop): clarify branch convert actions 2026-06-25 17:19:36 -05:00
hardening.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
hardening.test.cjs feat(desktop): composer status stack, live subagent windows, editable prompts (#44630) 2026-06-12 08:30:06 -05:00
link-title-window.cjs fix(desktop): guard link-title readTitle against destroyed windows 2026-07-03 05:13:23 -05:00
link-title-window.test.cjs Merge remote-tracking branch 'origin/main' into bb/skills-renovate 2026-07-03 13:59:26 -05:00
main.cjs fix(desktop): reliably persist cloud org, unselect cloud on mode switch, keep Change-org button after restore 2026-07-07 05:30:48 -07:00
oauth-net-request.cjs fix(desktop): avoid restricted oauth request header 2026-06-05 18:04:45 -07:00
oauth-net-request.test.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
oauth-session-request.test.cjs test(desktop): regression-guard fetchJsonViaOauthSession headers (#40069) 2026-07-06 11:12:15 -07:00
preload.cjs feat(desktop): gate the Hermes Cloud gateway selector behind a BETA env flag 2026-07-07 05:30:47 -07:00
profile-delete-respawn.test.cjs refactor(desktop): adopt shared utils + app-wide cleanups 2026-07-03 13:48:44 -05:00
session-windows.cjs fix(desktop): keep streaming painting in unfocused secondary chat windows (#47919) 2026-06-17 14:40:13 -04:00
session-windows.test.cjs fix(desktop): keep streaming painting in unfocused secondary chat windows (#47919) 2026-06-17 14:40:13 -04:00
titlebar-overlay-width.cjs refactor(desktop): adopt shared utils + app-wide cleanups 2026-07-03 13:48:44 -05:00
titlebar-overlay-width.test.cjs fix(desktop): stop macOS Tahoe misplacing the traffic lights 2026-07-02 21:14:28 -05:00
update-count.cjs fix(desktop): skip the rev-list count when it is discarded anyway 2026-06-24 19:12:09 -05:00
update-count.test.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
update-marker.cjs fix(desktop): normalize CRLF back to LF in update-marker files 2026-07-05 21:36:23 -07:00
update-marker.test.cjs fix(desktop): normalize CRLF back to LF in update-marker files 2026-07-05 21:36:23 -07:00
update-rebuild.cjs fix(desktop): retry the self-update rebuild once so the app relaunches (#48122) 2026-06-17 19:33:27 -05:00
update-rebuild.test.cjs fix(desktop): retry the self-update rebuild once so the app relaunches (#48122) 2026-06-17 19:33:27 -05:00
update-relaunch.cjs fix(desktop): relaunch on Linux after in-app update instead of hanging (#45205) 2026-06-21 17:04:52 -07:00
update-relaunch.test.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
update-remote.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
update-remote.test.cjs test(desktop): cover official-SSH remote detection for passive updates 2026-06-11 12:53:19 +05:30
vscode-marketplace.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
vscode-marketplace.test.cjs feat(desktop): install any VS Code theme from the Marketplace 2026-06-09 23:06:44 -05:00
window-state.cjs feat(desktop): remember window size/position/maximized across launches (salvage #39154) 2026-06-24 13:32:05 -05:00
window-state.test.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
windows-child-process.test.cjs fix(desktop): tree-kill Windows terminal descendants 2026-06-30 04:23:27 -05:00
windows-hermes-resolution.test.cjs fix(desktop): probe venv python in unwrapWindowsVenvHermesCommand so Repair can escape a broken venv (#59204) 2026-07-05 19:13:33 -07:00
windows-user-env.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
windows-user-env.test.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
workspace-cwd.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
workspace-cwd.test.cjs style(desktop,tui): fix all lint/type/formatting issues 2026-06-26 01:04:33 -05:00
wsl-clipboard-image.cjs fix(desktop): WSL2 clipboard image paste + Linux titlebar overlay 2026-06-25 23:50:59 -05:00
wsl-clipboard-image.test.cjs fix(desktop): WSL2 clipboard image paste + Linux titlebar overlay 2026-06-25 23:50:59 -05:00