Make chunk-preflight create the item's worktree only with --worktree, which loop-claude passes

This commit is contained in:
2026-10-31 01:27:34 +01:00
parent 095340da78
commit 610cd63ba6
8 changed files with 84 additions and 49 deletions
+7 -7
View File
@@ -35,11 +35,11 @@ loop-inbox lists it too. While claude is open, Ctrl-C reaches it alone, and the
While it runs, loop-claude also lists itself in loop-inbox, with the todo.md items its chunk takes,
as bin/loop_claude/running_loops.py describes.
As a chunk starts, before it is routed, loop-claude runs bin/chunk-preflight (bin/chunk_preflight/),
which finds the chunk's facts and makes its worktree; chunk-preflight --help lists them, and
prompts.preflight_facts in bin/loop_claude/cycle/prompts.py quotes them in the first prompt. A
preflight that fails, or is still running after 600 s and is stopped, leaves the worker to find the
facts itself.
As a chunk starts, before it is routed, loop-claude runs bin/chunk-preflight --worktree
(bin/chunk_preflight/), which finds the chunk's facts and makes its worktree; chunk-preflight
--help lists them, and prompts.preflight_facts in bin/loop_claude/cycle/prompts.py quotes them in
the first prompt. A preflight that fails, or is still running after 600 s and is stopped, leaves
the worker to find the facts itself.
Each project has one session, named "A <key> loop-claude", where <key> is the checkout's path
relative to ~/code, or to / outside it. The session is deleted when its chunk finishes. At every
@@ -295,8 +295,8 @@ def chunk_start(session: Session, preflight: pathlib.Path, root: str, effects: E
def chunk_facts(preflight: pathlib.Path, root: str, effects: Effects) -> str:
"""What chunk-preflight printed at the checkout root, for a fresh worker's prompt, or why it could not run."""
done = effects.python([str(preflight)], root)
"""What chunk-preflight printed at the checkout root, its worktree made, for a fresh worker's prompt, or why it could not run."""
done = effects.python([str(preflight), "--worktree"], root)
if done.returncode:
return prompts.preflight_failed(done.stderr.strip() or f"it exited {done.returncode}")
return prompts.preflight_facts(done.stdout.strip())