Plan an epic's open issues before do-epic starts chunks
This commit is contained in:
+14
-5
@@ -1,6 +1,6 @@
|
||||
"""The do-epic command (docs/decisions.md → `do-epic: drives one Jira epic …`).
|
||||
|
||||
`do-epic <EPIC-KEY>` 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`): 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.
|
||||
|
||||
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
|
||||
@@ -9,7 +9,8 @@ import sys
|
||||
import typing
|
||||
|
||||
from loop_claude.loop.chunk_start import archived_route, routed
|
||||
from do_epic import chunk_prompt, findings, finish, gates, parked, scheduler, split, status
|
||||
from do_epic import chunk_prompt, findings, finish, gates, parked, planning, scheduler, split, status
|
||||
from claude_code.reply import Limited
|
||||
from do_epic.repo_pick import ClaudeWork, HumanTask, recorded, Repo
|
||||
from loop_claude.loop.close import closed_cycle
|
||||
from project_config.main import located as config_located
|
||||
@@ -46,8 +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>.
|
||||
An open issue of the epic runs as a chunk once it has a label and no issue blocks it.
|
||||
The label names the issue's repo, or says the work changes no repo.
|
||||
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.
|
||||
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
|
||||
@@ -151,8 +156,12 @@ 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: 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."""
|
||||
"""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."""
|
||||
issues = epic.store.read()
|
||||
if not isinstance(issues, Failure):
|
||||
issues = planning.planned(planning.Planned(epic.key, epic.config, epic.store, epic.record, epic.paths.home, epic.effects), issues)
|
||||
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(started, Failure):
|
||||
return Stop(1, started.reason)
|
||||
|
||||
Reference in New Issue
Block a user