From d06eea314950d29950cabeb9beb2d69bc8fba34b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 10:11:51 +0100 Subject: [PATCH] Kill the mutants of the judged shells, the named process's lookup and a tool named as a third word --- bin/agent_cycle/stuck_workers.py | 6 +++--- bin/loop_effects/test_effects.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/agent_cycle/stuck_workers.py b/bin/agent_cycle/stuck_workers.py index 2b5b7daf..e3f623d8 100644 --- a/bin/agent_cycle/stuck_workers.py +++ b/bin/agent_cycle/stuck_workers.py @@ -43,7 +43,7 @@ PROMPT = f"""A headless Claude Code worker hasn't printed anything for {CHECK_EV @dataclasses.dataclass class Watch: - """What checks a worker for stuck shells: the rung its investigations run on, the project's transcript archive, each shell's CPU seconds at the last check, and each judged shell's CPU seconds when it was judged.""" + """What checks a worker for stuck shells: the rung its investigations run on, the project's transcript archive, each shell's CPU seconds at the last check, and the CPU seconds of each shell that showed a sign at the latest judgment.""" rung: Rung archive: pathlib.Path cpu: dict[int, float] = dataclasses.field(default_factory=dict) @@ -62,7 +62,7 @@ class Watch: if isinstance(judged, Failure): line = f"stuck check: could not judge whether the worker is stuck: {judged.reason}" else: - self.judged |= {shell.pid: shell.cpu for shell in shells if shell.pid in signs} + self.judged = {shell.pid: shell.cpu for shell in shells if shell.pid in signs} line = f"stuck check: a headless claude judged the worker {judged['verdict']}, naming process {judged['process']} ({command_of(judged['process'], shells)}): {judged['why']}" line = " ".join(line.split()) + "".join(f"\n - {' '.join(sign.split())}" for sign in signs.values()) say(line, effects, stdout=not isinstance(judged, Failure)) @@ -96,7 +96,7 @@ def command_of(pid: int, shells: list[Shell]) -> str: if shell.pid == pid: return shell.command for line in shell.processes: - if line.split(" ", 1)[0] == str(pid): + if line.startswith(f"{pid} "): return line.split(" ", 4)[4] or "no command line" return "not in the evidence" diff --git a/bin/loop_effects/test_effects.py b/bin/loop_effects/test_effects.py index ffeaa592..0f58638e 100644 --- a/bin/loop_effects/test_effects.py +++ b/bin/loop_effects/test_effects.py @@ -181,8 +181,10 @@ class ChildShells(unittest.TestCase): # Like the shell of a loop that only names the tool, as the one that held a worker on 2026-11-18 did. naming = self.started("source /dev/null && eval 'until false; do sleep 60; done # chunk-pr merge' < /dev/null && pwd") busy = self.started(f"{tool} merge; true") + # The tool's name as the third word, after a program and a script read from stdin. + third = self.started("python3 - chunk-pr <<< 'import time; time.sleep(60)'; true") self.assertEqual(self.shell_of(naming).command, "until false; do sleep 60; done # chunk-pr merge") - self.assertEqual((self.shell_of(naming).runs_busy_tool, self.shell_of(busy).runs_busy_tool), (False, True)) + self.assertEqual([self.shell_of(each).runs_busy_tool for each in (naming, third, busy)], [False, False, True]) self.assertLess(abs(self.shell_of(naming).started - time.time()), 5) def test_a_shell_below_which_a_process_holds_a_heavy_slot_file_holds_a_slot_and_runs_no_busy_tool(self):