Fix the rename's gate failures

This commit is contained in:
2026-12-03 15:29:06 +01:00
parent 969190064e
commit 4e7ec0b210
11 changed files with 48 additions and 47 deletions
+1 -1
View File
@@ -1,8 +1,8 @@
"""What build-release alone says to its worker: the first prompt of a chunk, with what chunk-preflight found. The resumed prompt and the rung sentences are chunk_driver.prompts', which do-epic's cycles use too."""
import functools
from build_release.chunk.chunk_items import CHUNK_ITEMS
from chunk_driver.drivers import BUILD_RELEASE
from build_release.chunk.chunk_items import CHUNK_ITEMS
from model_routing.ladder import ProjectRung
from chunk_driver.prompts import READING_RULE, rung_sentences, worker_prompts
from model_routing.route import Route
+6 -6
View File
@@ -55,11 +55,6 @@ class ExitContract(unittest.TestCase):
("agent_cycle/run.py", "close", "1", "annotation.reason", read),
("agent_cycle/run.py", "close", "1", "failure.reason", read),
("agent_cycle/run.py", "close", "1", "failure.reason", "a finished chunk's session cannot be deleted"),
("chunk_driver/chunk_run.py", "closed_cycle", "1", "failure.reason", read),
("chunk_driver/cycle_start.py", "project_routing", "1", "ladder_file.reason", premises_),
("chunk_driver/cycle_start.py", "routing_on", "1", "ladder.reason", "the project's routing ladder cannot be read or holds a fault"),
("chunk_driver/project/model_choice.py", "get_or_ask_model", "1", "models.reason", models_),
("chunk_driver/project/model_choice.py", "get_or_ask_model", "1", "failure.reason", models_),
("build_release/loop/checkout.py", "checkout_root", "1", "found.reason", git),
("build_release/loop/main.py", "run_loop", "1", "reason", "tmux is missing or older than 3.2"),
("build_release/loop/main.py", "run_loop", "1", "f'{CHUNK_FLAG} is how build-release starts itself", "--chunk is given outside a tmux window"),
@@ -72,10 +67,15 @@ class ExitContract(unittest.TestCase):
("build_release/loop/main.py", "loop_run_from", "1", 'f"the edited build-release cannot read the state', "a reload cannot read the state the running script handed it"),
("build_release/loop/reload.py", "exec_if_edited", "1", "f'could not reload build-release:", "python cannot start for a reload"),
("build_release/loop/routing_check.py", "raise_calls", "1", "f\"could not start claude for the routing calls in {loop.paths.config_clone}", "claude cannot start for an interrupt"),
("chunk_driver/chunk_run.py", "closed_cycle", "1", "failure.reason", read),
("chunk_driver/cycle_start.py", "project_routing", "1", "ladder_file.reason", premises_),
("chunk_driver/cycle_start.py", "routing_on", "1", "ladder.reason", "the project's routing ladder cannot be read or holds a fault"),
("chunk_driver/project/model_choice.py", "get_or_ask_model", "1", "models.reason", models_),
("chunk_driver/project/model_choice.py", "get_or_ask_model", "1", "failure.reason", models_),
]
root = pathlib.Path(main.__file__).parents[2]
found = []
for path in sorted(path for package in ("agent_cycle", "chunk_driver", "build_release") for path in (root / package).rglob("*.py") if not path.name.startswith("test_")):
for path in sorted(path for package in ("agent_cycle", "build_release", "chunk_driver") for path in (root / package).rglob("*.py") if not path.name.startswith("test_")):
functions = [node for node in ast.walk(ast.parse(path.read_text())) if isinstance(node, ast.FunctionDef)]
stops = [(call.lineno, function.name, ast.unparse(call.args[0]), ast.unparse(call.args[1])) for function in functions for call in ast.walk(function) if isinstance(call, ast.Call) and getattr(call.func, "id", None) == "Stop" and not (isinstance(call.args[0], ast.Constant) and call.args[0].value in (0, 2, 130))]
found += [(str(path.relative_to(root)), function, code, reason) for _, function, code, reason in sorted(stops)]
+30 -30
View File
@@ -8,27 +8,26 @@ as goals-and-audience: a file, or a Jira epic's description. `project-config goa
prints where it is. The task runs at the checkout root. Each cycle a worker runs the task. A chunk's
first worker prompt also quotes the premises. They, with code health (the setup's CLAUDE.md →
"Shared goal") ranked first unless the goals file voids it, choose between ways to deliver the
chunk's plan items, or else the task, and never widen them. A judge then reads the transcript's
end, the premises, and the records: the project's AGENTS.md and docs/decisions.md, and the setup's
CLAUDE.md and rules/*.md, then the .md files in the folder of review standards
the project's config sets, where they exist. It rules whether the chunk, the work of one PR, is
finished. A chunk stays unfinished until each answer the human typed in it that a later chunk could
need is recorded: the premises or the records hold it, or the transcript shows the worker writing it
into the premises, AGENTS.md, docs/decisions.md, the plan or a comment. A choice the worker made
that the premises or the records settle is not asked about. When the worker asks a question they
answer, the judge quotes the answer, build-release prints it, and the worker resumes with it. A quote
they do not hold word for word is dropped, and the question goes to the human. So does a question
asked again after its answer. A question the human answered earlier in the chunk goes back to the
worker with that answer, unless the question quotes the words of the answer that leave it open. The
fourth question they answer in one cycle goes to the human too, with the quote. An unfinished chunk
resumes its session next cycle, and the worker is shown the passage the judge quoted as the work
remaining. The next chunk starts a fresh session. Cycles continue until an exit below or Ctrl-C,
either of which stops that one chunk.
Words: the setup's CLAUDE.md → "Vocabulary".
chunk's plan items, or else the task, and never widen them. A judge then reads the transcript's end,
the premises, and the records: the project's AGENTS.md and docs/decisions.md, and the setup's
CLAUDE.md and rules/*.md, then the .md files in the folder of review standards the project's config
sets, where they exist. It rules whether the chunk, the work of one PR, is finished. A chunk stays
unfinished until each answer the human typed in it that a later chunk could need is recorded: the
premises or the records hold it, or the transcript shows the worker writing it into the premises,
AGENTS.md, docs/decisions.md, the plan or a comment. A choice the worker made that the premises or
the records settle is not asked about. When the worker asks a question they answer, the judge quotes
the answer, build-release prints it, and the worker resumes with it. A quote they do not hold word
for word is dropped, and the question goes to the human. So does a question asked again after its
answer. A question the human answered earlier in the chunk goes back to the worker with that answer,
unless the question quotes the words of the answer that leave it open. The fourth question they
answer in one cycle goes to the human too, with the quote. An unfinished chunk resumes its session
next cycle, and the worker is shown the passage the judge quoted as the work remaining. The next
chunk starts a fresh session. Cycles continue until an exit below or Ctrl-C, either of which stops
that one chunk. Words: the setup's CLAUDE.md → "Vocabulary".
build-release needs tmux 3.2 or later, and checks it before it starts anything. Each chunk runs in its
own window of one tmux session per project, named loop-<key>, such as loop-claude-config. <key> is
the checkout's path relative to ~/code, or to / outside it, with a dash for each character other
build-release needs tmux 3.2 or later, and checks it before it starts anything. Each chunk runs in
its own window of one tmux session per project, named loop-<key>, such as loop-claude-config. <key>
is the checkout's path relative to ~/code, or to / outside it, with a dash for each character other
than a letter, a digit, _ or -. The tmux session's @loop-root option names its checkout, and a
checkout whose key maps to a tmux session another checkout runs is refused. build-release <task>
starts the chunks that may start now, then attaches to the tmux session, or switches to it inside
@@ -43,11 +42,12 @@ release review, runs alone in the window no-item.
Each window runs a build-release for that one chunk, started with --chunk <window>, which nobody
types. As a chunk finishes, its loop starts each chunk that may start then, with the task it ran
itself, and exits, which closes its window. A loop that stops, by Ctrl-C, an exit below or a
failure, keeps its window, with its last lines, and its chunk keeps its items; the next build-release
<task> starts it again before any other. To stop every chunk, press Ctrl-C in each window. A chunk's
claude session is named "A <key> build-release <window>", so a rerun resumes a chunk left open, and is
deleted when the chunk finishes. A fresh worker is told the items the project's other chunks hold,
running or stopped: each one's own and those on its latest `Chunk items:` line, and leaves them out.
failure, keeps its window, with its last lines, and its chunk keeps its items; the next
build-release <task> starts it again before any other. To stop every chunk, press Ctrl-C in each
window. A chunk's claude session is named "A <key> build-release <window>", so a rerun resumes a
chunk left open, and is deleted when the chunk finishes. A fresh worker is told the items the
project's other chunks hold, running or stopped: each one's own and those on its latest `Chunk
items:` line, and leaves them out.
A question only the human can answer is an interrupt (bin/agent_cycle/interrupt.py).
build-release prints the question in the chunk's window and rings its bell. Until it is answered the
@@ -66,8 +66,8 @@ stops are left out: Ctrl-C, printing this help, the build-release that started t
attaches or prints how to, and a loop whose chunk finished once it started the next chunks. A DM
that fails is said on stderr, and the loop goes on. Where no answer has come 10 minutes before the
worker's hour-long prompt cache expires, and the worker's context holds at least 60k tokens,
build-release compacts the worker's session with `claude -p /compact` and keeps waiting, so the resume
doesn't write the whole context again.
build-release compacts the worker's session with `claude -p /compact` and keeps waiting, so the
resume doesn't write the whole context again.
As a chunk starts, before it is routed, build-release runs bin/chunk-preflight --worktree, adding
--item <ID> in a window named for an item, and quotes what it prints in the first prompt
@@ -160,9 +160,9 @@ measurement.
A change to bin/build-release or any bin/**/*.py takes effect at the next cycle boundary, once
build-release --help succeeds: the loop reloads into the edited script.
Under merge = "human", where no chunk runs and every item left awaits a person's merge, build-release
doesn't start a chunk: it names those pull requests, in a DM too, and exits 0. Its window closes,
so the next build-release <task> reads the plan again.
Under merge = "human", where no chunk runs and every item left awaits a person's merge,
build-release doesn't start a chunk: it names those pull requests, in a DM too, and exits 0. Its
window closes, so the next build-release <task> reads the plan again.
Exit 1, saying why, when:
- no task is given
+1 -1
View File
@@ -5,9 +5,9 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
import build_release.routed_item
from failure import Failure
from release_plan.release_standing import LastCut
import build_release.routed_item
from build_release.doubles import NO_CUT, TODO
from plan_store.todo_md import plan_of
+1 -1
View File
@@ -13,7 +13,7 @@ from loop_state.paths import STATE_FOLDER
from agent_cycle import tmux
# Under the home folder, a folder per project key holds LOCK.
CLAIMS = f"{STATE_FOLDER}/build-release"
CLAIMS = f"{STATE_FOLDER}/loop-claude"
# The file an entry point keeps locked with flock while it lists the windows of a project's chunks and starts new ones. Two loops whose chunks finish together then don't start a chunk twice, and do-epic, which holds the same lock, never starts a chunk in a checkout while build-release does.
LOCK = "starting"
# The flag that tells the entry point in a window its chunk, as `--chunk item-372` for build-release and `--chunk ABC-34 ABC-12` for do-epic. Nobody types it, so no panel picked it.
@@ -10,9 +10,9 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from chunk_driver.drivers import BUILD_RELEASE
from failure import Failure
from loop_effects.doubles import FakeEffects
from chunk_driver.drivers import BUILD_RELEASE
from chunk_driver.project import model_choice
from loop_state.paths import paths_from
from text_files.file_writes import replace_file
+1 -1
View File
@@ -1,10 +1,10 @@
from chunk_driver.prompts import ANSWER_DESTINATIONS
from chunk_driver.drivers import BUILD_RELEASE
from claude_code.entries import Entry
from agent_cycle import escalation_mark
from failure import Failure
from agent_cycle.judge import Grounds, judge_rules, TASK_HEADING, transcript_heading
from claude_code.transcript import human_answers
from chunk_driver.drivers import BUILD_RELEASE
from agent_cycle.worker_prompts import typed_answer
+1 -1
View File
@@ -60,6 +60,7 @@ from rung_replay.archive import archiving, replay_folder
from rung_replay.command import arguments_or_exit, down_from, failed, limited_exit, print_report, projects_on, say
from rung_replay.search import AT_ONCE, first_reply, replayed
from agent_cycle.judge import Brief, judge_archived, judge_once
from chunk_driver.drivers import BUILD_RELEASE
from judge_replay.replay import Case, case_from, Kind, report, reproduced, sample, verdict_kind
from transcript_archive.project_key import checkout_of
from loop_state.paths import CLAUDE_HOME
@@ -70,7 +71,6 @@ from judge_replay.archived_prompt import grounds_of
from transcript_archive.judge_run import JudgeRun
from model_routing.ladder import Ladder, ProjectRung, REVIEW_STEPS, Rung
from claude_code.reply import Limited
from chunk_driver.drivers import BUILD_RELEASE
from model_routing.ladder_file import read_ladder, SHIPPED
from chunk_driver.project.premises import read_premises
from chunk_driver.project.records import read_records, RECORDS_NAMED
+1 -1
View File
@@ -12,6 +12,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from chunk_driver.prompts import ANSWER_DESTINATIONS
from transcript_archive.outcomes import ANSWERED, FINISHED, INTERRUPTED, UNFINISHED
from claude_code.entries import AssistantTurn, HumanTurn, LoopPrompt, Text
from chunk_driver.drivers import BUILD_RELEASE
from judge_replay.replay import Case, case_from, report, reproduced, sample, verdict_kind
from text_files.doubles import compress
from project_config.doubles import configured
@@ -20,7 +21,6 @@ from failure import Failure
from agent_cycle.verdicts import Finished, Interrupt, QuotedAnswer, Unfinished
from judge_replay.archived_prompt import grounds_of
from agent_cycle.judge import judge_archived, judge_rules, Rejected, TASK_HEADING, transcript_heading
from chunk_driver.drivers import BUILD_RELEASE
from judge_replay import main
from rung_replay.search import Miss, Replay, Tried
from model_routing.ladder import Rung