hermes-agent/gateway
Teknium 5651a73331 fix(gateway): guard-match the finally-block _active_sessions delete
Before this, _process_message_background's finally did an unconditional
'del self._active_sessions[session_key]' — even if a /stop/ /new
command had already swapped in its own command_guard via
_dispatch_active_session_command and cancelled us.  The old task's
unwind would clobber the newer guard, opening a race for follow-ups.

Replace with _release_session_guard(session_key, guard=interrupt_event)
so the delete only fires when the guard we captured is still the one
installed.  The sibling _session_tasks pop already had equivalent
ownership matching via asyncio.current_task() identity; this closes the
asymmetry.

Adds two direct regressions in test_session_split_brain_11016:
- stale guard reference must not clobber a newer guard by identity
- guard=None default still releases unconditionally (for callers that
  don't have a captured guard to match against)

Refs #11016
2026-04-23 05:15:52 -07:00
..
builtin_hooks
…
platforms fix(gateway): guard-match the finally-block _active_sessions delete 2026-04-23 05:15:52 -07:00
__init__.py
…
channel_directory.py
…
config.py
…
delivery.py
…
display_config.py
…
hooks.py
…
mirror.py
…
pairing.py
…
restart.py
…
run.py fix(gateway): guard session slot ownership after stop/reset 2026-04-23 05:15:52 -07:00
session.py
…
session_context.py
…
status.py fix(status): catch OSError in os.kill(pid, 0) for Windows compatibility 2026-04-23 03:05:49 -07:00
sticker_cache.py
…
stream_consumer.py
…