Clamp the room for new chunks at 0, and test the held-items wording and the session option's target

This commit is contained in:
2026-11-16 12:55:17 +01:00
parent 30b0e9e0a7
commit 96e1b364f1
2 changed files with 7 additions and 3 deletions
+2 -3
View File
@@ -118,9 +118,8 @@ def start_chunks(loop_run: LoopRun, leaving: bool, paths: Paths, env: typing.Map
if windows and (owned := tmux.owner(session, effects.tmux)) != loop_run.root:
return Failure(f"the tmux session {session} runs the chunks of {owned or 'another checkout'}, whose key maps to the same session name; rename one of the two checkouts' folders")
running = [window.name for window in windows if not window.dead and not (leaving and window.name == loop_run.chunk)]
room = config.parallel_chunks - len(running)
if room <= 0:
return []
# Below 0 where the config lowered parallel-chunks while more chunks ran.
room = max(config.parallel_chunks - len(running), 0)
# A loop that the human stopped, or that failed, keeps its window, dead, with its last lines and its items. Only the human's loop-claude <task> starts it again, before any other chunk.
stopped = [window.name for window in windows if window.dead]
chunks = [] if leaving else stopped[:room]