Add executor tool loop (A12/A15) — step 5b #12

Merged
dev-agent merged 3 commits from executor-loop into main 2026-09-07 20:35:33 +00:00
Showing only changes of commit 999a38a705 - Show all commits
+14 -2
View File
@@ -77,6 +77,18 @@ def test_command_timeout_is_reported(tmp_path: Path) -> None:
assert "timed out" in outcome.result
def _is_running(pid: int) -> bool:
"""os.kill(pid, 0) is not enough: a killed orphan stays a zombie until
something reaps it, and no init does that inside a CI container. Read the
process state instead."""
try:
stat = Path(f"/proc/{pid}/stat").read_text()
except FileNotFoundError:
return False
# State is the first field after the parenthesised comm.
return stat.rsplit(")", 1)[1].split()[0] != "Z"
def test_timeout_kills_the_whole_process_group(tmp_path: Path) -> None:
ws = Workspace(tmp_path / "work", timeout_s=1)
pidfile = ws.root / "child.pid"
@@ -84,8 +96,8 @@ def test_timeout_kills_the_whole_process_group(tmp_path: Path) -> None:
ws.run_command(f"(sleep 30 & echo $! > {pidfile}); sleep 30")
assert pidfile.exists()
pid = int(pidfile.read_text().strip())
with pytest.raises(ProcessLookupError):
os.kill(pid, 0)
assert _is_running(os.getpid()), "liveness check is broken, not the kill"
assert not _is_running(pid)
def test_agent_credentials_are_not_inherited(