hermes-agent/apps
Ben 7e06e61fc8 fix(desktop): Hermes Cloud sign-in uses Privy session + multi-org org picker
Two fixes surfaced by the first live end-to-end test of cloud sign-in (both
would have shipped broken — green units + code review did not catch them).

1. Portal session is PRIVY, not Hermes-gateway cookies (Q7). Phase 3 polled for
   hermes_session_at/rt on the portal host, but the Nous portal (NAS) is a
   Privy-authed Next.js app — it sets privy-token (which NAS auth() and the
   /api/agents cookie path both read). The sign-in window therefore never
   detected success and hung. Fix: cookiesHavePrivySession (privy-token + __Host/
   __Secure/legacy privy-session variants) in connection-config.cjs, and
   hasLivePortalSession now checks the Privy cookie on the portal host. The
   per-agent silent cascade still uses the gateway-cookie check (each agent IS a
   Hermes gateway).

2. Multi-org discovery needs an org picker (Q8). A portal session carries no org
   pin, so a user in >1 org got a dead-end 403. Paired with NAS #545 (merged):
   /api/agents now returns 409 org_selection_required + the user's org list, and
   accepts a membership-validated ?org=. discoverCloudAgents(org) appends ?org=,
   and on 409 returns { needsOrgSelection, orgs } instead of throwing; the cloud
   panel shows a 'Choose an organization' picker, then re-runs discovery scoped
   to the chosen org (with a 'Change org' affordance for multi-org users).

Also reverts the ERR_NETWORK_CHANGED retry helper from the prior commit: the
IPv6-churn aborts on Ben's Arch host are a host/network-layer issue, and a
client reload can't safely drive Privy's single-use-code redirect chain
(disable IPv6 for the session is the workaround). Kept out of this feature PR.

Tests: connection-config.test.cjs (57, +5 Privy-cookie cases, proven to fail
without the helper); boot-failure-reauth (16). tsc + eslint clean. Verified live
end-to-end against prod portal: sign-in → org picker → scoped agent list →
silent per-agent connect.

cloud-auto-discovery Phases 3+4 follow-up (decisions.md Q7, Q8).
2026-07-01 09:44:23 +10:00
..
bootstrap-installer fix(desktop/windows): stop in-app update from cascading into a backend restart loop (#50381) 2026-06-21 13:10:32 -07:00
desktop fix(desktop): Hermes Cloud sign-in uses Privy session + multi-org org picker 2026-07-01 09:44:23 +10:00
shared style(shared): apply workspace formatter to websocket helpers 2026-06-28 21:30:43 -05:00