Files
hermes-agent/gateway
kshitijk4poor 436ec48985 fix(gateway): generation-guarded slot release on /stop; displaced lease tokens swept
- _drop_turn_slot takes the post-bump run_generation from _interrupt_running_turn
  and forwards it to _release_running_agent_state: _interrupt_and_clear_session
  awaits adapter.interrupt_session_activity between bump and release, so a
  successor claiming the slot in that window must not have its sentinel/lease
  wiped by the displaced /stop tail (sync eviction path forwards too, for the
  same guard).
- _drop_turn_slot then sweeps lease_tokens from generations older than current:
  a hung evicted turn's finalizer may never run, and each such generation pinned
  its token (and _SessionLease) forever. Identity-checked + idempotent release,
  so a live successor's token is untouched.
- _claim_one_turn_restore folds the two spellings of the one-shot "earliest
  snapshot wins" rule (/moa direct write, /model --once setdefault) into one
  helper; /model --once passes its pre-switch snapshot so the earliest-wins
  contract is expressed once.
2026-09-12 12:24:24 +05:30
..