Judge a worker that stalls before its result with a headless claude, and report the verdict without a kill
CI / tests (pull_request) Failing after 4m3s

This commit is contained in:
2026-11-19 08:55:14 +01:00
parent a559bbfcbf
commit 08038d93eb
10 changed files with 327 additions and 20 deletions
+16
View File
@@ -189,6 +189,22 @@ class ChildShells(unittest.TestCase):
self.assertEqual(self.shell_of(to_file).written, 1000)
self.assertEqual(self.shell_of(to_pipe).written, self.shell_of(to_pipe).started)
def test_reads_the_end_of_a_shells_output_file_and_nothing_from_a_pipe(self):
with tempfile.NamedTemporaryFile() as output:
output.write(b"x" * child_shells.OUTPUT_BYTES + b"last line\n")
output.flush()
to_file = self.started("sleep 60; true", stdout=output)
to_pipe = self.started("sleep 60; true", stdout=subprocess.PIPE)
self.assertEqual(self.shell_of(to_file).output, "x" * (child_shells.OUTPUT_BYTES - 10) + "last line\n")
self.assertEqual(self.shell_of(to_pipe).output, "")
def test_reads_each_process_below_a_shell_and_the_cpu_the_whole_tree_used(self):
busy = self.started("timeout 5 sh -c 'while :; do :; done'; true")
wait_until(lambda: self.shell_of(busy).cpu > 0.1)
processes = self.shell_of(busy).processes
self.assertEqual([line.split(" ", 4)[4] for line in processes], ["timeout 5 sh -c while :; do :; done", "sh -c while :; do :; done"])
self.assertEqual(processes[1].split(" ")[1], "R")
def test_stops_a_shell_and_the_process_it_started_and_no_other(self):
shell = self.started("sleep 60; true")
other = subprocess.Popen(["sleep", "60"])