Run each chunk in its own tmux window, up to parallel-chunks at once, and mark a window that waits
CI / tests (pull_request) Failing after 2m56s

This commit is contained in:
2026-11-16 11:59:45 +01:00
parent 7fc64d860a
commit eecb0387ca
28 changed files with 883 additions and 209 deletions
+29 -11
View File
@@ -26,7 +26,9 @@ remaining. The next chunk starts a fresh session. Cycles continue until an exit
Words: ~/.claude/CLAUDE.md → "Vocabulary".
A question only the human can answer is an interrupt (bin/loop_claude/cycle/interrupt.py).
loop-claude prints the question on its terminal, where the human answers it:
loop-claude prints the question in the chunk's window and rings its bell. Until it is answered the
window's name ends in " ?", as in "item-372 ?", which tmux's status bar shows. The human answers
it there:
- A line of text: the worker resumes headless with it. The judge reads it as the human's, so the
chunk stays unfinished until the answer is recorded.
- /talk: opens the worker's session with `claude --resume` on the terminal, to read the diff or
@@ -34,20 +36,33 @@ loop-claude prints the question on its terminal, where the human answers it:
- Enter alone: stops the loop.
A release ready to cut opens that session on the terminal at once, since only the human may cut it.
While claude is open, Ctrl-C reaches it alone, and the loop goes on.
Where the project's config sets notifier, loop-claude also sends the human each question, each
release ready to cut and each stop as a DM, as bin/notify sends it. Two stops are
left out: Ctrl-C, and printing this help. A DM that fails is said on stderr, and the loop goes on.
Where the project's config sets notifier, loop-claude also sends the human each question, naming
its window as <session>:<window>, each release ready to cut and each stop as a DM, as bin/notify
sends it. Four stops are left out: Ctrl-C, printing this help, the loop-claude that started the
windows, and a loop whose chunk finished. A DM that fails is said on stderr, and the loop goes on.
As a chunk starts, before it is routed, loop-claude runs bin/chunk-preflight --worktree and quotes
what it prints in the first prompt (prompts.preflight_facts in bin/loop_claude/cycle/prompts.py);
chunk-preflight --help says what it finds and makes. A preflight that fails, or is still running
chunk-preflight --help says what it finds and makes. For a window named for an item it adds
--item <ID>. A preflight that fails, or is still running
after 600 s and is stopped, leaves the worker to find the facts itself.
Loops of one project run side by side, each on one chunk at a time. Each holds a slot of the
project, the file slot-<n> under ~/.local/state/loop-claude/<key>/, locked while the loop runs.
<key> is the checkout's path relative to ~/code, or to / outside it. A loop takes the lowest free
slot whose session is open, so a rerun resumes a chunk left open, or else the lowest free slot.
slot-0's session is named "A <key> loop-claude", and slot-<n>'s "A <key> loop-claude <n+1>".
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 tmux reads as a separator. loop-claude <task> starts the chunks that may
start now, then attaches to the session, or switches to it inside tmux; detaching leaves the chunks
running. Off a terminal it prints the command that attaches. Up to parallel-chunks chunks run at
once, a whole number the project's config sets, 1 by default. The first starts from the plan's next
item, and each other from an item whose `Touches:` prediction overlaps none before it
(touch-predictions --help). A window is named for the item its chunk starts from, as item-372; a
chunk without a plan item, such as planning a release or its release review, runs alone in the
window no-item. Each window runs a loop-claude for that one chunk, started with --chunk <window>,
which nobody types. As a chunk finishes, its loop starts each chunk that may start then and exits,
which closes its window. The window of a loop that failed stays, with its last lines, until its
chunk starts again. A chunk's session is named "A <key> loop-claude <window>", so a rerun resumes a
chunk left open. A fresh worker is told the items the other running chunks hold, each chunk's own
and those on its latest `Chunk items:` line, and leaves them out. loop-claude needs tmux 3.2 or
later, and checks it before it starts anything.
The session is deleted when its chunk finishes. At every
interrupt, and as every cycle ends, Ctrl-C and a failure included, the session's transcript is
copied into a folder per chunk under $LOOP_CLAUDE_TRANSCRIPTS/<key> (default root
@@ -116,7 +131,10 @@ loop-claude --help succeeds: the loop reloads into the edited script.
Exit 1, saying why, when:
- no task is given
- git cannot start or finds no checkout
- its slot in the project cannot be taken
- tmux is missing or older than 3.2
- --chunk is given outside a tmux window
- a chunk's window cannot be started, as when the plan or the project's config cannot be read
- the tmux session cannot be put on the terminal
- the goals file, or AGENTS.md, docs/decisions.md, ~/.claude/CLAUDE.md, ~/.claude/rules/*.md or
the project's review standards where they exist, cannot be read or is not UTF-8
- no config names the checkout, its config cannot be read, or the goals file holds no premises