Skip to content

fix(tui): route completion notifications to owner live session - #35667

Closed
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:codex/fix-tui-notification-routing
Closed

fix(tui): route completion notifications to owner live session#35667
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:codex/fix-tui-notification-routing

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

  • route TUI background-process completion notifications to the live session that owns the process instead of whichever per-session poller drained the global queue first
  • factor the poller delivery path so both the steady-state loop and shutdown drain use the same owner-aware routing logic
  • add a regression test covering two concurrent live TUI sessions where session B's poller drains session A's completion event

Closes #35652.

Why

_notification_poller_loop() already documents that completion_queue is global, but it always emitted the notification and synthetic turn back to the current poller sid. In a multi-live-session TUI, that let session B render and ingest session A's [IMPORTANT: Background process ... completed] message.

This change keeps the existing queue model but resolves the event back to the owning live session via the tracked process session_key, then injects the notification into that owner session.

Scope

Validation

  • python -m pytest tests/test_tui_gateway_server.py -k 'notification_poller' -o 'addopts=' -q
  • python -m ruff check tui_gateway/server.py tests/test_tui_gateway_server.py
  • git diff --check

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) tool/terminal Terminal execution and process management labels May 31, 2026
@teknium1

teknium1 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Closing — superseded. Main has since gained _notification_event_belongs_elsewhere (per-session ownership filtering on the shared completion queue), and PR #60863 completed the design with an origin-session return address stamped at dispatch, compression-chain-aware ownership, and fail-closed handling for unowned payloads. Your owner-directed routing idea was the right instinct — the landed design achieves the same guarantee through positive-proof ownership at the consumer. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: background process completion notifications can route to the wrong live session

3 participants