The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(process_registry): trim handle-release tests to invariants, fix prune fixture
teknium1dcf17633de4b
diff --git a/tests/tools/test_accretion_caps.py b/tests/tools/test_accretion_caps.pyindex f82a6d30966..c89f033ec3a 100644--- a/tests/tools/test_accretion_caps.py+++ b/tests/tools/test_accretion_caps.py@@ -84,6 +84,8 @@ class TestCompletionConsumedPrune:self.id = sidself.started_at = time.time() - (FINISHED_TTL_SECONDS + 100)self.exited = True+ self.process = None # handle release reads the real dataclass fields+ self._pty = Nonereg._finished["stale-1"] = _FakeSess("stale-1")reg._completion_consumed.add("stale-1")diff --git a/tests/tools/test_process_registry.py b/tests/tools/test_process_registry.pyindex da3a12f8daf..55634ed0d43 100644--- a/tests/tools/test_process_registry.py+++ b/tests/tools/test_process_registry.py@@ -756,14 +756,6 @@ class TestFinishedHandleRelease:registry._move_to_finished(session)assert pty_closed["closed"]- def test_move_to_finished_safe_without_handles(self, registry):- """Env-backed / detached sessions have no local Popen or PTY; the- release must be a no-op, not a crash."""- session = _make_session(sid="proc_no_handles", exited=True)- registry._finished[session.id] = session- registry._move_to_finished(session) # must not raise- assert session.id in registry._finished-def test_poll_still_serves_output_after_handle_release(self, registry):"""Output remains queryable after the pipes close — poll() reads thebuffered output, never the (now-closed) pipe."""@@ -820,29 +812,6 @@ class TestFinishedHandleRelease:assert session.id not in registry._finishedassert pty_closed["closed"], "pruned session must release its PTY handle"- def test_release_does_not_touch_running_sessions(self, registry):- """A still-running session's handles must remain open: _move_to_finished- is only ever invoked with exited sessions, and prune only walks- _finished — a live session in _running keeps its pipe."""- proc = subprocess.Popen(- [sys.executable, "-c", "import time; time.sleep(5)"],- stdout=subprocess.PIPE,- stderr=subprocess.STDOUT,- stdin=subprocess.DEVNULL,- )- try:- session = _make_session(sid="proc_still_running", exited=False)- session.process = proc- registry._running[session.id] = session-- with registry._lock:- registry._prune_if_needed()-- assert session.id in registry._running- assert proc.stdout is not None and not proc.stdout.closed- finally:- proc.kill()- proc.wait(timeout=5)# =========================================================================