From 2dcf93a55fcbc3a32ea51e901c23b6ebc8a40f7c Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 23:19:41 +0100 Subject: [PATCH] Sort the imports, type the check reads and cite the working rule by its whole lead --- bin/chunk_pr/approval.py | 6 ++++-- bin/do_epic/chunk_prompt.py | 4 ++-- bin/do_epic/gates.py | 4 ++-- bin/do_epic/main.py | 2 +- bin/do_epic/scheduler.py | 4 ++-- bin/do_epic/test_main.py | 4 ++-- bin/do_epic/test_parked.py | 2 +- bin/do_epic/test_scheduler.py | 2 +- bin/forge/pulls.py | 3 ++- bin/forge/test_forge.py | 2 +- 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/bin/chunk_pr/approval.py b/bin/chunk_pr/approval.py index d420a7f8..479acc1b 100644 --- a/bin/chunk_pr/approval.py +++ b/bin/chunk_pr/approval.py @@ -63,8 +63,10 @@ def approved(number: str, run: Run, sleep: typing.Callable[[float], None] = time def unanswered(number: str, run: Run) -> Failure | None: """A Failure naming the files where a reviewer's comment waits for an answer on pull request number, as `waiting_threads` finds them, or saying why they cannot be read. None where no thread waits.""" waiting = waiting_threads(number, run) - if isinstance(waiting, Failure) or not waiting: - return waiting or None + if isinstance(waiting, Failure): + return waiting + if not waiting: + return None return Failure(f"a reviewer's comment on pull request {number} waits for an answer, in {', '.join(waiting)}; answer it in its thread, push any fix, and run chunk-pr merge again") diff --git a/bin/do_epic/chunk_prompt.py b/bin/do_epic/chunk_prompt.py index 609d6b58..b9f2a335 100644 --- a/bin/do_epic/chunk_prompt.py +++ b/bin/do_epic/chunk_prompt.py @@ -1,11 +1,11 @@ """What a do-epic cycle's worker is told: its task, from the issue, and its first prompt. The resumed prompt and the rung sentences are the ones loop-claude's cycles use, naming do-epic; a chunk that was parked is first told why it resumes.""" import dataclasses -from agent_cycle.worker_prompts import WorkerPrompts from do_epic.backend.protocol import EpicIssue from model_routing.ladder import ProjectRung from loop_claude.cycle import prompts from model_routing.route import Route +from agent_cycle.worker_prompts import WorkerPrompts # The entry point's name as the worker, the judge and the human read it. DRIVER = "do-epic" @@ -31,7 +31,7 @@ def fresh(task: str, premises: str, route: Route, project: ProjectRung | None, f WORKER = prompts.worker_prompts(DRIVER, fresh, "") # What a worker does with a reviewer's feedback, as the decision asks (docs/decisions.md → `do-epic: drives one Jira epic …`, "Long gates"). -FEEDBACK = 'Where a reviewer left feedback, fix what is reasonable and push it, answer the rest in its thread, and change the setup so review would have caught it (~/.claude/CLAUDE.md → "Working loop", "Change the setup for each finding an outside reviewer raises"). Then merge the pull request as before.' +FEEDBACK = 'Where a reviewer left feedback, fix what is reasonable and push it, answer the rest in its thread, and change the setup so review would have caught it (~/.claude/CLAUDE.md → "Working loop", "Change the setup for each finding an outside reviewer raises on a PR, deterministic tools first"). Then merge the pull request as before.' def unparked(news: str) -> WorkerPrompts: diff --git a/bin/do_epic/gates.py b/bin/do_epic/gates.py index f0ad0d2e..df7fe66d 100644 --- a/bin/do_epic/gates.py +++ b/bin/do_epic/gates.py @@ -5,10 +5,10 @@ import dataclasses import json import typing -from chunk_pr.approval import waiting_threads +from forge.pulls import CheckFailed, checks_now, open_pull, Pending, required_checks from failure import Failure from forge.commands import forge_of, Run -from forge.pulls import CheckFailed, checks_now, open_pull, Pending, required_checks +from chunk_pr.approval import waiting_threads # What a pull request waits on, as the words after "awaits". CHECKS = "its checks" diff --git a/bin/do_epic/main.py b/bin/do_epic/main.py index ddb7c737..9abbd53d 100644 --- a/bin/do_epic/main.py +++ b/bin/do_epic/main.py @@ -9,7 +9,6 @@ import typing from loop_claude.loop.chunk_start import archived_route, routed from do_epic import chunk_prompt, gates, parked, scheduler -from forge.commands import Run, runner from do_epic.repo_pick import ClaudeWork, HumanTask, recorded, Repo from loop_claude.loop.close import closed_cycle from agent_cycle.run import Cycle, run_cycle @@ -33,6 +32,7 @@ from transcript_archive.project_key import project_key from model_routing.ladder_file import project_ladder_file, read_ladder, SHIPPED from loop_claude.project.premises import read_premises from loop_claude.project.records import read_records +from forge.commands import Run, runner from claude_code.session import session_named from loop_claude.loop.main import setup_version from agent_cycle.stop import Stop diff --git a/bin/do_epic/scheduler.py b/bin/do_epic/scheduler.py index fae20f4a..01b7998d 100644 --- a/bin/do_epic/scheduler.py +++ b/bin/do_epic/scheduler.py @@ -5,14 +5,14 @@ import dataclasses import pathlib import typing -from chunk_pr.approval import PARKS from do_epic.epic_record import CAP -from do_epic.parked import parked_chunks from loop_claude.loop.chunk_windows import epic_chunks, HANDED, LOCK, project_lock, starting from do_epic.backend.protocol import EpicIssue from failure import Failure from do_epic.repo_pick import HumanTask, recorded, Repo from project_config.settings import PARALLEL_CHUNKS +from do_epic.parked import parked_chunks +from chunk_pr.approval import PARKS from transcript_archive.project_key import project_key from do_epic.split import SPLIT_LABEL from agent_cycle import tmux diff --git a/bin/do_epic/test_main.py b/bin/do_epic/test_main.py index 1f81262e..86b0340a 100644 --- a/bin/do_epic/test_main.py +++ b/bin/do_epic/test_main.py @@ -18,12 +18,12 @@ from do_epic.epic_record import EpicRecord from agent_cycle import escalation_mark, judge, tmux from failure import Failure from loop_claude.test_loop_claude import FakeEffects, judged, Worker -from do_epic.test_scheduler import issue from do_epic.test_gates import Forge -from do_epic import parked +from do_epic.test_scheduler import issue from loop_claude.loop.this_loop import Loop from loop_claude.loop.reload import LoopRun from do_epic.backend.fake import MemoryEpic +from do_epic import parked from loop_state.paths import paths_from from model_routing.route import Route from model_routing.ladder import Rung diff --git a/bin/do_epic/test_parked.py b/bin/do_epic/test_parked.py index 8ea7e87e..119b4cb4 100644 --- a/bin/do_epic/test_parked.py +++ b/bin/do_epic/test_parked.py @@ -5,8 +5,8 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from do_epic.parked import file_of, park, Parked, parked_chunks, unpark from failure import Failure +from do_epic.parked import file_of, park, Parked, parked_chunks, unpark CHUNK = Parked("ABC-21", "/code/billing-ABC-21", "7", "0c0f", "an approval") diff --git a/bin/do_epic/test_scheduler.py b/bin/do_epic/test_scheduler.py index b4ade50b..b9d26428 100644 --- a/bin/do_epic/test_scheduler.py +++ b/bin/do_epic/test_scheduler.py @@ -7,10 +7,10 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from do_epic.scheduler import Chunk, CHUNK_FLAG, chunks, Epic, refusal, RepoRoom, resume, start_chunks, Started, Waits -from do_epic.parked import file_of, park, Parked from do_epic import chunk_prompt from do_epic.backend.protocol import EpicIssue from failure import Failure +from do_epic.parked import file_of, park, Parked from do_epic.epic_record import parallel_chunks_in from loop_claude.cycle import prompts from model_routing.route import Route diff --git a/bin/forge/pulls.py b/bin/forge/pulls.py index 2f2d1c8d..77f3c3fb 100644 --- a/bin/forge/pulls.py +++ b/bin/forge/pulls.py @@ -117,11 +117,12 @@ def checks_passed(forge: Forge, number: str, head: str, required: set[str], run: sleep(POLL_SECONDS) return None polls = WAIT_SECONDS // POLL_SECONDS + now: Pending | Failure | None = None for poll in range(polls + 1): now = checks_now(forge, number, head, required, run, settled=poll * POLL_SECONDS >= settle) if not isinstance(now, Pending): return now if poll < polls: sleep(POLL_SECONDS) - waited_on = f"{', '.join(now.missing)}, which the protection requires, never passed" if now.missing else "a check is still pending" + waited_on = f"{', '.join(now.missing)}, which the protection requires, never passed" if isinstance(now, Pending) and now.missing else "a check is still pending" return Failure(f"gave up on pull request {number} after {WAIT_SECONDS // 60} minutes: {waited_on}") diff --git a/bin/forge/test_forge.py b/bin/forge/test_forge.py index 54ab6417..da917564 100644 --- a/bin/forge/test_forge.py +++ b/bin/forge/test_forge.py @@ -7,8 +7,8 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from forge.pulls import CheckFailed, checks_now, checks_passed, open_pull, Pending, POLL_SECONDS, required_checks, WAIT_SECONDS -from forge.commands import forge_of, gitea, url_beside from failure import Failure +from forge.commands import forge_of, gitea, url_beside class ForgeOf(unittest.TestCase):