Name the driver of a cycle in the text its worker, judge and human read

This commit is contained in:
2026-11-18 20:34:40 +01:00
parent b827986ec8
commit c4d06c55b5
15 changed files with 213 additions and 169 deletions
+2 -2
View File
@@ -133,7 +133,7 @@ def start_chunks(loop_run: LoopRun, leaving: bool, paths: Paths, env: typing.Map
if isinstance(config, Failure):
return config
key = project_key(loop_run.root, paths.home)
session = tmux.session_name(key)
session = tmux.session_name(tmux.LOOP, key)
handed = {name: value for name, value in env.items() if name.startswith(HANDED)}
try:
with starting(paths.home, key):
@@ -168,7 +168,7 @@ def held_beside(chunk: str, root: str, paths: Paths, effects: Effects) -> list[i
"""The plan items that the project's other chunks hold now, running or stopped, which a chunk starting as `chunk` leaves to them. It waits for a loop that is starting windows, so chunks started together see each other. Where the lock cannot be taken, it reads the windows without it."""
key = project_key(root, paths.home)
wait_for_starts(paths.home, key)
others = [window.name for window in tmux.listed(tmux.session_name(key), effects.tmux) if window.name != chunk]
others = [window.name for window in tmux.listed(tmux.session_name(tmux.LOOP, key), effects.tmux) if window.name != chunk]
return sorted(held_items(others, key, paths.claude_code_transcripts))
+4 -4
View File
@@ -50,7 +50,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.
if reason := tmux.unusable(effects.tmux):
if reason := tmux.unusable(effects.tmux, prompts.DRIVER):
return Stop(1, reason)
if loop_run.chunk is None:
return windows_opened(loop_run, env, paths, launcher, effects)
@@ -59,7 +59,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
return Stop(1, f"{CHUNK_FLAG} is how loop-claude starts itself in a tmux window; run loop-claude <task>")
baseline = fingerprint(launcher)
key = project_key(loop_run.root, paths.home)
window = tmux.Window(tmux.session_name(key), loop_run.chunk, pane)
window = tmux.Window(tmux.session_name(tmux.LOOP, key), loop_run.chunk, pane)
loop = Loop(root=loop_run.root, session=chunk_session(key, loop_run.chunk, paths.claude_code_transcripts), window=window, paths=paths, env=env, launcher=launcher, effects=effects)
while True:
if stop := exec_if_edited(loop, baseline, loop_run):
@@ -87,7 +87,7 @@ def windows_opened(loop_run: LoopRun, env: typing.Mapping[str, str], paths: Path
started = start_chunks(loop_run, False, paths, env, launcher, effects)
if isinstance(started, Failure):
return Stop(1, started.reason)
session = tmux.session_name(project_key(loop_run.root, paths.home))
session = tmux.session_name(tmux.LOOP, project_key(loop_run.root, paths.home))
say(f"started {', '.join(started)} in the tmux session {session}" if started else f"the tmux session {session} runs every chunk that may run now, so `{loop_run.task}` started in no new window", effects, stdout=True)
if not effects.on_terminal():
say(f"not on a terminal; see the chunks with `tmux attach -t ={session}`", effects, stdout=True)
@@ -113,7 +113,7 @@ def next_cycle(loop_run: LoopRun, loop: Loop) -> Cycle | Stop:
records = read_records(loop.root, loop.paths.home, loop.paths.claude_dir)
if isinstance(records, Failure):
return Stop(1, records.reason)
models = get_or_ask_models(project_key(loop.root, loop.paths.home), loop.paths, loop.env, loop.effects)
models = get_or_ask_models(project_key(loop.root, loop.paths.home), loop.paths, loop.env, prompts.DRIVER, loop.effects)
if isinstance(models, Stop):
return models
ladder_file = project_ladder_file(loop.root, loop.paths.home)