Kill the mutants of the stuck check, its rung and the /proc readings it hands the investigation

This commit is contained in:
2026-11-19 09:06:26 +01:00
parent 6b8fbc6ff5
commit a12710ebc4
3 changed files with 69 additions and 29 deletions
+18 -1
View File
@@ -32,7 +32,7 @@ from claude_code import entries, reply, session
from failure import Failure
from agent_cycle.verdicts import Finished, Interrupt, Judged, QuotedAnswer, TakenIn, Unfinished
from git_cli.git_repo import git
from agent_cycle import interrupt, judge, lingering_workers, retry, run, spend, states, worker, worker_prompts
from agent_cycle import interrupt, judge, lingering_workers, retry, run, spend, states, stuck_workers, worker, worker_prompts
from claude_code.reply import Limited
import loop_claude.routed_item
from loop_claude.loop import main, reload, routing_check, this_loop, usage
@@ -384,6 +384,23 @@ Worker: {OFF_LADDER}
self.assertEqual(run.run_cycle(cycle).verdict, Finished("working"))
self.assertEqual(fake.worker_environments, [{"LOOP_CLAUDE_PROJECT_RUNG": "claude-opus-5-5 at medium effort", "LOOP_CLAUDE_WORKER_RUNG": "claude-haiku-5-5 at max effort", "LOOP_CLAUDE_ESCAPE_AND_IMPACT": "5", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "200000", "BASH_MAX_OUTPUT_LENGTH": "6000"}])
def test_a_stuck_check_of_the_worker_runs_on_the_projects_rung_and_off_the_ladder_on_the_workers_own(self):
for project, model in ((OPUS_PROJECT, "claude-opus-5-5"), (None, "claude-haiku-5-5")):
with self.subTest(project=project):
clock = [NOW]
quiet = Shell(pid=7, started=NOW, command="bin/run-tests", written=NOW, runs_busy_tool=False)
events = ({"type": "assistant", "message": {"content": []}}, None, None, {"type": "result"})
stream = lambda args: (Worker(self.paths.claude_code_transcripts.parent)(args), Streamed(0, *events, clock=clock, held=[quiet]))[1]
verdict = ran(json.dumps({"type": "result", "structured_output": {"verdict": "stuck", "process": 7, "why": "it waits"}}))
fake = FakeEffects(streams=[stream], claude=[verdict, judged("finished")])
cycle = dataclasses.replace(self.cycle(fake), project=project, route=Route(Rung("claude-haiku-5-5", "max")))
with contextlib.redirect_stdout(io.StringIO()):
run.run_cycle(dataclasses.replace(cycle, effects=dataclasses.replace(cycle.effects, now=lambda: clock[0])))
[investigator, _] = [args for args, _ in fake.made("claude")]
self.assertEqual(investigator[investigator.index("--model") + 1], model)
self.assertEqual(fake.worker_folders, [str(self.home)])
self.assertIn("judged the worker stuck", (self.archive / stuck_workers.RECORD).read_text())
def test_the_claude_an_interrupt_resumes_is_handed_the_same_rungs_as_the_worker(self):
def answer(args):
with open(session.transcript_file(self.session), "a") as handle: