This commit is contained in:
@@ -141,6 +141,9 @@ if os.path.basename(sys.argv[0]) == "loop-claude":
|
||||
record({"argv": sys.argv[1:]})
|
||||
pause = time.sleep
|
||||
time.sleep = lambda seconds: record({"sleep": seconds}) if seconds >= 1 else pause(seconds)
|
||||
# A test that sets LOOP_TEST_NOW fixes the loop's wall clock at that many seconds since the epoch.
|
||||
if "LOOP_TEST_NOW" in os.environ:
|
||||
time.time = lambda: float(os.environ["LOOP_TEST_NOW"])
|
||||
# The host's own memory doesn't matter: every read finds all of it available.
|
||||
sys.path.insert(0, os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
import pathlib
|
||||
@@ -704,13 +707,15 @@ class Cycles(unittest.TestCase):
|
||||
def test_waits_out_a_usage_limit_which_ends_a_run_of_failures(self):
|
||||
checkout = Checkout(self)
|
||||
checkout.env["TZ"] = "UTC"
|
||||
resets_at = int(time.time()) + 3600
|
||||
now = 1_800_000_000
|
||||
checkout.env["LOOP_TEST_NOW"] = str(now)
|
||||
resets_at = now + 3600
|
||||
rejected = json.dumps({"type": "rate_limit_event", "rate_limit_info": {"status": "rejected", "resetsAt": resets_at}})
|
||||
limited = json.dumps({"type": "result", "api_error_status": 429, "is_error": True, "result": "You've hit your session limit"})
|
||||
run = checkout.run([worker(exit=1), worker(exit=1), worker(stream=f"{rejected}\n{limited}\n", result=False, exit=1), worker(exit=1), worker(), judge(stdout=limited, exit=1), judge()])
|
||||
self.assertEqual(run.code, 130)
|
||||
self.assertEqual(run.roles(), ["worker"] * 5 + ["judge"] * 2 + ["worker"])
|
||||
self.assertEqual([round(seconds, -1) for seconds in run.sleeps], [60, 60, 3720, 60, 600])
|
||||
self.assertEqual(run.sleeps, [60, 60, 3720, 60, 600])
|
||||
self.assertIn(f"the worker hit a usage limit (You've hit your session limit); retrying at {datetime.datetime.fromtimestamp(resets_at + 120, datetime.timezone.utc):%Y-%m-%d %H:%M:%S}\n", run.stderr)
|
||||
self.assertIn("the judge hit a usage limit (You've hit your session limit); retrying at ", run.stderr)
|
||||
|
||||
|
||||
@@ -3864,3 +3864,13 @@ Read most (opens and searches):
|
||||
Read most (opens and searches):
|
||||
|
||||
- `agents/stability-reviewer.md` 1
|
||||
|
||||
## Reading cost, chunk 180918d0d6c2, finished 2026-12-01T15:54:50Z
|
||||
|
||||
122282 new input tokens before the first commit.
|
||||
|
||||
Read most (opens and searches):
|
||||
|
||||
- `docs/decisions.md` 18
|
||||
- `todo.md` 12
|
||||
- `README.md` 4
|
||||
|
||||
Reference in New Issue
Block a user