Files
hermes-agent/tui_gateway
kshitijk4poor 251e5f7c0a refactor(tui_gateway): one lease-metadata constructor, takeover selector/effector split, mark clears on re-own
From the pre-merge review pass on the takeover:

- `_lease_metadata(live_session_id)` replaces three hand-typed copies of the
  writer-identity dict (claim, compression re-anchor, takeover) — the two keys
  are cross-module contracts (_is_same_writer, Bot Chat live delivery).
- `_detached_lease_holder` (pure selector) + a linear effector replace the
  search-and-mutate for/else; `lease.released` read bare (every lease on this
  path is an ActiveSessionLease); the interrupt failure is logged, not swallowed.
- `_lease_taken_over` is no longer sticky: `_attach_lease` clears it whenever a
  record gains a lease, so a runtime that later re-owns its chat finalizes like
  any owner (test extended; red when the clear is removed).
- Tests use the SESSION_NOT_OWNED constant.

Verified non-findings kept as-is: registry I/O stays under both session locks
(ms-scale, refusal-only, and moving it out reopens a registry/memory mismatch
window); `session.reclaimed` for the old runtime still broadcasts (Desktop keys
on the runtime `session_id`, not `stored_session_id`).
2026-09-17 15:46:28 +05:30
..
…
…