Answer the audit: Limited in its own module, the retry time's zone injected, file items 37 and 38

This commit is contained in:
2026-10-02 23:05:17 +02:00
parent a5e6e92f22
commit 8e8503345b
9 changed files with 46 additions and 17 deletions
+10 -1
View File
@@ -1,6 +1,8 @@
import ast
import contextlib
import dataclasses
import hashlib
import io
import json
import os
import pathlib
@@ -19,8 +21,8 @@ from loop_claude.claude_code import entries, session, transcript, trust
from loop_claude.cycle import archive, interrupt, judge, retry, run, states, worker
from loop_claude.cycle.verdicts import Finished, Interrupt, Unfinished
from loop_claude.effects import Effects
from loop_claude.cycle.retry import Limited
from loop_claude.failure import Failure
from loop_claude.limited import Limited
from loop_claude.loop import main, reload
from loop_claude.project import checkout, model_choice, premises
from loop_claude.stop import Stop
@@ -56,6 +58,7 @@ class FakeEffects:
execv=self.execv,
git=lambda args, cwd: self.answer("git", args),
input=lambda prompt: self.answer("input", prompt),
local_time=lambda seconds: f"<{seconds}>",
now=lambda: NOW,
on_terminal=lambda: self.terminal,
python=lambda args: self.answer("python", args),
@@ -265,6 +268,12 @@ class Retried(unittest.TestCase):
self.assertEqual(retry.retried("worker", lambda: results.pop(0), fake.effects()), Stop(1, "the worker failed three times running: six"))
self.assertEqual(fake.calls, [("sleep", 60), ("sleep", 60), ("sleep", 3720), ("sleep", 60), ("sleep", 600), ("sleep", 600), ("sleep", 60), ("sleep", 60)])
def test_says_what_claude_said_and_when_the_next_try_is_due(self):
results = [Limited(NOW + 3600, "You've hit your session limit"), "done"]
with contextlib.redirect_stderr(io.StringIO()) as said:
retry.retried("judge", lambda: results.pop(0), FakeEffects().effects())
self.assertEqual(said.getvalue(), f"the judge hit a usage limit (You've hit your session limit); retrying at <{NOW + 3720}>\n")
class Limits(unittest.TestCase):
def test_the_worker_reports_the_latest_reset_its_stream_names(self):