Answer the architect: a pure worker_outcome, Limited beside the retry, a limit ends a run of failures

This commit is contained in:
2026-10-02 22:59:21 +02:00
parent b37b2e91f7
commit 7bf437e75b
8 changed files with 47 additions and 36 deletions
+4 -4
View File
@@ -390,15 +390,15 @@ class Cycles(unittest.TestCase):
self.assertIn("retrying the judge in a minute: the judge returned no reply; it replied: nothing\n", run.stderr)
self.assertEqual(run.stderr.strip().splitlines()[-1], 'the judge failed three times running: the judge\'s reply has no evidence of type string; it replied: {"structured_output": {"interrupt": false}}')
def test_waits_out_a_usage_limit_and_retries_without_counting_a_failure(self):
def test_waits_out_a_usage_limit_which_ends_a_run_of_failures(self):
checkout = Checkout(self)
resets_at = int(time.time()) + 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(stream=f"{rejected}\n{limited}\n", result=False, exit=1), worker(exit=1), worker(), judge(stdout=limited, exit=1), judge()])
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"] * 4 + ["judge"] * 2 + ["worker"])
self.assertEqual([round(seconds, -1) for seconds in run.sleeps], [60, 3720, 60, 600])
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.assertIn(f"the worker hit a usage limit (You've hit your session limit); retrying at {time.strftime('%Y-%m-%d %H:%M %Z', time.localtime(resets_at + 120))}\n", run.stderr)
self.assertIn("the judge hit a usage limit (You've hit your session limit); retrying at ", run.stderr)