Answer stability round 1: 0 🔴, 6 🟡 (1 misread); name a checkout by its real path, pick a chunk's repo once, test the step line, the repo's model and ladder, and a clone
This commit is contained in:
@@ -73,7 +73,7 @@ Then pick a model with `/model`.
|
||||
|
||||
Link `loop-claude` onto `PATH`: `ln -s ~/.claude/bin/loop-claude ~/.local/bin/loop-claude`. Every claude it starts, the interactive ones included, skips every permission prompt. loop-claude runs each chunk in its own window of a tmux session per project, so it needs tmux 3.2 or later.
|
||||
|
||||
Back up three folders: `~/.claude/loop-claude-transcripts`, where loop-claude keeps every transcript, `~/.claude/do-epic-transcripts`, where do-epic keeps its chunks', and `~/.local/state/larv-review`, where larv-review keeps each chunk's reports. To keep the first and the last small, add a crontab line that gzips each transcript and review file 30 days after it last changed, and logs each run with its date:
|
||||
Back up three folders: `~/.claude/loop-claude-transcripts`, where loop-claude keeps every transcript, `~/.claude/do-epic-transcripts`, where do-epic keeps its chunks' transcripts, and `~/.local/state/larv-review`, where larv-review keeps each chunk's reports. To keep loop-claude's transcripts and the reports small, add a crontab line that gzips each transcript and review file 30 days after it last changed, and logs each run with its date:
|
||||
|
||||
```sh
|
||||
17 4 * * * { date; $HOME/.claude/bin/compress-archives; } >> $HOME/.local/state/compress-archives.log 2>&1
|
||||
@@ -214,7 +214,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
|
||||
- `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes` and `routing_figures`. It imports `reading_cost`'s record path.
|
||||
- `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`.
|
||||
- `deploy_release` imports `release_plan`'s `release_standing`.
|
||||
- `do_epic/` holds `do-epic`, the tool that drives one Jira epic; planning the epic before its chunks start is still to come. `main.py` starts the epic's chunks and runs one chunk's cycles in its window, through `agent_cycle`. `scheduler.py` says which issues run now, under the epic's cap, each repo's `parallel-chunks` and a loop-claude in the repo, and `chunk_prompt.py` words what a chunk's worker reads. `config.py` reads its machine-wide settings, importing `project_config`'s settings and `model_routing`'s ladder file, and `epic_record.py` reads and writes an epic's description by section, language line and cap line, through `record_store`'s `EpicDescription`. `repos.py` finds a repo's checkout and project config by its name, and clones a missing checkout from the host and owner of the epic's other repos, through `forge`'s `url_beside`. `repo_pick.py` asks claude, by `repo-rule.md`, where an epic item is worked, and records the answer as a label on the issue. `split.py` has claude predict from the code which repos an item changes, and files a sub-task per repo under it where there are several. `ranking.py` orders an epic's items by score over one chain of goals, the epic's, then code health, then the item's repo's, through `plan`'s ranking, and re-ranks the tracker's backlog to that order through `backend/`. `backend/` reads, files and ranks the epic's issues, adds the labels `repo_pick.py` and `split.py` record, and posts comments.
|
||||
- `do_epic/` holds `do-epic`, the tool that drives one Jira epic. `main.py` starts the epic's chunks and runs one chunk's cycles in its window, through `agent_cycle`. `scheduler.py` says which issues run now: as many as the epic's cap and each repo's `parallel-chunks` allow, and none in a repo where loop-claude runs chunks. Beside it, `chunk_prompt.py` words what a chunk's worker reads. `config.py` reads its machine-wide settings, importing `project_config`'s settings and `model_routing`'s ladder file, and `epic_record.py` reads and writes an epic's description by section, language line and cap line, through `record_store`'s `EpicDescription`. `repos.py` finds a repo's checkout and project config by its name, and clones a missing checkout from the host and owner of the epic's other repos, through `forge`'s `url_beside`. `repo_pick.py` asks claude, by `repo-rule.md`, where an epic item is worked, and records the answer as a label on the issue. `split.py` has claude predict from the code which repos an item changes, and files a sub-task per repo under it where there are several. `ranking.py` orders an epic's items by score over one chain of goals, the epic's, then code health, then the item's repo's, through `plan`'s ranking, and re-ranks the tracker's backlog to that order through `backend/`. `backend/` reads, files and ranks the epic's issues, adds the labels `repo_pick.py` and `split.py` record, and posts comments.
|
||||
- `forge/` tells a GitHub origin from a Gitea one, names a repo beside an origin's and runs that forge's CLI (`commands.py`), and finds a pull request and waits for its checks (`pulls.py`), for `chunk_preflight`, `chunk_pr`, `deploy_release`, `do_epic` and `larv_review`.
|
||||
- `git_cli/` runs git for every tool (`git_repo.py`), and reads the git calls in a shell command (`git_command.py`).
|
||||
- `judge_replay` imports `agent_cycle`'s judge and verdicts, and `loop_claude`'s premises, records and `ANSWER_DESTINATIONS`.
|
||||
|
||||
@@ -38,7 +38,7 @@ class Talked:
|
||||
|
||||
|
||||
def interrupt(question: str, answer_here: bool, session: WorkerSession, window: tmux.Window, driver: str, effects: Effects) -> str | Talked | Stop:
|
||||
"""Prints question for the human, in window, and returns their answer. While it waits, the window's name ends in tmux.WAITS, and the bell it rings shows in tmux's status bar. The answer: where answer_here, the first line typed at the terminal of driver, the entry point, stripped, or Talked once they typed in the worker's claude session, which TALK opens; else Talked once they typed in that session, which opens at once on the terminal. A Stop where it is off a terminal, or they type no answer, or the input ends."""
|
||||
"""Prints question for the human, in window, and returns their answer. While it waits, the window's name ends in tmux.WAITS, and the bell it rings shows in tmux's status bar. The answer: where answer_here, the first line typed at the terminal of driver, the entry point, stripped, or Talked once they typed in the worker's claude session, which TALK opens; else Talked once they typed in that session, which opens at once on the terminal. A Stop where interrupt runs off a terminal, or they type no answer, or the input ends."""
|
||||
# The bell ends the question's line, so it rings once the question can be read.
|
||||
say(f"\n{question}{tmux.BELL}", effects)
|
||||
on_terminal = effects.on_terminal()
|
||||
|
||||
@@ -19,7 +19,7 @@ LOOP = "loop"
|
||||
EPIC = "epic"
|
||||
# The session option that names the checkout whose chunks the session runs, since two checkouts' keys may map to one session name.
|
||||
OWNER = "@loop-root"
|
||||
# The window option that names the folder a window's chunk works in, so that loop-claude and do-epic each see the chunks the other runs in a checkout.
|
||||
# The window option that names the folder a window's chunk works in, so that loop-claude and every do-epic see the chunks a do-epic runs in a checkout.
|
||||
ROOT = "@chunk-root"
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ def start_window(window: Window, cwd: str, env: typing.Mapping[str, str], comman
|
||||
return Failure(f"tmux could not start the window {window.target}: {done.stderr.strip() or f'it exited {done.returncode}'}")
|
||||
# set-option and show-options read a target as a pane's, so `=session` alone names no session.
|
||||
marked = run(["set-option", "-t", f"={window.session}:", OWNER, cwd]) if first and owned else None
|
||||
# A failure leaves the window unseen by the other entry point, which then may start a chunk beside it; the window still runs.
|
||||
# A failure leaves the window unseen by loop-claude and by another epic's do-epic, which then may start a chunk beside it; the window still runs.
|
||||
run(["set-option", "-w", "-t", done.stdout.strip(), ROOT, cwd])
|
||||
# By the ID, since a window of the same name may still be closing. A failed remain-on-exit doesn't matter: a loop that fails before it is set closes its window, and its stop is still sent as a DM.
|
||||
run(["set-option", "-w", "-t", done.stdout.strip(), "remain-on-exit", "failed"])
|
||||
|
||||
@@ -52,5 +52,5 @@ def delete_session(session: Session) -> Failure | None:
|
||||
try:
|
||||
shutil.rmtree(sibling) if os.path.isdir(sibling) else os.remove(sibling)
|
||||
except OSError as failure:
|
||||
return Failure(f"could not delete {sibling}: {failure.strerror or failure}; delete every file and folder matching {stem}*, then rerun loop-claude; a rerun before that resumes the finished chunk's session")
|
||||
return Failure(f"could not delete {sibling}: {failure.strerror or failure}; delete every file and folder matching {stem}*, then run it again; a run before that resumes the finished chunk's session")
|
||||
return None
|
||||
|
||||
@@ -14,7 +14,6 @@ def task(issue: EpicIssue, epic: str, checkout: str | None) -> str:
|
||||
return f"Work the Jira issue {issue.key} of the epic {epic} as one chunk, {where}. Its summary: {issue.summary}" + (f"\n\nIts description:\n\n{issue.detail}" if issue.detail else "")
|
||||
|
||||
|
||||
# Where code health is stated.
|
||||
CODE_HEALTH = '~/.claude/CLAUDE.md → "Shared goal"'
|
||||
|
||||
|
||||
@@ -22,7 +21,7 @@ def fresh(task: str, premises: str, route: Route, project: ProjectRung | None, f
|
||||
"""A chunk's first prompt. facts is empty: do-epic runs no preflight."""
|
||||
routed = f"{DRIVER} runs you on {route.rung}, routed by the issue's L of {route.likelihood}. Where a sentence below names item {route.item}, it means the issue." if route.item else ""
|
||||
opening = " ".join(filter(None, [routed, *prompts.rung_sentences(DRIVER, route, project)]))
|
||||
return f"{task}\n\nContinue any open draft PR or worktree for the chunk before creating a new one. {prompts.READING_RULE}\n\n{opening and f'{opening}{chr(10)}{chr(10)}'}The issue sets the chunk's scope. The goals below choose between ways to deliver that scope, and never widen it: the epic's first, then code health ({CODE_HEALTH}), then the repo's.\n\nFrom {premises}"
|
||||
return f"{task}\n\nContinue any open draft PR or worktree for the chunk before creating a new one. {prompts.READING_RULE}\n\n{opening and f'{opening}{chr(10)}{chr(10)}'}The issue sets the chunk's scope. The goals below choose between ways to deliver that scope, and never widen it. The epic's goals rank first, then code health ({CODE_HEALTH}), then the repo's.\n\nFrom {premises}"
|
||||
|
||||
|
||||
# The worker names no plan items: the chunk's one item is its issue.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""A Jira epic's description as the record of do-epic, the tool that will drive one epic.
|
||||
"""A Jira epic's description as the record of do-epic, the tool that drives one epic.
|
||||
|
||||
The description holds a language line, a line that caps the chunks running at once, and the sections Goals, Audience, Scoring (the formula and the bar) and Decisions. They are read and written one at a time through `EpicDescription`, and a write leaves every other line of the markdown as it was. Goals and Audience change only where the human approved in an interrupt, which `write_section` takes as `approved`; `EpicDescription` refuses the change otherwise."""
|
||||
import dataclasses
|
||||
@@ -16,6 +16,8 @@ LANGUAGE_LINE = re.compile(r"^\*\*Language:\*\* (.*?)\s*$")
|
||||
# The line that caps how many of the epic's chunks run at once. Three readers, seated as the human who writes an epic's description, picked this spelling from four candidates, 2-1 over `**Parallel chunks:**`, which reads as a count of what runs now.
|
||||
CAP = "**Max parallel chunks:**"
|
||||
CAP_LINE = re.compile(rf"^{re.escape(CAP)}(.*?)\s*$")
|
||||
# A line that opens with CAP's words in another spelling. It is refused, since the epic would otherwise run on the cap of 1 without a word.
|
||||
NEAR_CAP_LINE = re.compile(r"^[\s*_>#-]*max parallel chunks", re.IGNORECASE)
|
||||
|
||||
|
||||
def read_section(text: str, name: str) -> str | Failure:
|
||||
@@ -70,6 +72,8 @@ def parallel_chunks_in(text: str) -> int | Failure:
|
||||
if re.fullmatch(r"[1-9][0-9]*", value):
|
||||
return int(value)
|
||||
return Failure(f"the epic's description caps its chunks with `{CAP} {value}`, which is not a whole number of 1 or more, such as `{CAP} 2`")
|
||||
if not fenced and NEAR_CAP_LINE.match(line):
|
||||
return Failure(f"the epic's description holds the line `{line.strip()}`, which do-epic doesn't read as the epic's cap: write it as a line of its own, spelt `{CAP} 2`")
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
+27
-19
@@ -1,12 +1,13 @@
|
||||
"""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, which loop-claude's cycles share (`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>` 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."""
|
||||
import dataclasses
|
||||
import pathlib
|
||||
import typing
|
||||
|
||||
from loop_claude.loop.chunk_start import archived_route, routed
|
||||
from do_epic import chunk_prompt, scheduler
|
||||
from do_epic.repo_pick import ClaudeWork, HumanTask, recorded, Repo
|
||||
from loop_claude.loop.close import closed_cycle
|
||||
from agent_cycle.run import Cycle, run_cycle
|
||||
from do_epic.config import DoEpicConfig, load
|
||||
@@ -29,7 +30,6 @@ from transcript_archive.project_key import project_key
|
||||
from model_routing.ladder_file import project_ladder_file, read_ladder, SHIPPED
|
||||
from loop_claude.project.premises import read_premises
|
||||
from loop_claude.project.records import read_records
|
||||
from do_epic.repo_pick import recorded, Repo
|
||||
from claude_code.session import session_named
|
||||
from loop_claude.loop.main import setup_version
|
||||
from agent_cycle.stop import Stop
|
||||
@@ -39,11 +39,12 @@ from agent_cycle import tmux
|
||||
HELP = f"""usage: do-epic <EPIC-KEY>
|
||||
|
||||
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 is a chunk once a label names its repo, or names it work without a repo, and nothing blocks it.
|
||||
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.
|
||||
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.
|
||||
The Jira site and its credentials are set in ~/.claude-projects/do-epic/config.toml."""
|
||||
# Under the home folder, where a chunk's cycles are archived, a folder per epic. Apart from loop-claude's archive, whose readers, such as judge-replay and the routing figures, read loop-claude's prompts.
|
||||
# Under the home folder, where a chunk's cycles are archived, a folder per epic. It is not loop-claude's archive, since that archive's readers, such as judge-replay and the routing figures, read loop-claude's prompts.
|
||||
ARCHIVE = ".claude/do-epic-transcripts"
|
||||
|
||||
# The store of an epic's issues and its record, for the epic with this key.
|
||||
@@ -108,7 +109,7 @@ def windows_opened(epic: EpicRun) -> Stop:
|
||||
started = chunks_started(epic, 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 f"started no chunk in the tmux session {epic.session}", epic.effects, stdout=True)
|
||||
say(f"started {', '.join(started.started)} in the tmux session {epic.session}" if started.started else "started no chunk", epic.effects, stdout=True)
|
||||
for wait in started.waits:
|
||||
say(f"{wait.issue} waits: {wait.reason}", epic.effects, stdout=True)
|
||||
if not tmux.listed(epic.session, epic.effects.tmux):
|
||||
@@ -136,7 +137,7 @@ def chunks_started(epic: EpicRun, own: str | None) -> scheduler.Started | Failur
|
||||
if isinstance(found, Failure):
|
||||
return found
|
||||
seen.append(found.checkout)
|
||||
return found.checkout, found.config.parallel_chunks
|
||||
return real(found.checkout), found.config.parallel_chunks
|
||||
|
||||
return scheduler.start_chunks(scheduler.Epic(epic.key, cap, located, epic.paths.home, epic.launcher, epic.env), issues, own, epic.effects.tmux)
|
||||
|
||||
@@ -148,7 +149,7 @@ class RoutingIssue:
|
||||
|
||||
@property
|
||||
def id(self) -> int:
|
||||
"""The number in the issue's key. A Route keeps a number, and one chunk's archive holds one issue, so the project's letters aren't needed to tell it."""
|
||||
"""The number in the issue's key. A Route keeps a number, and one chunk's archive holds one issue, so the number tells the issue without its project's letters."""
|
||||
return int(self.issue.key.rpartition("-")[2])
|
||||
|
||||
@property
|
||||
@@ -160,6 +161,11 @@ class RoutingIssue:
|
||||
return self.issue.scores.get("E", 0) + self.issue.scores.get("I", 0)
|
||||
|
||||
|
||||
def real(checkout: pathlib.Path) -> pathlib.Path:
|
||||
"""The checkout as loop-claude names it, which is as git does: through no symlink or `..`. Each keys the checkout's lock and its chunks by that path, so a project config that spells it another way hides neither from the other."""
|
||||
return checkout.resolve()
|
||||
|
||||
|
||||
def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||
"""Runs the cycles of the chunk of the issue called key until one stops the loop, or the judge rules the chunk finished."""
|
||||
pane = epic.env.get("TMUX_PANE")
|
||||
@@ -168,15 +174,16 @@ def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||
issue = issue_read(key, epic)
|
||||
if isinstance(issue, Stop):
|
||||
return issue
|
||||
root = chunk_root(issue, epic)
|
||||
if isinstance(root, Stop):
|
||||
return root
|
||||
place = chunk_root(issue, epic)
|
||||
if isinstance(place, Stop):
|
||||
return place
|
||||
root, in_repo = place
|
||||
session = session_named(f"A {epic.key} do-epic {key}", epic.paths.claude_code_transcripts)
|
||||
loop = Loop(root=root, session=session, window=tmux.Window(epic.session, key, pane), paths=epic.paths, env=epic.env, launcher=epic.launcher, effects=epic.effects)
|
||||
loop_run = LoopRun(0, root, "", "", chunk=key)
|
||||
while True:
|
||||
loop_run = dataclasses.replace(loop_run, cycle_number=loop_run.cycle_number + 1)
|
||||
cycle = next_cycle(loop_run, loop, epic)
|
||||
cycle = next_cycle(loop_run, loop, in_repo, epic)
|
||||
if isinstance(cycle, Stop):
|
||||
return cycle
|
||||
loop_run = dataclasses.replace(loop_run, task=cycle.task)
|
||||
@@ -200,17 +207,19 @@ def issue_read(key: str, epic: EpicRun) -> EpicIssue | Stop:
|
||||
return found[0] if found else Stop(1, f"{key} is no issue of the epic {epic.key}")
|
||||
|
||||
|
||||
def chunk_root(issue: EpicIssue, epic: EpicRun) -> str | Stop:
|
||||
"""The folder the issue's chunk works in: its repo's checkout, or the epic's folder for work without a repo."""
|
||||
def chunk_root(issue: EpicIssue, epic: EpicRun) -> tuple[str, bool] | Stop:
|
||||
"""The folder the issue's chunk works in, and whether it is a repo's checkout: the epic's folder holds work without a repo. The chunk keeps both to its end, whatever the issue's labels become. The stop where the labels make the issue no chunk."""
|
||||
pick = recorded(issue)
|
||||
if isinstance(pick, Failure):
|
||||
return Stop(1, pick.reason)
|
||||
if not isinstance(pick, Repo):
|
||||
if isinstance(pick, ClaudeWork):
|
||||
folder = epic.paths.home / scheduler.STATE / epic.key
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
return str(folder)
|
||||
return str(folder), False
|
||||
if not isinstance(pick, Repo):
|
||||
return Stop(1, f"{issue.key} is no chunk: {'it is a human\'s task' if isinstance(pick, HumanTask) else 'no label names its repo'}")
|
||||
found = locate(pick.name, [], epic.config, epic.paths.home, epic.effects.git)
|
||||
return Stop(1, found.reason) if isinstance(found, Failure) else str(found.checkout)
|
||||
return Stop(1, found.reason) if isinstance(found, Failure) else (str(real(found.checkout)), True)
|
||||
|
||||
|
||||
def handed_on(key: str, epic: EpicRun) -> Stop:
|
||||
@@ -222,12 +231,11 @@ def handed_on(key: str, epic: EpicRun) -> Stop:
|
||||
return Stop(0, "")
|
||||
|
||||
|
||||
def next_cycle(loop_run: LoopRun, loop: Loop, epic: EpicRun) -> Cycle | Stop:
|
||||
"""The cycle loop_run runs next, from the issue, the premises, the records, the models and the routing ladder read afresh; the stop where one of them cannot be read. A chunk in a repo routes on that repo's model and ladder, and one without a repo on the machine setting's model, `repoless-model`, and the shipped ladder."""
|
||||
def next_cycle(loop_run: LoopRun, loop: Loop, in_repo: bool, epic: EpicRun) -> Cycle | Stop:
|
||||
"""The cycle loop_run runs next, from the issue, the premises, the records, the models and the routing ladder read afresh; the stop where one of them cannot be read. A chunk in a repo routes on that repo's model and ladder, and one without a repo on the machine setting `repoless-model` and the shipped ladder."""
|
||||
issue = issue_read(loop.window.name, epic)
|
||||
if isinstance(issue, Stop):
|
||||
return issue
|
||||
in_repo = isinstance(recorded(issue), Repo)
|
||||
premises = premises_read(loop.root if in_repo else None, epic)
|
||||
if isinstance(premises, Failure):
|
||||
return Stop(1, premises.reason)
|
||||
|
||||
@@ -73,7 +73,7 @@ class Epic:
|
||||
|
||||
|
||||
def chunks(issues: list[EpicIssue]) -> tuple[list[Chunk], list[Waits]]:
|
||||
"""The open issues to work as chunks, in the tracker's rank order, and those that wait. An item split by repo is worked through its sub-tasks, and what blocks it blocks them. A blocker outside the epic blocks, since its state is unknown."""
|
||||
"""The open issues to work as chunks, in the tracker's rank order, and those that wait. An item split by repo is worked through its sub-tasks, and what blocks it blocks them. A blocker outside the epic blocks until the human removes the link, since its state is unknown."""
|
||||
by_key = {issue.key: issue for issue in issues}
|
||||
found: list[Chunk] = []
|
||||
waits: list[Waits] = []
|
||||
@@ -83,6 +83,7 @@ def chunks(issues: list[EpicIssue]) -> tuple[list[Chunk], list[Waits]]:
|
||||
pick = recorded(issue)
|
||||
parent = by_key.get(issue.parent)
|
||||
blocking = [key for key in (*issue.blockers, *(parent.blockers if parent else ())) if key not in by_key or not by_key[key].done]
|
||||
outside = [key for key in blocking if key not in by_key]
|
||||
if isinstance(pick, Failure):
|
||||
waits.append(Waits(issue.key, pick.reason))
|
||||
elif pick is None:
|
||||
@@ -90,7 +91,7 @@ def chunks(issues: list[EpicIssue]) -> tuple[list[Chunk], list[Waits]]:
|
||||
elif isinstance(pick, HumanTask):
|
||||
waits.append(Waits(issue.key, "it is a human's task"))
|
||||
elif blocking:
|
||||
waits.append(Waits(issue.key, f"{' and '.join(blocking)} block{'s' if len(blocking) == 1 else ''} it"))
|
||||
waits.append(Waits(issue.key, f"{' and '.join(blocking)} block{'s' if len(blocking) == 1 else ''} it" + (f"; do-epic cannot see {' and '.join(outside)}, outside the epic, finish: remove such a link in Jira once its issue is done" if outside else "")))
|
||||
else:
|
||||
found.append(Chunk(issue.key, pick.name if isinstance(pick, Repo) else None))
|
||||
return found, waits
|
||||
@@ -106,7 +107,7 @@ def refusal(repo: str, room: RepoRoom) -> str | None:
|
||||
|
||||
|
||||
def start_chunks(epic: Epic, issues: list[EpicIssue], own: str | None, run: tmux.Tmux) -> Started | Failure:
|
||||
"""Starts a do-epic in a new window for each of the epic's chunks that may start now. own is the issue of the chunk that asks, which has finished: it counts as running nowhere, and no stopped chunk starts again. None is the human's `do-epic <EPIC-KEY>`, which restarts each stopped chunk. A Failure says why a window could not start; those before it run."""
|
||||
"""Starts a do-epic in a new window for each of the epic's chunks that may start now. own is the issue of the chunk that asks, which has finished: it counts as running nowhere, and no stopped chunk starts again. Where own is None, the human's `do-epic <EPIC-KEY>` asks, and each stopped chunk starts again. A Failure says why a window could not start; those before it run."""
|
||||
session = tmux.session_name(tmux.EPIC, epic.key)
|
||||
found, waits = chunks(issues)
|
||||
started: list[str] = []
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import contextlib
|
||||
import dataclasses
|
||||
import io
|
||||
import json
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -118,11 +120,12 @@ class ACycleOfAChunkWithoutARepo(DoEpicTest):
|
||||
assert not isinstance(config, Failure)
|
||||
store, record = self.backend(config, "ABC-12")
|
||||
epic = main.EpicRun("ABC-12", config, store, record, paths, env or {}, pathlib.Path("/b/do-epic"), fake.effects())
|
||||
root = main.chunk_root(self.issues[1], epic)
|
||||
assert isinstance(root, str)
|
||||
place = main.chunk_root(self.issues[1], epic)
|
||||
assert isinstance(place, tuple)
|
||||
root, in_repo = place
|
||||
loop = Loop(root=root, session=main.session_named("A ABC-12 do-epic ABC-21", paths.claude_code_transcripts), window=tmux.Window("epic-ABC-12", "ABC-21", "%1"), paths=paths, env=env or {}, launcher=pathlib.Path("/b/do-epic"), effects=fake.effects())
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
found = main.next_cycle(LoopRun(1, root, "", "", chunk="ABC-21"), loop, epic)
|
||||
found = main.next_cycle(LoopRun(1, root, "", "", chunk="ABC-21"), loop, in_repo, epic)
|
||||
assert isinstance(found, main.Cycle), found
|
||||
return found
|
||||
|
||||
@@ -175,7 +178,7 @@ class TheHumansRun(DoEpicTest):
|
||||
fake = FakeEffects()
|
||||
code, out, _ = self.run_main(["ABC-12"], fake)
|
||||
self.assertEqual(code, 0)
|
||||
self.assertIn("started no chunk in the tmux session epic-ABC-12\n", out)
|
||||
self.assertIn("started no chunk\n", out)
|
||||
self.assertNotIn("attach-session", [args[0] for args in fake.tmux_calls])
|
||||
|
||||
def test_stops_without_its_settings_or_on_a_cap_it_cannot_read(self) -> None:
|
||||
@@ -207,6 +210,31 @@ class TheHumansRun(DoEpicTest):
|
||||
self.assertIn("started ABC-20, ABC-22 in the tmux session epic-ABC-12\n", out)
|
||||
self.assertEqual([args[args.index("-c") + 1] for args in fake.tmux_calls if args[0] in ("new-session", "new-window")], [str(self.home / "code/api"), str(self.home / "code/web")])
|
||||
|
||||
def test_clones_a_missing_repo_from_the_host_of_the_repos_located_before_it(self) -> None:
|
||||
for name in ("api", "web"):
|
||||
configured(self, self.home / "code" / name, home=self.home)
|
||||
shutil.rmtree(self.home / "code/web")
|
||||
self.issues = [issue("ABC-20", "repo:api"), issue("ABC-22", "repo:web")]
|
||||
fake = FakeEffects(on_terminal=False, git=["git@host.example:team/api.git", ""])
|
||||
code, out, err = self.run_main(["ABC-12"], fake)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertIn("started ABC-20, ABC-22 in the tmux session epic-ABC-12\n", out)
|
||||
clones = [what for seam, what in fake.calls if seam == "git" and "clone" in what]
|
||||
self.assertEqual([what[what.index("--") + 1:] for what in clones], [["git@host.example:team/web", str(self.home / "code/web")]])
|
||||
|
||||
def test_names_a_checkout_as_loop_claude_does_whatever_way_its_config_spells_it(self) -> None:
|
||||
real = self.home / "code" / "api"
|
||||
real.mkdir(parents=True)
|
||||
(self.home / "work").mkdir()
|
||||
(self.home / "work/api").symlink_to(real)
|
||||
configured(self, self.home / "work/api", home=self.home)
|
||||
self.issues = [issue("ABC-20", "repo:api")]
|
||||
fake = FakeEffects(on_terminal=False)
|
||||
code, _, err = self.run_main(["ABC-12"], fake)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertEqual([args[args.index("-c") + 1] for args in fake.tmux_calls if args[0] == "new-session"], [str(real)])
|
||||
self.assertEqual([args[-2:] for args in fake.tmux_calls if "@chunk-root" in args], [["@chunk-root", str(real)]])
|
||||
|
||||
|
||||
class AChunksRun(DoEpicTest):
|
||||
def worker(self) -> Worker:
|
||||
@@ -231,7 +259,7 @@ class AChunksRun(DoEpicTest):
|
||||
self.assertNotIn("Work the Jira issue", " ".join(streamed[1]))
|
||||
|
||||
def test_every_text_of_a_run_names_do_epic_as_what_drives_it(self) -> None:
|
||||
fake = FakeEffects(streams=[self.worker()] * 3, claude=[judged("unfinished"), judged("interrupt"), judged("finished")], inputs=["Use B."], git=UNREAD)
|
||||
fake = FakeEffects(streams=[self.worker()] * 3, claude=[judged("unfinished", escalation="working"), judged("interrupt"), judged("finished")], inputs=["Use B."], git=UNREAD)
|
||||
code, _, err = self.run_main(["--chunk", "ABC-21", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual(code, 0, err)
|
||||
prompts = [" ".join(what) for seam, what in fake.calls if seam == "stream_claude"]
|
||||
@@ -244,8 +272,10 @@ class AChunksRun(DoEpicTest):
|
||||
self.assertIn("The human answered your question at do-epic's terminal:\nUse B.", prompts[2])
|
||||
for text in judged_with:
|
||||
self.assertIn("what do-epic told it on [loop] lines, latest last:\n", text)
|
||||
self.assertIn(escalation_mark.asks_higher_rung(chunk_prompt.DRIVER), text)
|
||||
self.assertIn("asking do-epic for a higher rung", text)
|
||||
self.assertIn("do-epic in ", fake.dms[0])
|
||||
self.assertNotIn("\n\n[step] ", judged_with[0])
|
||||
self.assertIn("\n\n[step] do-epic stepped the worker up a rung here", judged_with[1])
|
||||
|
||||
def test_stops_for_the_human_after_six_unfinished_cycles_naming_do_epic(self) -> None:
|
||||
fake = FakeEffects(streams=[self.worker()] * 6, claude=[judged("unfinished")] * 6, git=UNREAD)
|
||||
@@ -280,6 +310,64 @@ class AChunksRun(DoEpicTest):
|
||||
self.assertIn("the chunk finished; started no other\n", out)
|
||||
self.assertIn("Squash every merge.", [what[1] for seam, what in fake.calls if seam == "claude"][0])
|
||||
|
||||
def repo_chunk(self) -> pathlib.Path:
|
||||
"""Makes ABC-20 the one issue, a chunk in the repo api whose checkout holds its premises; the folder of the repo's config."""
|
||||
checkout = self.home / "code" / "api"
|
||||
folder = configured(self, checkout, home=self.home)
|
||||
(checkout / "README.md").write_text("## Goals\nServe the API.\n\n## Audience\nIts callers.\n", encoding="utf-8")
|
||||
self.issues = [issue("ABC-20", "repo:api")]
|
||||
return folder
|
||||
|
||||
def test_a_chunk_in_a_repo_routes_on_the_repos_model(self) -> None:
|
||||
folder = self.repo_chunk()
|
||||
models = self.home / ".claude/loop-claude-models.json"
|
||||
models.parent.mkdir(parents=True, exist_ok=True)
|
||||
models.write_text(json.dumps({folder.name: "claude-fable-5-2", "other": "claude-opus-5-5"}), encoding="utf-8")
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD)
|
||||
code, out, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], fake, {"TMUX_PANE": "%1"})
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertIn("=== cycle 1, worker on claude-fable-5-2 at low effort ===\n", out)
|
||||
|
||||
def test_a_chunk_in_a_repo_stops_where_the_repos_ladder_or_records_cannot_be_read(self) -> None:
|
||||
folder = self.repo_chunk()
|
||||
(folder / "routing-ladder.json").write_text("[", encoding="utf-8")
|
||||
code, out, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], FakeEffects(git=UNREAD), MODELS)
|
||||
self.assertEqual((code, out), (1, ""))
|
||||
self.assertIn(f"{folder / 'routing-ladder.json'}", err.strip().splitlines()[-1])
|
||||
(folder / "routing-ladder.json").unlink()
|
||||
(self.home / "code/api/docs/decisions.md").mkdir(parents=True)
|
||||
fake = FakeEffects(git=UNREAD)
|
||||
code, out, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual((code, out), (1, ""))
|
||||
self.assertIn("decisions.md", err.strip().splitlines()[-1])
|
||||
self.assertIn("decisions.md", fake.dms[0])
|
||||
|
||||
def test_an_issue_that_is_a_humans_or_names_no_repo_is_no_chunk(self) -> None:
|
||||
for labels, why in ((("do-epic-human",), "it is a human's task"), ((), "no label names its repo")):
|
||||
with self.subTest(labels):
|
||||
self.issues = [issue("ABC-20", *labels)]
|
||||
fake = FakeEffects(git=UNREAD)
|
||||
code, _, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn(f"ABC-20 is no chunk: {why}\n", err)
|
||||
self.assertEqual([seam for seam, _ in fake.calls if seam == "stream_claude"], [])
|
||||
|
||||
def test_a_chunk_stays_in_its_repo_when_its_labels_change_under_it(self) -> None:
|
||||
self.repo_chunk()
|
||||
store = MemoryEpic("ABC-12", list(self.issues))
|
||||
self.backend = lambda config, key: (store, EpicRecord(Description(self.description))) # type: ignore[method-assign,arg-type]
|
||||
|
||||
class Relabelling(Worker):
|
||||
def __call__(inner, *args: object, **kwargs: object) -> object:
|
||||
store.issues[:] = [issue("ABC-20", "do-epic-claude")]
|
||||
return super().__call__(*args, **kwargs)
|
||||
|
||||
worker = Relabelling(paths_from(self.home).claude_code_transcripts.parent)
|
||||
fake = FakeEffects(streams=[worker, self.worker()], claude=[judged("unfinished"), judged("finished")], git=UNREAD)
|
||||
code, _, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertIn("Serve the API.", [what[1] for seam, what in fake.calls if seam == "claude"][1])
|
||||
|
||||
def test_a_chunk_in_a_repo_without_premises_stops(self) -> None:
|
||||
configured(self, self.home / "code" / "api", home=self.home)
|
||||
self.issues = [issue("ABC-20", "repo:api")]
|
||||
@@ -329,7 +417,7 @@ class WhatAWorkerJudgeAndHumanRead(DoEpicTest):
|
||||
self.assertNotIn("Chunk items:", texts[1])
|
||||
# The worker's prompt and the judge's rules word the request for a higher rung alike, from one place.
|
||||
for text in (texts[0], texts[3]):
|
||||
self.assertIn(escalation_mark.asks_higher_rung(chunk_prompt.DRIVER), text)
|
||||
self.assertIn("asking do-epic for a higher rung", text)
|
||||
self.assertEqual(escalation_mark.asks_higher_rung(chunk_prompt.DRIVER), "asking do-epic for a higher rung")
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,13 @@ class TheCapLine(unittest.TestCase):
|
||||
self.assertEqual(parallel_chunks_in("## Goals\nShip.\n"), 1)
|
||||
self.assertEqual(parallel_chunks_in("```\n**Max parallel chunks:** 3\n```\n"), 1)
|
||||
|
||||
def test_refuses_a_line_that_nearly_spells_the_cap(self) -> None:
|
||||
for line in ("**Max parallel chunks**: 2", "Max parallel chunks: 2", "**max parallel chunks:** 2", "- **Max parallel chunks:** 2"):
|
||||
found = parallel_chunks_in(f"## Goals\nShip.\n{line}\n")
|
||||
assert isinstance(found, Failure), line
|
||||
self.assertEqual(found.reason, f"the epic's description holds the line `{line}`, which do-epic doesn't read as the epic's cap: write it as a line of its own, spelt `**Max parallel chunks:** 2`")
|
||||
self.assertEqual(parallel_chunks_in("We raise the max parallel chunks later.\n```\nMax parallel chunks: 2\n```\n"), 1)
|
||||
|
||||
def test_refuses_a_cap_that_is_no_whole_number_of_1_or_more(self) -> None:
|
||||
for value in ("0", "many", "2.5", "-1", ""):
|
||||
found = parallel_chunks_in(f"**Max parallel chunks:** {value}\n")
|
||||
@@ -57,7 +64,7 @@ class WhichIssuesAreChunks(unittest.TestCase):
|
||||
Waits("ABC-20", "no label names its repo"),
|
||||
Waits("ABC-21", "it is a human's task"),
|
||||
Waits("ABC-22", "ABC-22 is labelled with 2 picks: repo:api, repo:web; remove all but the right one"),
|
||||
Waits("ABC-23", "ABC-20 and XYZ-1 block it"),
|
||||
Waits("ABC-23", "ABC-20 and XYZ-1 block it; do-epic cannot see XYZ-1, outside the epic, finish: remove such a link in Jira once its issue is done"),
|
||||
]))
|
||||
|
||||
def test_what_blocks_a_split_item_blocks_its_sub_tasks(self) -> None:
|
||||
@@ -193,7 +200,7 @@ class TheFirstPrompt(unittest.TestCase):
|
||||
self.assertEqual(chunk_prompt.task(issue("ABC-20"), "ABC-12", "/code/api"), "Work the Jira issue ABC-20 of the epic ABC-12 as one chunk, in the checkout /code/api, on the branch ABC-20. Its summary: Do ABC-20")
|
||||
|
||||
def test_opens_with_the_task_then_the_rung_then_the_premises(self) -> None:
|
||||
rest = f"The issue sets the chunk's scope. The goals below choose between ways to deliver that scope, and never widen it: the epic's first, then code health ({chunk_prompt.CODE_HEALTH}), then the repo's.\n\nFrom P"
|
||||
rest = f"The issue sets the chunk's scope. The goals below choose between ways to deliver that scope, and never widen it. The epic's goals rank first, then code health ({chunk_prompt.CODE_HEALTH}), then the repo's.\n\nFrom P"
|
||||
start = f"T\n\nContinue any open draft PR or worktree for the chunk before creating a new one. {prompts.READING_RULE}\n\n"
|
||||
self.assertEqual(chunk_prompt.fresh("T", "P", Route(Rung("off-the-ladder")), None, ""), start + rest)
|
||||
routed = chunk_prompt.fresh("T", "P", Route(Rung("off-the-ladder"), 21, 3, 5), None, "")
|
||||
|
||||
@@ -52,7 +52,7 @@ def archived_route(archive_folder: pathlib.Path, loop: Loop) -> Route | None:
|
||||
return None
|
||||
route = route_from(worker) if worker else None
|
||||
if worker and route is None:
|
||||
say(f"routing the chunk afresh: the archive's latest Worker: line names no route loop-claude can read: {worker}", loop.effects)
|
||||
say(f"routing the chunk afresh: the archive's latest Worker: line names no route that can be read: {worker}", loop.effects)
|
||||
return route
|
||||
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ def refusal(session: str, windows: list[tmux.Listed], root: str, run: tmux.Tmux)
|
||||
if windows and (owned := tmux.owner(session, 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")
|
||||
if theirs := epic_chunks(root, run):
|
||||
return Failure(f"do-epic runs chunks in {root}: {', '.join(f'{placed.window.name} of {placed.session}' for placed in theirs)}; loop-claude starts none there until they finish")
|
||||
return Failure(f"do-epic runs chunks in {root}: {', '.join(f'{placed.window.name} of {placed.session}' for placed in theirs)}; loop-claude doesn't start a chunk there until those chunks finish")
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -698,7 +698,7 @@ Spent since 2026-09-21T14:13:20Z, in tokens of input, cache write 5m, cache writ
|
||||
self.addCleanup(folder.chmod, 0o700)
|
||||
fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("finished")])
|
||||
stop = run.run_cycle(self.cycle(fake))
|
||||
self.assertEqual(stop, Stop(1, f"could not delete {folder}: Permission denied; delete every file and folder matching {folder}*, then rerun loop-claude; a rerun before that resumes the finished chunk's session"))
|
||||
self.assertEqual(stop, Stop(1, f"could not delete {folder}: Permission denied; delete every file and folder matching {folder}*, then run it again; a run before that resumes the finished chunk's session"))
|
||||
self.assertTrue(session.session_open(self.session))
|
||||
self.assertEqual(self.archived_outcomes(), [f"Task: Do it.\n\n2026-09-21T14:13:20Z Verdict: finished\n\nEvidence:\n> working\n\nConfig: {CONFIG}\nJudge: judge-model\nWorker: {OFF_LADDER}\n\n2026-09-21T14:13:20Z Stopped: {stop.reason}\n\nWorker: {OFF_LADDER}\n"])
|
||||
|
||||
@@ -1289,7 +1289,7 @@ class RouteSources(unittest.TestCase):
|
||||
self.assertIsNone(write.archive(archive, str(transcript), "Do it.", outcomes.stepped_up(WorkerLine('{"model": "claude-opus-5-5", "rung": 3}')), NOW + 1))
|
||||
with contextlib.redirect_stderr(io.StringIO()) as stderr:
|
||||
self.assertIsNone(chunk_start.archived_route(archive, a_loop(FakeEffects().effects(), session=opened)))
|
||||
self.assertEqual(stderr.getvalue(), f'{STAMP} routing the chunk afresh: the archive\'s latest Worker: line names no route loop-claude can read: {{"model": "claude-opus-5-5", "rung": 3}}\n')
|
||||
self.assertEqual(stderr.getvalue(), f'{STAMP} routing the chunk afresh: the archive\'s latest Worker: line names no route that can be read: {{"model": "claude-opus-5-5", "rung": 3}}\n')
|
||||
(chunk,) = archive.iterdir()
|
||||
chunk.chmod(0)
|
||||
try:
|
||||
@@ -1515,7 +1515,7 @@ class StartChunks(unittest.TestCase):
|
||||
|
||||
def test_refuses_a_checkout_do_epic_runs_chunks_in(self):
|
||||
fake = FakeEffects(windows=f"epic-ABC-12\tABC-34 ?\t0\t@4\t{self.root}\nepic-ABC-12\tABC-35\t0\t@5\t/c/other\nepic-ABC-12\tABC-36\t1\t@6\t{self.root}\nloop-x\titem-1\t0\t@7\t{self.root}\n")
|
||||
self.assertEqual(self.start(fake), Failure(f"do-epic runs chunks in {self.root}: ABC-34 of epic-ABC-12; loop-claude starts none there until they finish"))
|
||||
self.assertEqual(self.start(fake), Failure(f"do-epic runs chunks in {self.root}: ABC-34 of epic-ABC-12; loop-claude doesn't start a chunk there until those chunks finish"))
|
||||
self.assertEqual(self.starts(fake), [])
|
||||
|
||||
def test_leaves_out_the_items_a_running_chunk_names_on_its_chunk_items_line(self):
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ Valid while `~/.claude` is a checkout of this repo.
|
||||
- **Ranking.** Score, then Blocked by, in one weight chain: the epic's achieve goals, then code health, then the repo's goals. Where the epic and a repo disagree, the epic wins. do-epic re-ranks Jira's backlog to match, and people's issues keep their rank.
|
||||
- **Releases.** An epic item has no release. It ships into its repo's unreleased work: a bullet under `CHANGELOG.md` → `## Unreleased`, or nothing where the repo's plan is in Jira.
|
||||
- **Repos.** A repo's name is its main checkout's folder name, and a project config names that checkout. A missing checkout is cloned from the host of the epic's other repos; where unsure, do-epic asks. Unsure means the other repos don't all sit under one host and owner (the same host spelt as https and as ssh counts as two), an origin can't be read or isn't an https, ssh or scp-style address, the folder to clone into holds something else, or the clone fails. A repo no config names is cloned into the clone folder, and the human is asked to write its config. Each chunk uses its repo's model, routing, and language for commits and PRs. Jira text is in the epic's language, or else the machine's default.
|
||||
- **Running.** The epic caps the chunks running at once, and each repo's `parallel-chunks` still applies. do-epic and loop-claude never run chunks in the same repo at once. The cap is a line of the epic's description, `**Max parallel chunks:** 2`, and 1 without it, as `parallel-chunks` is; three readers seated as the human who writes the description picked the spelling, 2-1 over `**Parallel chunks:**`. A repo's `parallel-chunks` counts the chunks of every epic in its checkout. Each window is named for its issue's key, and a tmux window option, `@chunk-root`, names the folder its chunk works in, which is how loop-claude sees do-epic's chunks in a checkout. Both hold the checkout's `starting` lock from that check to the start of a window. A chunk without a repo works in `~/.local/state/do-epic/<EPIC-KEY>/`. do-epic archives its cycles under `~/.claude/do-epic-transcripts/`, apart from loop-claude's, whose readers parse loop-claude's prompts. An open issue runs once a label records its repo; until do-epic picks repos itself, an issue without one waits, and `do-epic <EPIC-KEY>` says so.
|
||||
- **Running.** The epic caps the chunks running at once, and each repo's `parallel-chunks` still applies. do-epic and loop-claude never run chunks in the same repo at once. The cap is a line of the epic's description, `**Max parallel chunks:** 2`, and 1 without it, as `parallel-chunks` is. A repo's `parallel-chunks` counts the chunks of every epic in its checkout. Each window is named for its issue's key, and a tmux window option, `@chunk-root`, names the folder its chunk works in, which is how loop-claude sees do-epic's chunks in a checkout. do-epic and loop-claude each hold the checkout's `starting` lock from checking the checkout's chunks to starting a window there. A chunk without a repo works in `~/.local/state/do-epic/<EPIC-KEY>/`. do-epic archives its cycles under `~/.claude/do-epic-transcripts/`, not in loop-claude's archive, whose readers parse loop-claude's prompts. An open issue runs once a label records its repo; until do-epic picks repos itself, an issue without one waits, and `do-epic <EPIC-KEY>` says so.
|
||||
- **Long gates.** A chunk whose PR waits on a gate, such as a human approval, parks. It keeps its worktree, PR and session, and its state is in a file that survives a reboot. A parked chunk takes no running slot, and the items it blocks wait. do-epic polls the forge and resumes the chunk's session when the gate passes or a reviewer comments. It fixes reasonable feedback, replies to the rest, and changes the setup so review would have caught it. `do-epic <key> --status` and the tmux window names show what each chunk waits on.
|
||||
- **Human tasks.** do-epic DMs the human when one blocks the next item, and polls until its issue closes.
|
||||
- **Findings.** A finding about the epic's goals is filed in the epic. A finding about a repo's goals follows that repo's rules. Where unsure which, do-epic asks. A set of new items toward an epic goal needs the human's approval before work starts; a finding filed during a chunk doesn't.
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
|
||||
`Bar = 0.1`
|
||||
|
||||
`Next ID = 441`
|
||||
`Next ID = 442`
|
||||
|
||||
## Items
|
||||
|
||||
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 410 | 0.12.0 | | | **Run `do-epic <EPIC-KEY>`: one tmux session per epic, a window per chunk, up to the epic's cap of running chunks and each repo's `parallel-chunks`, and never in a repo a loop-claude is running chunks in.** | 4 | 2 | 3 | 7 | 6 | 1 by 5 | 0.8 |
|
||||
| 441 | 0.12.0 | 410 | | **Move an epic's issue to done in Jira when its chunk finishes, so no finished chunk starts again and what it blocks starts.** | 2 | 2 | 2 | 4 | 3 | 1 by 6 | 2.3 |
|
||||
| 416 | 0.12.0 | 410 | | **Finish an epic's repo item with a bullet under its repo's `CHANGELOG.md` → `## Unreleased`, or with none where the repo's plan is in Jira.** | 1 | 1 | 1 | 1 | 2 | 1 by 5 | 2.1 |
|
||||
| 413 | 0.12.0 | 410 | | **File a finding about an epic goal in the epic and one about a repo goal by that repo's rules, ask the human where unsure which, and give the judge the epic's records beside the repo's.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 |
|
||||
| 415 | 0.12.0 | 410, 413 | | **Finish an epic: run release-review passes on each repo it changed, work what they file, have the human confirm each goal, post a summary comment, and close the epic in Jira last.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 |
|
||||
@@ -97,6 +98,17 @@ Touches:
|
||||
- `bin/agent_cycle/interrupt.py`
|
||||
- `bin/agent_cycle/stop.py`
|
||||
|
||||
### 441. Move an epic's issue to done in Jira when its chunk finishes, so no finished chunk starts again and what it blocks starts.
|
||||
|
||||
A chunk that finishes leaves its issue open, since `EpicStore` has no way to close one. `scheduler.start_chunks` then counts the issue as a chunk to start: the finished chunk passes over its own issue, but the next chunk that finishes, or the next `do-epic <EPIC-KEY>`, starts it afresh, and an issue it blocks never starts. Both reviewers of item 410's chunk asked about it. Close the issue from `main.handed_on`, before it starts the next chunks, for a chunk in a repo and one without; a Jira workflow that refuses the move stops the chunk with the reason.
|
||||
|
||||
Touches:
|
||||
|
||||
- `bin/do_epic/backend/protocol.py`: `EpicStore`
|
||||
- `bin/do_epic/backend/jira.py`: `JiraEpic`
|
||||
- `bin/do_epic/backend/fake.py`: `MemoryEpic`
|
||||
- `bin/do_epic/main.py`: `handed_on` (small)
|
||||
|
||||
### 416. Finish an epic's repo item with a bullet under its repo's `CHANGELOG.md` → `## Unreleased`, or with none where the repo's plan is in Jira.
|
||||
|
||||
An epic item has no release (`docs/decisions.md` → `do-epic: drives one Jira epic …`). do-epic runs `chunk-pr merge --finish` in the repo's checkout, and picks the flag by the repo's plan type.
|
||||
|
||||
Reference in New Issue
Block a user