Answer stability round 1: 1 🔴, 6 🟡 (2 misread); read the scoring rule from the clone, hand windows XDG_DATA_HOME, retry the home check where nobody watches, tell an unreadable sign-in status and settings file apart, and bound the claude commands that build the home
CI / tests (pull_request) Successful in 4m35s

This commit is contained in:
2026-12-04 02:45:02 +01:00
parent 71865e0479
commit 3519922f01
19 changed files with 153 additions and 69 deletions
+2 -1
View File
@@ -17,6 +17,7 @@ from loop_effects.effects import Effects, say
from failure import Failure
from agent_cycle.verdicts import Finished
from build_release.loop.usage import HELP
from agent_cycle.retry import home_unready
from chunk_driver.this_loop import Loop
from loop_state.paths import Paths
from transcript_archive.project_key import project_key
@@ -72,7 +73,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
if isinstance(loop_run, Stop):
return loop_run
# Before anything starts: a worktree, a claude session or a tmux window. One stop names everything that is the person's to do.
if needs := [reason for reason in (tmux.unusable(effects.tmux, fresh_prompt.DRIVER), effects.claude_home()) if reason]:
if needs := [reason for reason in (tmux.unusable(effects.tmux, fresh_prompt.DRIVER), home_unready(effects, watched=loop_run.chunk is None)) if reason]:
return Stop(1, "\n".join(needs))
if loop_run.chunk is None:
return windows_opened(loop_run, env, paths, launcher, effects, steps.start_chunks)
+1 -1
View File
@@ -168,7 +168,7 @@ class StartChunks(unittest.TestCase):
first = next(call for call in fake.tmux_calls if call[0] == "new-session")
self.assertEqual((first[first.index("-s") + 1], first[first.index("-c") + 1]), (self.session, str(self.root)))
# Only build-release's own variables and the two XDG ones are handed on, since a window gets the tmux server's environment.
self.assertEqual([word for word in first if "=" in word], ["BUILD_RELEASE_WORKER_MODEL=m", "XDG_CONFIG_HOME=", "XDG_STATE_HOME="])
self.assertEqual([word for word in first if "=" in word], ["BUILD_RELEASE_WORKER_MODEL=m", "XDG_CONFIG_HOME=", "XDG_STATE_HOME=", "XDG_DATA_HOME="])
self.assertEqual(fake.tmux_calls[0], ["list-windows", "-t", f"={self.session}", "-F", "#{window_name}\t#{pane_dead}\t#{window_id}"])
# The session names the checkout whose chunks it runs.
self.assertIn(["set-option", "-t", f"={self.session}:", "@loop-root", str(self.root)], fake.tmux_calls)
+12
View File
@@ -263,6 +263,18 @@ class WindowStarts(unittest.TestCase):
self.assertEqual(self.run_loop(["--chunk", "item-3", "do it"], fake)[0], Stop(1, "--chunk is how build-release starts itself in a tmux window; run build-release <task>"))
self.assertEqual(self.asked, [])
def test_a_window_loop_retries_a_failed_check_of_the_loops_claude_home_as_a_failed_worker_run_is(self):
# Nobody watches a window, and a claude that Claude Code's updater repoints fails for a moment.
for answers, stop in ((["could not build it", None], Stop(1, "--chunk is how build-release starts itself in a tmux window; run build-release <task>")), (["could not build it"] * 3, Stop(1, "the check of the loop's Claude home failed three times running: could not build it"))):
with self.subTest(stop=stop):
fake = FakeEffects(git=["/r\n"])
effects = dataclasses.replace(fake.effects(), claude_home=lambda: answers.pop(0))
with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()) as said:
self.assertEqual(main.run_loop(["--chunk", "item-3", "do it"], {}, paths.paths_from(self.HOME, {}), pathlib.Path("/b/build-release"), CWD, effects, steps(self.fail)), stop)
self.assertEqual(answers, [])
self.assertIn(f"{STAMP} retrying the check of the loop's Claude home in a minute: could not build it\n", said.getvalue())
self.assertIn(("sleep", 60), fake.calls)
def test_reads_the_chunk_a_window_loop_is_started_with(self):
self.assertEqual(main.loop_run_from(["--chunk", "item-3", "do", "it"], CWD, FakeEffects(git=["/r\n"]).effects()), main.LoopRun(0, "/r", "do it", "", chunk="item-3"))
self.assertEqual(main.loop_run_from(["do", "it"], CWD, FakeEffects(git=["/r\n"]).effects()), main.LoopRun(0, "/r", "do it", ""))
+4 -3
View File
@@ -29,9 +29,10 @@ Words: the setup's CLAUDE.md → "Vocabulary".
build-release runs every claude in the loop's Claude home, ~/.local/share/build-release/claude-home,
which it builds from the clone it ships in before it starts anything. Until someone has signed in
there, it stops and prints the line that does so. README.md → Install says what the home holds.
there, it stops and prints the command to sign in with. README.md → Install says what the
home holds.
build-release needs tmux 3.2 or later, and checks that first too. Each chunk runs in
build-release needs tmux 3.2 or later, and checks that first as well. 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
@@ -174,7 +175,7 @@ Exit 1, saying why, when:
- no task is given
- git cannot start or finds no checkout
- tmux is missing or older than 3.2, the loop's Claude home cannot be built, or nobody is signed
in there
in there; a chunk's window checks the home three times, a minute apart, before it stops
- --chunk is given outside a tmux window
- a chunk's window cannot be started, as when the project's config cannot be read, or the tmux
session runs another checkout's chunks