Kill the mutants of the judged shells, the named process's lookup and a tool named as a third word
CI / tests (pull_request) Has been cancelled
CI / tests (pull_request) Has been cancelled
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user