Files
hermes-agent/apps
Teknium 77dd069946 fix(desktop): single-flight session.resume per stored id + adopt-or-reuse on drift-abort
After sleep/wake or a reconnect, many surfaces discover the same dead runtime
at once (submit recovery, slash/rewind recovery, tile resumes, the target
resolver, session switch) and each fired its own session.resume — the gateway
minted a runtime per call and the losers fed the orphan reaper (#91276 storm).

- New use-prompt-actions/single-flight-resume.ts: module-level in-flight map
  keyed by storedSessionId; all resume call sites (utils.ts recovery, submit.ts
  direct rung, resolve-target-session.ts, use-session-actions switch resume,
  use-session-tile-delegate resumeTile) share one in-flight promise per stored
  id. Failed flights are not cached.
- Drift-abort paths no longer abandon a freshly-minted runtime: utils.ts
  SessionRecoveryAborted and submit.ts post-routed-resume / post-resume aborts
  register it in a stored->runtime recovery cache; the next action for that
  stored session adopts it (via onRecovered) or reuses it instead of minting
  another. Cache entries are take-once and skip a known-dead id.
- Unit tests: one RPC for two concurrent callers of the same stored id,
  drift-abort registers (not strands) the recovered runtime, independent
  stored ids resume independently, cached-runtime adoption.

Maintainer commit (cluster salvage, part of the session-not-found-after-
reconnect consolidation).
2026-08-23 17:43:39 -07:00
..