fix(tui): drain background process completion notifications - #26084
Closed
Ade5954 wants to merge 1 commit into
Closed
fix(tui): drain background process completion notifications #26084Ade5954 wants to merge 1 commit into
Ade5954 wants to merge 1 commit into
Conversation
…h turn Root cause: the TUI server (tui_gateway/server.py) never drained process_registry.completion_queue, so notify_on_complete events from background processes were silently lost. CLI mode drains the queue in both its idle loop and after-turn paths; gateway mode uses async watcher tasks. Neither path existed for TUI mode. Fix: after run_conversation() returns in _run_prompt_submit, drain completion_queue and auto-submit formatted notifications as follow-up turns. Follows the exact same pattern as the existing goal continuation code — release session.running in the outer finally, then re-acquire and call _run_prompt_submit with the synthetic notification text. Uses _format_process_notification from cli (already imported elsewhere in the TUI server via the same lazy-import pattern). Closes NousResearch#26071
Collaborator
|
Superseded by #26327 (merged). Thanks for the initial approach — the merged PR builds on it with an autonomous poller thread in addition to the after-turn drain. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause: the TUI server (tui_gateway/server.py) never drained process_registry.completion_queue, so notify_on_complete events from background processes were silently lost. CLI mode drains the queue in both its idle loop and after-turn paths; gateway mode uses async watcher tasks. Neither path existed for TUI mode.
Fix: after run_conversation() returns in _run_prompt_submit, drain completion_queue and auto-submit formatted notifications as follow-up turns. Follows the exact same pattern as the existing goal continuation code — release session.running in the outer finally, then re-acquire and call _run_prompt_submit with the synthetic notification text.
Uses _format_process_notification from cli (already imported elsewhere in the TUI server via the same lazy-import pattern).
Why Option 1 (After-turn drain)?
Three approaches were proposed in the issue. Option 1 was chosen because:
Option 2 (polling thread) was rejected as over-engineering. Option 3 (shared helper) was unnecessary since _format_process_notification from cli.py is already importable directly.
How the Fix Works
After run_conversation() returns in _run_prompt_submit :
Related Issue
Closes #26071
Type of Change
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass