Files
hermes-agent/apps/desktop/src/api
Austin Pickett 96c64b4526 fix(desktop): key Webhooks state and REST to the active backend profile
The Webhooks view keyed React Query by the profile scope but kept every
profile-owned local state (create draft, create dialog, one-time created
secret, pending delete, restart/error banners) in plain component useState,
and its REST calls resolved the mutable global profile at execution time.
Switching the active backend profile with the page open leaked the old
profile's draft dialog into the new profile, and a delayed create
completion could surface the old profile's one-time webhook secret under
the new profile view (#71352).

Bind the whole operation to one captured backend owner:

- Split WebhooksView into a thin wrapper that keys a ProfileOwnedWebhooksView
  by the normalized active gateway profile: a profile switch unmounts the old
  operation scope synchronously, so drafts, dialogs, secrets and pending
  state disappear at the same boundary as their owner (AGENTS.md: a profile
  swap is a re-home; the previous context must not leak into the next).
- Route all Webhooks REST calls (get/enable/create/delete/toggle), the
  gateway restart request and its status polls through an explicit profile
  argument captured at mount, instead of ambient mutable profile
  resolution. Optional arguments keep the ambient scope for callers
  without an owner.
- Guard every async completion with a StrictMode-safe ownerActive ref
  (set in effect setup, cleared in cleanup) so a stale profile's create/
  toggle/delete/restart completion cannot notify or repaint the new
  profile view.
2026-10-06 16:59:52 -04:00
..