Skip to content

The agent that grows with you

fix(process_registry): match oneshot completion linger by owner, not container key

kshitijk4poor9fea861eeb7c
diff --git a/tests/tools/test_oneshot_completion_linger.py b/tests/tools/test_oneshot_completion_linger.py
index c2fef954745..ebf0813fb58 100644
--- a/tests/tools/test_oneshot_completion_linger.py
+++ b/tests/tools/test_oneshot_completion_linger.py
@@ -148,8 +148,12 @@ def test_timeout_zero_disables_linger(registry):
def test_task_id_filter_scopes_the_wait(registry):
- mine = _make_session(sid="proc_mine", task_id="task_a")
- other = _make_session(sid="proc_other", task_id="task_b")
+ # The terminal tool stores the container key in task_id and the spawning turn in
+ # owner_task_id; the filter must match ownership, not the shared container key.
+ mine = _make_session(sid="proc_mine", task_id="session:shared")
+ mine.owner_task_id = "task_a"
+ other = _make_session(sid="proc_other", task_id="session:shared")
+ other.owner_task_id = "task_b"
with registry._lock:
registry._running[mine.id] = mine
registry._running[other.id] = other
diff --git a/tools/process_registry.py b/tools/process_registry.py
index 7774914c6b4..54f63decc00 100644
--- a/tools/process_registry.py
+++ b/tools/process_registry.py
@@ -1702,7 +1702,8 @@ class ProcessRegistry(ProcessCheckpointMixin):
# window would otherwise see nothing pending, drain nothing and exit without the follow-up turn.
pending = [
s for store in (self._running, self._finished) for s in store.values()
- if s.notify_on_complete and not s._completion_event.is_set() and (task_id is None or s.task_id == task_id)
+ if s.notify_on_complete and not s._completion_event.is_set()
+ and (task_id is None or (s.owner_task_id or s.task_id) == task_id)
]
if not pending or timeout <= 0:
return result