f75f3cd713
The completion event already carries the dispatching session's session_key (captured at dispatch time in delegate_tool.py:2798), but the delivery router ignored it — results landed in whatever session was active at completion time instead of the session that dispatched the subagent. Changes: - drain_notifications() in process_registry.py: optional session_key filter. Non-matching async_delegation events are re-queued instead of consumed, so they remain available for the correct session's drain. - cli.py process_loop: passes active session_key to drain_notifications() - tui_gateway/server.py post-turn drain: passes session_key from the TUI session dict - gateway/run.py _build_process_event_source: logs warning when routing metadata is unresolvable (previously silent drop) - Regression tests verifying session-scoped drain filtering Fixes #58684