hermes-agent/tests/tui_gateway
konsisumer 02050859f3 fix(tui): preserve live session identity across compression (#49041)
When a session rotates id on compression, _sync_session_key_after_compress()
re-anchored the session_key, approval-notify routing, yolo state, and slash
worker — but never moved the active-session lease, which stayed keyed to the
pre-compression id. And _find_live_session_by_key() matched live sessions on
the stale session_key, not the live agent's current agent.session_id. After
compression a resume/create path failed to recognize the existing live agent
and could build a SECOND live agent against the same DB continuation -> forked
lineage / cross-session message mixing.

- active_sessions.transfer_active_session(): move a lease in place to the new
  id under the exclusive file lock (no slot drop).
- gateway _transfer_active_session_slot(): call it inside
  _sync_session_key_after_compress(); on the rare fallback (entry pruned)
  RESERVE the new slot before releasing the old lease (reserve-before-release),
  so a concurrent gateway at the session cap cannot grab the freed slot in a
  release-then-reacquire window and leave this session with no lease; if the
  reserve fails, keep the existing lease (review fix).
- _session_lookup_key(): make live-session lookup authoritative on
  agent.session_id, wired into all stale-session_key consumers
  (_find_live_session_by_key, _session_live_item, _live_session_payload) —
  fixes the whole lookup class.

Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com>
2026-06-24 00:54:18 +05:30
..
__init__.py
test_billing_rpc.py feat(billing): /billing terminal billing — interactive TUI + CLI client (#45449) 2026-06-19 01:53:32 +05:30
test_compaction_status.py fix(desktop): show summarizing indicator during auto-compaction 2026-06-14 02:28:07 -05:00
test_custom_provider_session_persistence.py fix(desktop): never persist or restore a named custom provider as bare "custom" (#48547) 2026-06-18 11:11:51 -07:00
test_entry_sys_path.py chore: prune unused imports and duplicate import redefinitions 2026-05-28 22:26:25 -07:00
test_finalize_session_persist.py fix(tui): persist session messages on force-quit / signal shutdown 2026-06-21 07:26:07 -07:00
test_goal_command.py fix(tui): route pending-input commands via command.dispatch (#48848) 2026-06-19 14:53:33 +05:30
test_make_agent_provider.py fix(model): persist /model switch by default across sessions 2026-06-19 07:07:06 -07:00
test_protocol.py fix(tui): preserve live session identity across compression (#49041) 2026-06-24 00:54:18 +05:30
test_render.py
test_review_summary_callback.py fix(desktop,tui): surface self-improvement review summary + honor memory_notifications 2026-06-18 13:22:12 -05:00
test_subagent_child_mirror.py feat(desktop): stream subagent activity into watch windows (#47060) 2026-06-16 14:30:11 -04:00
test_undo_command.py feat(undo): /undo [N] backs up N user turns with prefill + soft-delete 2026-06-01 01:22:38 -07:00
test_wait_for_mcp_discovery.py perf(tui): stop slow/dead MCP servers from freezing TUI startup 2026-05-30 02:53:37 -07:00