Answer architecture round 1: 0 🔴, 4 🟡 (0 misread); chunks_to_start and the epic's folder take the resolved paths; branch_summaries and reviewer_breaches wait for item 300
CI / tests (pull_request) Successful in 5m19s

This commit is contained in:
2026-12-03 19:45:15 +01:00
parent 55f87fb34e
commit a014e75101
15 changed files with 72 additions and 67 deletions
+12 -14
View File
@@ -17,6 +17,7 @@ from plan.touches import overlaps, predicted, Touches
from loop_state.paths import Paths
from transcript_archive.project_key import project_key
from release_plan.release_standing import project_plan
from project_config.settings import ProjectConfig
from claude_code.transcript import read_transcript
from claude_code.session import Session, session_named, transcript_file
from agent_cycle import tmux
@@ -100,11 +101,8 @@ def clear_of(ours: Touches | Failure | None, theirs: list[Touches | Failure | No
return not theirs or (isinstance(ours, dict) and all(isinstance(touches, dict) and not overlaps(ours, touches) for touches in theirs))
def next_plan(root: str, home: pathlib.Path, env: typing.Mapping[str, str], effects: Effects) -> NextChunk | NoItem | Failure:
"""The plan on the default branch, fetched now where origin answers, with its next item, as chunk-preflight reads it."""
config = located(root, home, env)
if isinstance(config, Failure):
return config
def next_plan(root: str, config: ProjectConfig, effects: Effects) -> NextChunk | NoItem | Failure:
"""The plan config names, on the default branch of the checkout root, fetched now where origin answers, with its next item, as chunk-preflight reads it."""
# A chunk that just merged left the plan on origin. A fetch that fails leaves the plan as last fetched, which chunk-preflight then reads too.
effects.git("fetch", "--quiet", "origin", cwd=root, timeout=FETCH_TIMEOUT)
ref = default_ref(root, FETCH_TIMEOUT, run=effects.git)
@@ -121,13 +119,13 @@ def start_chunks(loop_run: LoopRun, leaving: bool, paths: Paths, env: typing.Map
return config
session = loop_session(loop_run.root, paths.home)
handed = {name: value for name, value in env.items() if name.startswith(HANDED)}
with starting(project_lock(loop_run.root, paths.home, env)) as unlocked:
with starting(project_lock(loop_run.root, paths)) as unlocked:
if unlocked:
return unlocked
windows = tmux.listed(session, effects.tmux)
if refused := refusal(session, windows, loop_run.root, effects.tmux):
return refused
chunks = chunks_to_start(windows, loop_run, leaving, config.parallel_chunks, paths, env, effects)
chunks = chunks_to_start(windows, loop_run, leaving, config, paths, effects)
if isinstance(chunks, AwaitedMerges):
return chunks
for chunk in chunks:
@@ -147,12 +145,12 @@ def refusal(session: str, windows: list[tmux.Listed], root: str, run: tmux.Tmux)
return None
def chunks_to_start(windows: list[tmux.Listed], loop_run: LoopRun, leaving: bool, limit: int, paths: Paths, env: typing.Mapping[str, str], effects: Effects) -> list[str] | AwaitedMerges:
def chunks_to_start(windows: list[tmux.Listed], loop_run: LoopRun, leaving: bool, config: ProjectConfig, paths: Paths, effects: Effects) -> list[str] | AwaitedMerges:
"""The chunks to start beside windows, the session's: the stopped ones room_of restarts, then those of the plan that may_start picks. A plan that cannot be read starts NO_ITEM, as a plan without an item does. AwaitedMerges where no chunk runs or restarts and every item left awaits a person's merge."""
room = room_of(windows, loop_run.chunk, leaving, limit)
room = room_of(windows, loop_run.chunk, leaving, config.parallel_chunks)
if not room.left:
return room.restart
plan = next_plan(loop_run.root, paths.home, env, effects)
plan = next_plan(loop_run.root, config, effects)
if isinstance(plan, Failure):
# Such as in a checkout without a default branch, where chunk-preflight fails too: the worker is told why and finds the facts itself.
say(f"starting a chunk without a plan item, since the plan cannot be read: {plan.reason}", effects)
@@ -164,14 +162,14 @@ def chunks_to_start(windows: list[tmux.Listed], loop_run: LoopRun, leaving: bool
return room.restart + [chunk for chunk in picked if chunk not in room.stopped]
def held_beside(chunk: str, root: str, paths: Paths, env: typing.Mapping[str, str], effects: Effects) -> list[int]:
def held_beside(chunk: str, root: str, paths: Paths, effects: Effects) -> list[int]:
"""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."""
wait_for_starts(root, paths.home, env)
wait_for_starts(root, paths)
others = [window.name for window in tmux.listed(loop_session(root, paths.home), effects.tmux) if window.name != chunk]
return sorted(held_items(others, project_key(root, paths.home), paths.claude_code_transcripts))
def wait_for_starts(root: str, home: pathlib.Path, env: typing.Mapping[str, str]) -> None:
def wait_for_starts(root: str, paths: Paths) -> None:
"""Returns once no loop of the project is starting windows: start_chunks holds the lock file `claims.LOCK` names while it starts them. Where the lock cannot be taken, it returns at once."""
with starting(project_lock(root, home, env)):
with starting(project_lock(root, paths)):
pass