Answer stability round 1: 0 🔴, 5 🟡 (1 misread); start chunks after a partial planning and keep what planning wrote

This commit is contained in:
2026-11-19 04:46:55 +01:00
parent 999fca6f17
commit 0ce3cc6ac6
10 changed files with 192 additions and 84 deletions
+16 -11
View File
@@ -1,6 +1,6 @@
"""The do-epic command (docs/decisions.md → `do-epic: drives one Jira epic …`).
`do-epic <EPIC-KEY>` first plans the epic's open issues (`planning`): it splits each by repo, picks the repo of each that no label places, and re-ranks the loop's issues. Then it starts each of the epic's chunks that may start now, each in a window of the epic's tmux session, as `scheduler` picks them, and puts that session on the terminal. Each window runs `do-epic --chunk <ISSUE-KEY> <EPIC-KEY>`: the cycles of one issue's chunk, run by the code that runs loop-claude's (`agent_cycle`), until the judge rules it finished. Then it starts the chunks that may start now, and its window closes.
`do-epic <EPIC-KEY>` first plans the epic's open issues (`planning`): each that no label places is split by repo or gets its pick, and the scored issues do-epic filed are re-ranked. Then it starts each of the epic's chunks that may start now, each in a window of the epic's tmux session, as `scheduler` picks them, and puts that session on the terminal. Each window runs `do-epic --chunk <ISSUE-KEY> <EPIC-KEY>`: the cycles of one issue's chunk, run by the code that runs loop-claude's (`agent_cycle`), until the judge rules it finished. Then it starts the chunks that may start now, and its window closes.
After each cycle of a chunk in a repo, the window reads what the chunk's pull request waits on (`gates`). While that is a gate only time or a person passes, the chunk is parked (`parked`): the window frees its running slot and polls the forge, and the chunk's next cycle starts once the worker has something to do and a slot is free. `do-epic <EPIC-KEY> --status` prints what each open issue does."""
import dataclasses
@@ -47,12 +47,12 @@ HELP = f"""usage: do-epic <EPIC-KEY> [--status]
{finish.USAGE}
Runs the chunks of one Jira epic, such as ABC-12, each in its own window of the tmux session epic-<EPIC-KEY>.
Before it starts chunks, do-epic <EPIC-KEY> plans each open issue that no label places: it files a sub-task
per repo where the issue changes several, and else labels it `repo:<name>` for its repo, `do-epic-claude`
for work of Claude's that changes no repo, or `do-epic-human` for a task of yours, as repo-rule.md says.
Where the rule leaves that unclear, it asks you on the terminal, and you answer with the label.
It then ranks the issues it filed that hold scores, by the `Score = ...` line under the epic's ## Scoring.
An open issue runs as a chunk once it has such a label and no issue blocks it.
Before it starts chunks, do-epic <EPIC-KEY> plans each open issue that has none of these labels:
`repo:<name>` for its repo, `do-epic-claude` for work of Claude's that changes no repo, `do-epic-human` for a task of yours.
Where such an issue changes several repos, it files a sub-task per repo. Otherwise it gives the issue its label, as repo-rule.md says.
Where the rule leaves the label unclear, it asks you on the terminal. Answer with the label, or with Enter alone to leave the issue waiting.
It then puts the scored issues that do-epic itself filed in order of score, by the `Score = ...` line under the epic's ## Scoring.
An open issue labelled `repo:<name>` or `do-epic-claude` runs as a chunk once no issue blocks it.
As many run at once as the epic's description allows with a line such as `**Max parallel chunks:** 2`, one where it has none.
A repo takes as many chunks as its `parallel-chunks`, and none while loop-claude runs chunks in it.
A chunk whose worker ends its run while its pull request waits on its checks, an approval or a new review
@@ -158,10 +158,15 @@ def epic_written(key: str, writes: tuple[str, str, tuple[str, ...]] | None, path
def windows_opened(epic: EpicRun) -> Stop:
"""What the do-epic the human runs does: plans the open issues (`planning`), starts each chunk that may start now, says why each other open issue waits, then puts the epic's session on the terminal until the human detaches."""
read = epic.store.read()
issues = read if isinstance(read, Failure) else planning.planned(planning.Planned(epic.key, epic.config, epic.store, epic.record, epic.paths.home, epic.effects), read)
if isinstance(issues, Limited):
return Stop(1, f"the epic is not planned, so no chunk started: {issues.said}")
started = issues if isinstance(issues, Failure) else chunks_started(epic, issues, None)
if isinstance(read, Failure):
return Stop(1, read.reason)
issues, stopped = planning.planned(planning.Planned(epic.key, epic.config, epic.store, epic.record, epic.paths.home, epic.effects), read)
if isinstance(stopped, Limited):
return Stop(1, f"the epic is not planned, so no chunk started: {stopped.said}")
if stopped is not None:
# One issue or repo that cannot be planned holds back only itself: each chunk that may start still does.
say(f"the epic {epic.key} is not planned in full: {stopped.reason}", epic.effects)
started = chunks_started(epic, issues, None)
if isinstance(started, Failure):
return Stop(1, started.reason)
say(f"started {', '.join(started.started)} in the tmux session {epic.session}" if started.started else "started no chunk", epic.effects, stdout=True)