fix: keep poll read-only for notify_on_complete watcher

This commit is contained in:
Liao Shiwu
2026-04-29 19:34:35 +08:00
committed by Teknium
parent 9078b4bbdf
commit 6f5f58e34b
4 changed files with 54 additions and 7 deletions
+6 -2
View File
@@ -908,7 +908,7 @@ class ProcessRegistry:
# ----- Query Methods -----
def is_completion_consumed(self, session_id: str) -> bool:
"""Check if a completion notification was already consumed via wait/poll/log."""
"""Check if a completion notification was already consumed via wait/log."""
return session_id in self._completion_consumed
def drain_notifications(self) -> "list[tuple[dict, str]]":
@@ -1038,7 +1038,11 @@ class ProcessRegistry:
result["exit_code"] = session.exit_code
result["completion_reason"] = session.completion_reason
result["termination_source"] = session.termination_source
self._completion_consumed.add(session_id)
# NOTE: poll() is a read-only status query and deliberately does
# NOT mark the session _completion_consumed. wait()/read_log()
# represent actual output consumption and do mark it. Marking
# consumed here would let a status check silently suppress the
# notify_on_complete watcher's autonomous delivery turn (#10156).
if session.detached:
result["detached"] = True
result["note"] = "Process recovered after restart -- output history unavailable"