mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
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. |
||
|---|---|---|
| .. | ||
| bootstrap-installer | ||
| desktop | ||
| shared | ||