Skip to content

fix: remove _completion_consumed marking from poll() to prevent watcher suppression - #10190

Closed
nightq wants to merge 1 commit into
NousResearch:mainfrom
nightq:fix/issue-10156-poll-consumed-regression
Closed

fix: remove _completion_consumed marking from poll() to prevent watcher suppression#10190
nightq wants to merge 1 commit into
NousResearch:mainfrom
nightq:fix/issue-10156-poll-consumed-regression

Conversation

@nightq

@nightq nightq commented Apr 15, 2026

Copy link
Copy Markdown

Summary

Fixes a regression where notify_on_complete notifications were silently suppressed when the agent called process(action='poll') on an exited background process.

Root Cause

PR #8228 added _completion_consumed tracking to suppress duplicate notifications. However, it incorrectly extended the same semantics to poll() — a read-only status query. When poll() saw an exited process, it marked the session as consumed, causing the gateway's _run_process_watcher to skip the notification entirely (with a permanent break, no retry).

Fix

Removed _completion_consumed.add(session_id) from poll(). Only wait() and log() mark consumed, since they represent actual consumption of output. Updated the corresponding test to match new behavior.

Test Plan

  • All 21 notify_on_complete tests pass
  • All 212 process-related tests pass

Closes #10156

…er suppression

Fixes NousResearch#10156

Root cause: poll() marked sessions as completion-consumed when exited,
but poll() is a read-only status query. This caused the gateway's
_run_process_watcher to skip notifications because it checked
is_completion_consumed() before delivering. A race between user messages
triggering poll() and the watcher's 5s cycle permanently lost notifications.
Fix: Remove _completion_consumed.add() from poll(). Only wait() and log()
mark consumed, since they represent actual consumption of output.
Also updated test to match new behavior.
@nightq

nightq commented Apr 17, 2026

Copy link
Copy Markdown
Author

Closing stale PR from previous run. Will recreate if the fix is still needed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: poll() marking _completion_consumed silently suppresses watcher notification

1 participant