From b37b2e91f7ad04c2d7084b08ba323fc5f5d7fd25 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 2 Oct 2026 22:52:16 +0200 Subject: [PATCH] Answer the second round: the judge's reset is text, one-line limit messages, plainer docstring --- CHANGELOG.md | 2 +- bin/loop_claude/claude_code/entries.py | 3 ++- bin/loop_claude/failure.py | 2 +- bin/loop_claude/loop/main.py | 4 ++-- bin/test_loop_claude.py | 6 ++++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc88bf19..2a0fa47b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- `loop-claude` waits out a usage limit and retries, without counting it as a failure: 2 minutes past the reset, or every 10 minutes when claude names none. It prints what claude said about the limit and when the next try is due. +- `loop-claude` waits out a usage limit and retries, without counting it as a failure: 2 minutes past the reset, or every 10 minutes when the reset time is unknown. It prints what claude said about the limit and when the next try is due. - Install the `claude-security` plugin (README → Install): larv-review's full security scan now runs once you confirm its cost; an unattended larv-review reports the scan as not run. `settings.json` silences the plugin's scan tip after `git push`. - systems-architect and product-owner-reviewer can no longer edit what they review; stability-reviewer keeps its shell to run tests, and loses Claude Code's file-editing tools. - Every project's `todo.md` takes one shape, and larv-review's gate checks it: one table of items, each scored by the formula and goal weights the file states and held to its bar, an item under the bar dropped unless its Exempt cell says why. `bin/rank_todo.py` ranks the table, and `rank_todo.py --help` shows a valid file. diff --git a/bin/loop_claude/claude_code/entries.py b/bin/loop_claude/claude_code/entries.py index 6bfb73ac..16c4074e 100644 --- a/bin/loop_claude/claude_code/entries.py +++ b/bin/loop_claude/claude_code/entries.py @@ -95,7 +95,8 @@ def hit_limit(event: dict) -> bool: def limit_said(event: dict) -> str: - return result if isinstance(result := event.get("result"), str) else "claude said nothing more" + said = " ".join(result.split()) if isinstance(result := event.get("result"), str) else "" + return said or "claude gave no message" # {"type": "rate_limit_event", "rate_limit_info": {"status": "rejected", "resetsAt": 1790790000, ...}} diff --git a/bin/loop_claude/failure.py b/bin/loop_claude/failure.py index 9c61548a..3d655dc7 100644 --- a/bin/loop_claude/failure.py +++ b/bin/loop_claude/failure.py @@ -9,6 +9,6 @@ class Failure: @dataclasses.dataclass(frozen=True) class Limited: - """claude hit a usage limit and said so; resets_at is when the limit resets, in seconds since the epoch, or None when claude did not say.""" + """claude hit a usage limit; said is claude's message about it, and resets_at is when the limit resets, in seconds since the epoch, or None when unknown.""" resets_at: int | None said: str diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index 2f283ab9..d34884b2 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -47,8 +47,8 @@ Exit 1, saying why, when: a judge when claude cannot start or exits non-zero, or its reply misses or mistypes a field, interrupts without a question, or quotes a line the transcript does not hold. A usage limit is not a failure: the worker or the judge is retried 2 minutes after the limit resets, or every 10 - minutes while claude names no future reset time. The judge's reply never names one. stderr says - when the next try is due. + minutes when the reset time is unknown or past. The judge's reply gives its reset time only as + text, so the judge is always retried every 10 minutes. stderr says when the next try is due. Exit 2, when the human is needed and cannot answer: - stdin or stdout is not a terminal, when a model must be picked or an interrupt answered diff --git a/bin/test_loop_claude.py b/bin/test_loop_claude.py index 9dc1c59d..61d0695d 100644 --- a/bin/test_loop_claude.py +++ b/bin/test_loop_claude.py @@ -270,9 +270,11 @@ class Limits(unittest.TestCase): rejected = [{"type": "rate_limit_event", "rate_limit_info": {"status": "rejected", "resetsAt": resets_at}} for resets_at in (NOW + 60, NOW + 600)] allowed = {"type": "rate_limit_event", "rate_limit_info": {"status": "allowed", "resetsAt": NOW + 9000}} limited = {"type": "result", "api_error_status": 429, "result": "You've hit your session limit"} - fake = FakeEffects(streams=[Streamed(1, rejected[1], allowed, rejected[0], limited), Streamed(1, {"type": "result", "api_error_status": 429}), Streamed(0, rejected[0], {"type": "result"})]) + fake = FakeEffects(streams=[Streamed(1, rejected[1], allowed, rejected[0], limited), Streamed(1, {"type": "result", "api_error_status": 429}), Streamed(1, {"type": "result", "api_error_status": 429, "result": " \n"}), Streamed(1, {"type": "result", "api_error_status": 429, "result": "limit\n resets 7pm"}), Streamed(0, rejected[0], {"type": "result"})]) self.assertEqual(worker.run_worker("/r", [], fake.effects()), Limited(NOW + 600, "You've hit your session limit")) - self.assertEqual(worker.run_worker("/r", [], fake.effects()), Limited(None, "claude said nothing more")) + self.assertEqual(worker.run_worker("/r", [], fake.effects()), Limited(None, "claude gave no message")) + self.assertEqual(worker.run_worker("/r", [], fake.effects()), Limited(None, "claude gave no message")) + self.assertEqual(worker.run_worker("/r", [], fake.effects()), Limited(None, "limit resets 7pm")) self.assertIsNone(worker.run_worker("/r", [], fake.effects())) def test_the_judge_reports_a_limit_whatever_its_exit_code(self):