Put the release's tools on PATH for every claude the loop starts, and name them bare in the prose #794
@@ -2,6 +2,8 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- do-epic runs `chunk-pr clean` itself for a chunk whose pull request merged, finishes the chunk and closes its window, without a running slot or a worker, where it used to wait for a free slot and a worker for that.
|
||||
- Make `task-bench` commit the copy it runs each side's tests in, so a project's tests that call git, such as `git ls-files`, pass the baseline instead of failing with "not a git repository".
|
||||
- The review sweep before each round now also runs each builtin, flag or option a change adds with a value just outside each input range its docs state, and the product-owner reviewer flags a doc line that leaves out what that run printed.
|
||||
- larv-review fetches each web page that a changed prose claim cites as its source and hands the page to the prose reviewer, which has no web access, so it checks the claim against the page instead of marking it ❓.
|
||||
- The review sweep before each round now also looks for sentences that claim something of every or each member of a set, such as every locale, and fixes the ones a newly added member makes false.
|
||||
|
||||
@@ -273,7 +273,7 @@ loop-claude, do-epic and `task-bench gather` put the release's tools first on th
|
||||
- `main.py` starts the epic's chunks and runs one chunk's cycles in its window, through `agent_cycle`. `epic_run.py` holds what stays the same through one run of do-epic, such as its config, its Jira store and its paths, and starts the chunks that may start now.
|
||||
- `planning.py` settles, before the chunks start, where each open issue is worked, its scores and the order the issues start in, through `split.py`, `repo_pick.py`, `issue_scores.py` and `ranking.py`.
|
||||
- `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.
|
||||
- `gates.py` reads once whether a chunk's pull request waits on its checks, an approval or a new review, and `parked.py` keeps each chunk that does in a state file, so it takes no running slot while it waits and goes on waiting after a reboot. `parking.py` parks such a chunk after a cycle and polls the gate until its worker has something to do.
|
||||
- `gates.py` reads once whether a chunk's pull request waits on its checks, an approval or a new review, and `parked.py` keeps each chunk that does in a state file, so it takes no running slot while it waits and goes on waiting after a reboot. `parking.py` parks such a chunk after a cycle and polls the gate until its worker has something to do, or until its pull request merged, when it removes the worktree with `chunk-pr clean` and finishes the chunk itself.
|
||||
- `chunk_prompt.py` words what a chunk's worker reads. Through `findings.py` that worker files a finding as an issue of the epic, with `--file`, and appends a decision to its description, with `--record-decision`.
|
||||
- `finish.py` ends an epic that holds no open issue: its finishing chunk files a release review of each repo the epic changed, has the human confirm each goal, and with `--close-epic` posts the summary on the epic and closes it.
|
||||
- `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`.
|
||||
|
||||
@@ -38,6 +38,7 @@ class Open:
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Unopened(Open):
|
||||
"""An Open whose worktree stands though no pull request is open at its head: one that was merged or closed, whose chunk still has its worktree to remove."""
|
||||
worktree: str
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -65,7 +66,7 @@ def gate(branch: str, checkout: str, at: typing.Callable[[str], Run], by_human:
|
||||
forge = forge_of(origin)
|
||||
pull = open_pull(forge, branch, head, run)
|
||||
if not isinstance(pull, str):
|
||||
return pull or Unopened(f"no pull request from origin's {branch} is open at {head[:12]}; it may be merged or closed already")
|
||||
return pull or Unopened(f"no pull request from origin's {branch} is open at {head[:12]}; it may be merged or closed already", worktree)
|
||||
decision = review_decision(forge, pull, head, run)
|
||||
if not isinstance(decision, str):
|
||||
return decision or Open(f"pull request #{pull} is a draft")
|
||||
|
||||
+10
-3
@@ -34,8 +34,8 @@ from claude_code.reply import Limited
|
||||
from text_files.markdown_text import listed
|
||||
from do_epic.repos import locate
|
||||
from chunk_driver.this_loop import Loop
|
||||
from do_epic.parking import Merged, parked_through
|
||||
from chunk_driver.project.model_choice import Models, overridden
|
||||
from do_epic.parking import parked_through
|
||||
from chunk_driver.project.premises import read_premises
|
||||
from git_cli.git_repo import record_chunk_base
|
||||
from forge.commands import Run, runner
|
||||
@@ -67,7 +67,7 @@ A chunk whose worker ends its run while its pull request waits on its checks, an
|
||||
is parked: it frees its place for the next chunk, and its window's name says what it awaits. Its worker goes
|
||||
on once the checks pass, the approval comes or a reviewer comments, and a place is free; until one is, the
|
||||
name says `awaits a slot`. In a repo whose config sets `merge = "human"`, a chunk never merges: once its pull
|
||||
request is ready, with nothing else to wait on, the window's name says `awaits your merge`, and its worker goes on once you merged it. A parked chunk survives a reboot: run do-epic <EPIC-KEY> again to go on polling.
|
||||
request is ready, with nothing else to wait on, the window's name says `awaits your merge`. Once you merged it, do-epic removes the chunk's worktree with `chunk-pr clean` and finishes the chunk, without a worker or a place. Where it cannot, as for a pull request closed unmerged or a worktree with uncommitted or untracked files, the worker goes on once a place is free. A parked chunk survives a reboot: run do-epic <EPIC-KEY> again to go on polling.
|
||||
--status doesn't start any chunk. It prints a line per open issue: that its chunk runs or asks you a question, or why it waits, such as the gate a parked chunk awaits and since when.
|
||||
--dry-run runs the planning and the scheduling against the epic as Jira holds it. It doesn't write anything to Jira, start a window or ask a question, and it doesn't start any issue in Jira as a real run's chunk does. It prints each label, sub-task, comment, score and rank move that planning would write, each move of a parent issue whose sub-tasks a person filed, the order the issues would start in, each chunk that would start and why each other issue waits. A sub-task not yet filed shows a key such as ABC-new1. A question planning would ask is printed instead of asked. Planning's claude calls still run.
|
||||
A repo that is missing isn't cloned. Planning then stops there, so its writes are only those made before it, and the issues of that repo wait, and a chunk of another repo may start in the place a real run gives them; a real run would clone it and go on.
|
||||
@@ -265,6 +265,8 @@ def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||
while True:
|
||||
if isinstance(news, Stop):
|
||||
return news
|
||||
if isinstance(news, Merged):
|
||||
return handed_on(key, epic, landed_in(repo, based))
|
||||
run = dataclasses.replace(run, cycle_number=run.cycle_number + 1)
|
||||
cycle = next_cycle(run, loop, repo is not None, epic, news)
|
||||
if isinstance(cycle, Stop):
|
||||
@@ -282,7 +284,7 @@ def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||
news = parked_through(repo, loop, epic, told=news, finished=isinstance(concluded.verdict, Finished), based=based) if repo is not None else ""
|
||||
# A chunk that was parked has work again, whatever the judge ruled before its pull request passed the gate.
|
||||
if isinstance(concluded.verdict, Finished) and news == "":
|
||||
return handed_on(key, epic, Landed.ON_EPIC_BRANCH if based is not None else Landed.ON_DEFAULT_BRANCH if repo is not None else Landed.NOWHERE)
|
||||
return handed_on(key, epic, landed_in(repo, based))
|
||||
|
||||
|
||||
def epic_based(key: str, root: str, epic: EpicRun) -> str | None | Stop:
|
||||
@@ -352,6 +354,11 @@ class Landed(enum.Enum):
|
||||
ON_EPIC_BRANCH = enum.auto()
|
||||
|
||||
|
||||
def landed_in(repo: str | None, based: str | None) -> Landed:
|
||||
"""Where the work of a chunk in the repo called repo landed: on the epic's working branch where based names it, otherwise on the repo's default branch, or nowhere for a chunk without a repo."""
|
||||
return Landed.ON_EPIC_BRANCH if based is not None else Landed.ON_DEFAULT_BRANCH if repo is not None else Landed.NOWHERE
|
||||
|
||||
|
||||
class How(enum.Enum):
|
||||
"""How a finished chunk's issue moves when it doesn't move to a status the config names."""
|
||||
# do-epic neither moves nor awaits it.
|
||||
|
||||
+35
-5
@@ -7,18 +7,26 @@ from do_epic.epic_run import chunks_started, EpicRun, POLL_SECONDS, scheduled_ep
|
||||
from project_config.main import located as config_located
|
||||
from failure import Failure
|
||||
from chunk_driver.this_loop import Loop
|
||||
from loop_state.paths import RELEASE_ROOT
|
||||
from loop_effects.effects import say
|
||||
from agent_cycle.stop import Stop
|
||||
from agent_cycle import tmux
|
||||
|
||||
# How the news for a chunk that was parked opens.
|
||||
DRIVER_PARKED = f"{chunk_prompt.DRIVER} parked the chunk while"
|
||||
# do-epic's PATH holds only what its user linked there, so chunk-pr is run by its path.
|
||||
CHUNK_PR = str(RELEASE_ROOT / "bin" / "chunk-pr")
|
||||
|
||||
|
||||
def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finished: bool, based: str | None) -> str | Stop:
|
||||
"""Keeps the chunk in loop's window parked. Its work is in the repo called repo. It stays parked for as long as its pull request waits on a gate, and returns once its worker has something to do: what to tell that worker, or empty where the chunk was never parked. told is the news its last cycle's worker got, None where the window just started, and finished says the judge ruled the chunk finished. based is the epic's working branch that `epic_based` recorded as the chunk's base when the window started, None where it recorded none. A window that just started parks the chunk only if its file says so: the forge isn't read for a chunk that starts afresh.
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Merged:
|
||||
"""What `parked_through` returns for a chunk whose pull request merged and whose worktree do-epic removed itself: the chunk is finished."""
|
||||
|
||||
Where a person merges, a worker ends its run with the pull request open, so the judge may rule the chunk finished before it is. For such a finished chunk, a gate that cannot be read is read again until it can (`Poll.first_gate`), and what the worker must still do is news (`news_after`).
|
||||
|
||||
def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finished: bool, based: str | None) -> str | Stop | Merged:
|
||||
"""Keeps the chunk in loop's window parked. Its work is in the repo called repo. It stays parked for as long as its pull request waits on a gate, and returns once its worker has something to do: what to tell that worker, or empty where the chunk was never parked. Or Merged, where the chunk's pull request merged and `merged_and_cleaned` removed its worktree: the chunk then needs no worker and no running slot. told is the news its last cycle's worker got, None where the window just started, and finished says the judge ruled the chunk finished. based is the epic's working branch that `epic_based` recorded as the chunk's base when the window started, None where it recorded none. A window that just started parks the chunk only if its file says so: the forge isn't read for a chunk that starts afresh.
|
||||
|
||||
Where a person merges, a worker ends its run with the pull request open, so the judge may rule the chunk finished before it is. For such a finished chunk, a gate that cannot be read is read again until it can (`Poll.first_gate`), and what the worker must still do is news (`news_after`), unless the pull request merged already and do-epic removes the worktree itself.
|
||||
|
||||
A chunk parks in three steps: its file is written, its window is shown as parked, and the epic's next chunks start in the slot it frees. It resumes in the reverse order: `scheduler.resume` gives it a running slot, then its file is removed. So a window that ends in between finds the chunk parked when it starts again.
|
||||
"""
|
||||
@@ -34,6 +42,11 @@ def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finis
|
||||
if key in recorded_as:
|
||||
return resumed_news(poll, recorded_as[key].on, shown=None)
|
||||
entered = None if told is None else poll.first_gate(again=finished)
|
||||
if finished and poll.by_human and isinstance(entered, gates.Unopened):
|
||||
left = merged_and_cleaned(poll, entered)
|
||||
if not isinstance(left, gates.Unopened):
|
||||
return left
|
||||
entered = left
|
||||
if not isinstance(entered, gates.Gate):
|
||||
if isinstance(entered, Failure):
|
||||
say(f"cannot tell whether the chunk's pull request waits on a gate, so the chunk isn't parked: {entered.reason}", epic.effects, stdout=True)
|
||||
@@ -102,12 +115,17 @@ class Poll:
|
||||
return failed
|
||||
|
||||
|
||||
def resumed_news(poll: Poll, on: str, shown: str | None) -> str | Stop:
|
||||
"""Reads the gate of the parked chunk every POLL_SECONDS until its worker has something to do and a running slot is free, then removes its file: what to tell that worker. on is the gate the chunk's file says it is parked on, and shown what its window's name says it awaits, None where nothing yet. A gate that cannot be read leaves the chunk parked as it was."""
|
||||
def resumed_news(poll: Poll, on: str, shown: str | None) -> str | Stop | Merged:
|
||||
"""Reads the gate of the parked chunk every POLL_SECONDS until its worker has something to do and a running slot is free, then removes its file: what to tell that worker. on is the gate the chunk's file says it is parked on, and shown what its window's name says it awaits, None where nothing yet. A gate that cannot be read leaves the chunk parked as it was. A chunk whose pull request merged is Merged at once, without waiting for a slot (`merged_and_cleaned`)."""
|
||||
told = Told(poll, shown)
|
||||
while True:
|
||||
now = poll.gate()
|
||||
if isinstance(now, gates.Open):
|
||||
if isinstance(now, gates.Unopened):
|
||||
left = merged_and_cleaned(poll, now)
|
||||
if not isinstance(left, gates.Unopened):
|
||||
return left
|
||||
now = left
|
||||
full = resumed(poll.repo, poll.loop, poll.epic)
|
||||
if full is None:
|
||||
return unparked(poll, on, now)
|
||||
@@ -140,6 +158,18 @@ class Told:
|
||||
self.reason = reason
|
||||
|
||||
|
||||
def merged_and_cleaned(poll: Poll, unopened: gates.Unopened) -> Merged | Stop | gates.Unopened:
|
||||
"""Runs `chunk-pr clean` in the worktree of a chunk whose pull request is no longer open, and removes the chunk's file once the worktree is gone: Merged then. Where the worktree stands, so that its worker decides, as for a pull request closed unmerged: unopened, its news adding why chunk-pr left it.
|
||||
|
||||
chunk-pr acts only on a pull request the forge reports merged at the commit checked out, and refuses a worktree with uncommitted or untracked files. It removes the worktree before it fails on the main checkout (another branch checked out, uncommitted or untracked files, or commits origin lacks), so a failure with the worktree gone still leaves the chunk merged, and its reason is said."""
|
||||
cleaned = poll.epic.forge_at(unopened.worktree)([CHUNK_PR, "clean"])
|
||||
if isinstance(cleaned, Failure) and gates.worktree_of(poll.key, poll.epic.forge_at(poll.loop.root)) is not None:
|
||||
return dataclasses.replace(unopened, news=f"{unopened.news}; {cleaned.reason}")
|
||||
say(f"pull request merged: removed {unopened.worktree}" + (f", but {cleaned.reason}" if isinstance(cleaned, Failure) else ""), poll.epic.effects, stdout=True)
|
||||
failed = parked.unpark(poll.folder, poll.key)
|
||||
return Stop(1, failed.reason) if failed else Merged()
|
||||
|
||||
|
||||
def unparked(poll: Poll, on: str, now: gates.Open) -> str | Stop:
|
||||
"""Removes the file of the chunk that was parked on the gate on: what to tell its worker, which now says why it resumes."""
|
||||
failed = parked.unpark(poll.folder, poll.key)
|
||||
|
||||
@@ -6,6 +6,7 @@ import unittest
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from do_epic.gates import APPROVAL, CHECKS, gate, Gate, MERGE, NEW_REVIEW, Open, Unmergeable, Unopened
|
||||
from do_epic.parking import CHUNK_PR
|
||||
from failure import Failure
|
||||
|
||||
WORKTREES = "worktree /code/billing\nHEAD aaa\nbranch refs/heads/main\n\nworktree /code/billing-ABC-21\nHEAD abc\nbranch refs/heads/ABC-21\n"
|
||||
@@ -28,7 +29,7 @@ def comment(by: str, at: str) -> dict:
|
||||
class Forge:
|
||||
"""Stands in for git and the forge's CLI in the checkout and the chunk's worktree; `ran` holds each folder a command ran in. Only the CLI of origin's forge answers: `gh` fails on a Gitea origin, and `tea` on a GitHub one."""
|
||||
|
||||
def __init__(self, origin: str = "git@github.com:o/billing.git", pulls: str = f"7\t{HEAD}\tfalse\n", draft: bool = False, decision: str = "REVIEW_REQUIRED", buckets: tuple[str, ...] = ("pass",), threads: tuple[dict, ...] = (), status: str = '{"state": "success", "total_count": 1}', mergeable: str = "MERGEABLE", merge_state: str = "CLEAN", worktrees: str = WORKTREES, fails: str = "", reviews: tuple[dict, ...] = (), comments: tuple[dict, ...] = (), title: str = "Add x", base: str = "main") -> None:
|
||||
def __init__(self, origin: str = "git@github.com:o/billing.git", pulls: str = f"7\t{HEAD}\tfalse\n", draft: bool = False, decision: str = "REVIEW_REQUIRED", buckets: tuple[str, ...] = ("pass",), threads: tuple[dict, ...] = (), status: str = '{"state": "success", "total_count": 1}', mergeable: str = "MERGEABLE", merge_state: str = "CLEAN", worktrees: str = WORKTREES, fails: str = "", reviews: tuple[dict, ...] = (), comments: tuple[dict, ...] = (), title: str = "Add x", base: str = "main", merged: bool = False, clean_fails: str = "") -> None:
|
||||
self.cli = "gh" if "github.com" in origin else "tea"
|
||||
self.ran: list[str] = []
|
||||
self.commands: list[list[str]] = []
|
||||
@@ -39,6 +40,8 @@ class Forge:
|
||||
"git rev-parse": HEAD + "\n",
|
||||
"git symbolic-ref": "origin/main\n",
|
||||
"git config": Failure("git config: unset"),
|
||||
# chunk-pr clean fails unless the forge reports the pull request merged at the worktree's head.
|
||||
f"{CHUNK_PR} clean": Failure(f"chunk-pr clean: {clean_fails}") if clean_fails else "" if merged else Failure("chunk-pr clean: no merged pull request, so its worktree and branch stay"),
|
||||
"gh pr list": pulls,
|
||||
"gh pr view": json.dumps({"isDraft": draft, "reviewDecision": decision, "author": {"login": "worker"}, "reviews": list(reviews), "comments": list(comments), "mergeable": mergeable, "mergeStateStatus": merge_state, "baseRefName": base}),
|
||||
"gh pr checks": json.dumps([{"bucket": bucket} for bucket in buckets]),
|
||||
@@ -185,7 +188,10 @@ class GateOfAChunk(unittest.TestCase):
|
||||
for news, forge in cases.items():
|
||||
with self.subTest(news=news):
|
||||
self.assertEqual(forge.gate(), Open(news))
|
||||
self.assertEqual(Forge(pulls="").gate(), Unopened("no pull request from origin's ABC-21 is open at abcabcabcabc; it may be merged or closed already"))
|
||||
long_head = Forge(pulls="")
|
||||
long_head.answers["git rev-parse"] = "abc" * 13 + "\n"
|
||||
self.assertEqual(long_head.gate(), Unopened("no pull request from origin's ABC-21 is open at abcabcabcabc; it may be merged or closed already", "/code/billing-ABC-21"))
|
||||
self.assertEqual(Forge(pulls="").gate(), Unopened("no pull request from origin's ABC-21 is open at abcabcabcabc; it may be merged or closed already", "/code/billing-ABC-21"))
|
||||
|
||||
def test_a_read_that_fails_is_a_failure_and_says_nothing_of_the_gate(self):
|
||||
for command in ("git worktree", "git remote", "gh pr list", "gh pr view", "gh pr checks", "gh api graphql"):
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import pathlib
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from do_epic.main import Landed, landed_in
|
||||
|
||||
|
||||
class WhereTheWorkOfAFinishedChunkLanded(unittest.TestCase):
|
||||
def test_it_landed_on_the_epics_working_branch_where_the_chunk_has_one(self) -> None:
|
||||
self.assertEqual(landed_in("api", "ABC-12"), Landed.ON_EPIC_BRANCH)
|
||||
|
||||
def test_it_landed_on_the_default_branch_of_a_repo_without_one(self) -> None:
|
||||
self.assertEqual(landed_in("api", None), Landed.ON_DEFAULT_BRANCH)
|
||||
|
||||
def test_a_chunk_without_a_repo_landed_nowhere(self) -> None:
|
||||
self.assertEqual(landed_in(None, None), Landed.NOWHERE)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -12,6 +12,7 @@ import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from do_epic.parking import CHUNK_PR
|
||||
from do_epic import chunk_prompt, epic_run, main, planning
|
||||
from chunk_driver.chunk_run import ChunkRun
|
||||
from project_config.doubles import configured
|
||||
@@ -767,7 +768,7 @@ class AChunkWhosePullRequestWaitsOnAGate(DoEpicTest):
|
||||
|
||||
def test_where_a_person_merges_it_parks_on_that_merge_and_works_again_once_merged(self) -> None:
|
||||
self.repo_config.write_text(self.repo_config.read_text(encoding="utf-8") + 'merge = "human"\n', encoding="utf-8")
|
||||
self.forges = [awaiting(), awaiting(decision="APPROVED"), awaiting(pulls=""), CLEANED]
|
||||
self.forges = [awaiting(), awaiting(decision="APPROVED"), awaiting(pulls=""), awaiting(pulls=""), CLEANED]
|
||||
fake = FakeEffects(streams=[self.worker(), self.worker()], claude=[judged("unfinished"), judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
code, out, err, prompts = self.parked_run(fake)
|
||||
self.assertEqual(code, 0, err)
|
||||
@@ -921,6 +922,72 @@ class AChunkWhosePullRequestWaitsOnAGate(DoEpicTest):
|
||||
self.assertEqual([args[3] for args in fake.tmux_calls if args[0] == "rename-window"], ["ABC-20 awaits an approval", "ABC-20 awaits a slot", "ABC-20"])
|
||||
self.assertEqual(len(prompts), 2)
|
||||
|
||||
def test_a_parked_chunk_whose_pull_request_merged_is_cleaned_and_finished_by_do_epic_though_no_slot_is_free(self) -> None:
|
||||
self.description = DESCRIPTION.replace("2", "1")
|
||||
self.forges = [awaiting(), awaiting(pulls="", merged=True)]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows=PARKED_WINDOW + "ABC-22\t0\t@10\n")
|
||||
code, out, err, prompts = self.parked_run(fake)
|
||||
self.assertEqual((code, len(prompts)), (0, 1), err)
|
||||
self.assertEqual(self.forges[1].commands.count([CHUNK_PR, "clean"]), 1)
|
||||
self.assertEqual({folder for folder, command in zip(self.forges[1].ran, self.forges[1].commands) if command[0] == CHUNK_PR}, {"/code/api-ABC-20"})
|
||||
self.assertFalse(self.file.exists())
|
||||
self.assertEqual([args[3] for args in fake.tmux_calls if args[0] == "rename-window"], ["ABC-20 awaits an approval"])
|
||||
self.assertIn("the chunk finished; ", out)
|
||||
|
||||
def test_where_the_parked_file_of_a_merged_chunk_cannot_be_removed_the_loop_stops(self) -> None:
|
||||
self.forges = [awaiting(), awaiting(pulls="", merged=True)]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=lambda seconds: self.file.parent.chmod(0o555)) # type: ignore[method-assign]
|
||||
self.addCleanup(lambda: self.file.parent.chmod(0o755))
|
||||
code, out, err, prompts = self.parked_run(fake)
|
||||
self.assertEqual((code, len(prompts)), (1, 1))
|
||||
self.assertIn("pull request merged: removed /code/api-ABC-20\n", out)
|
||||
self.assertIn("Permission denied", err)
|
||||
|
||||
def test_a_merged_chunk_whose_clean_failed_after_removing_the_worktree_is_finished_and_the_reason_said(self) -> None:
|
||||
self.forges = [awaiting(), awaiting(pulls="", clean_fails="its main checkout has uncommitted files"), CLEANED]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
code, out, err, prompts = self.parked_run(fake)
|
||||
self.assertEqual((code, len(prompts)), (0, 1), err)
|
||||
self.assertIn("pull request merged: removed /code/api-ABC-20, but chunk-pr clean: its main checkout has uncommitted files\n", out)
|
||||
self.assertFalse(self.file.exists())
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_a_merged_parked_chunk_waits_for_the_move_as_a_finished_one_does(self) -> None:
|
||||
(self.home / ".claude-projects" / "do-epic" / "config.toml").write_text(SETTINGS + 'jira-unblocking-statuses = ["Release Ready", "Shipped"]\njira-automation-moves-issues = true\n', encoding="utf-8")
|
||||
store = MemoryEpic("ABC-12", [*self.issues[:-1], issue("ABC-22", "do-epic-claude", blockers=("ABC-20",))])
|
||||
self.backend = lambda config, key: (store, EpicRecord(Description(self.description))) # type: ignore[method-assign,arg-type]
|
||||
self.forges = [awaiting(), awaiting(pulls="", merged=True)]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
slept: list[float] = []
|
||||
|
||||
def sleep(seconds: float) -> None:
|
||||
slept.append(seconds)
|
||||
if len(slept) == 3:
|
||||
store.change("ABC-20", status="Release Ready")
|
||||
fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=sleep) # type: ignore[method-assign]
|
||||
code, out, err, prompts = self.parked_run(fake)
|
||||
self.assertEqual((code, len(prompts)), (0, 1), err)
|
||||
self.assertEqual([(each.status, each.done) for each in store.issues if each.key == "ABC-20"], [("Release Ready", False)])
|
||||
self.assertIn("ABC-20 is To Do: it waits for the team's automation to move it to Release Ready or Shipped", out)
|
||||
self.assertIn("the chunk finished; started ABC-22\n", out)
|
||||
|
||||
def test_a_parked_chunk_whose_worktree_chunk_pr_keeps_goes_to_a_worker_as_before(self) -> None:
|
||||
self.forges = [awaiting(), awaiting(pulls=""), awaiting(pulls=""), CLEANED]
|
||||
fake = FakeEffects(streams=[self.worker(), self.worker()], claude=[judged("finished"), judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
code, _, err, prompts = self.parked_run(fake)
|
||||
self.assertEqual((code, len(prompts)), (0, 2), err)
|
||||
self.assertEqual(self.forges[1].commands.count([CHUNK_PR, "clean"]), 1)
|
||||
self.assertIn("no pull request from origin's ABC-20 is open", prompts[1].split("\n\n")[0])
|
||||
|
||||
def test_where_a_person_merged_before_the_cycle_closed_a_finished_chunk_is_cleaned_by_do_epic(self) -> None:
|
||||
self.repo_config.write_text(self.repo_config.read_text(encoding="utf-8") + 'merge = "human"\n', encoding="utf-8")
|
||||
self.forges = [awaiting(pulls="", merged=True)]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
code, out, err, prompts = self.parked_run(fake)
|
||||
self.assertEqual((code, len(prompts)), (0, 1), err)
|
||||
self.assertEqual(self.forges[0].commands.count([CHUNK_PR, "clean"]), 1)
|
||||
self.assertIn("the chunk finished; ", out)
|
||||
|
||||
def test_a_chunk_parks_and_resumes_though_the_next_chunk_cannot_start(self) -> None:
|
||||
self.forges = [awaiting(), awaiting(decision="APPROVED")]
|
||||
worker = self.worker()
|
||||
@@ -1132,6 +1199,15 @@ class AnEpicsWorkingBranch(DoEpicTest):
|
||||
self.assertIn("The chunk's pull request goes into the epic's working branch `ABC-12`", prompts[0])
|
||||
self.assertIn(("config", "branch.ABC-20.chunk-base", "ABC-12"), [args for args, _ in self.git_calls])
|
||||
|
||||
def test_a_parked_chunk_whose_pull_request_merged_into_the_branch_gets_its_issue_moved_by_do_epic_as_no_automation_does_it(self) -> None:
|
||||
self.settings('jira-unblocking-statuses = ["Release Ready"]\njira-automation-moves-issues = true\njira-pull-request-open-status = "Code Review"\njira-pull-request-merged-status = "Release Ready"\n')
|
||||
self.forges = [self.recorded(base="ABC-12"), self.recorded(base="ABC-12", pulls="", merged=True)]
|
||||
fake = self.with_git(FakeEffects(streams=[self.worker()], claude=[judged("finished")], windows=PARKED_WINDOW))
|
||||
code, out, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertIn("pull request merged: removed /code/api-ABC-20\n", out)
|
||||
self.assertEqual([write for write in self.store.writes if write.startswith("move ")], ["move ABC-20 to Code Review", "move ABC-20 to Release Ready"])
|
||||
|
||||
def test_a_chunk_parked_on_a_persons_merge_into_the_default_branch_stays_parked_until_its_pull_request_goes_into_the_branch(self) -> None:
|
||||
self.settings('jira-unblocking-statuses = ["Release Ready"]\njira-pull-request-merged-status = "Release Ready"\n')
|
||||
session = main.session_named("A ABC-12 do-epic ABC-20", paths_from(self.home).claude_code_transcripts)
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
import contextlib
|
||||
import io
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
import types
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from do_epic import chunk_prompt
|
||||
from do_epic.parking import CHUNK_PR
|
||||
from do_epic import chunk_prompt, parked
|
||||
from failure import Failure
|
||||
from do_epic.parking import news_after
|
||||
from loop_effects.doubles import FakeEffects
|
||||
from do_epic.parking import Merged, merged_and_cleaned, news_after, Poll
|
||||
from do_epic.gates import Open, Unmergeable, Unopened
|
||||
from agent_cycle.stop import Stop
|
||||
|
||||
UNOPENED = Unopened("no pull request is open")
|
||||
UNOPENED = Unopened("no pull request is open", "/code/api-ABC-20")
|
||||
UNCLEANED = f"{chunk_prompt.DRIVER} keeps the chunk open while its worktree stands: no pull request is open."
|
||||
UNMERGEABLE = Unmergeable("pull request #7 conflicts with its base branch")
|
||||
UNLEVELLED = f"{chunk_prompt.DRIVER} keeps the chunk open while its pull request doesn't merge into its base: pull request #7 conflicts with its base branch."
|
||||
@@ -40,5 +48,61 @@ class TheNewsOfAChunkThatIsNotParked(unittest.TestCase):
|
||||
self.assertEqual(news_after(UNMERGEABLE, finished=True, by_human=True, told=UNLEVELLED), UNLEVELLED)
|
||||
|
||||
|
||||
class TheCleanupOfAChunkWhosePullRequestIsNoLongerOpen(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
made = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(made.cleanup)
|
||||
self.folder = pathlib.Path(made.name)
|
||||
parked.park(self.folder, parked.Parked("ABC-20", "/code/api-ABC-20", "7", "session", "your merge"))
|
||||
self.ran: list[tuple[str, list[str]]] = []
|
||||
self.clean: str | Failure = ""
|
||||
# What `git worktree list` says once chunk-pr clean ran.
|
||||
self.listed = "worktree /code/api\nbranch refs/heads/main\n"
|
||||
effects = FakeEffects().effects()
|
||||
self.poll = Poll("ABC-20", "api", True, self.folder, types.SimpleNamespace(root="/code/api"), types.SimpleNamespace(effects=effects, forge_at=self.forge_at)) # type: ignore[arg-type]
|
||||
|
||||
def forge_at(self, folder: str):
|
||||
def run(command: list[str]) -> str | Failure:
|
||||
self.ran.append((folder, command))
|
||||
return self.clean if command[0] == CHUNK_PR else self.listed
|
||||
return run
|
||||
|
||||
def cleaned(self) -> tuple[Merged | Stop | Unopened, str]:
|
||||
out = io.StringIO()
|
||||
with contextlib.redirect_stdout(out):
|
||||
return merged_and_cleaned(self.poll, UNOPENED), out.getvalue()
|
||||
|
||||
def test_chunk_pr_is_run_by_a_path_that_exists_since_do_epics_path_does_not_hold_it(self) -> None:
|
||||
path = pathlib.Path(CHUNK_PR)
|
||||
self.assertTrue(path.is_absolute() and path.is_file() and os.access(path, os.X_OK), CHUNK_PR)
|
||||
|
||||
def test_a_clean_that_removed_the_worktree_finishes_the_chunk_and_unparks_it(self) -> None:
|
||||
done, out = self.cleaned()
|
||||
self.assertEqual(done, Merged())
|
||||
self.assertIn(" pull request merged: removed /code/api-ABC-20\n", out)
|
||||
self.assertEqual(self.ran[0], ("/code/api-ABC-20", [CHUNK_PR, "clean"]))
|
||||
self.assertEqual(parked.parked_chunks(self.folder), {})
|
||||
|
||||
def test_a_clean_that_failed_with_the_worktree_standing_leaves_the_chunk_to_its_worker(self) -> None:
|
||||
self.clean = Failure("chunk-pr clean: no merged pull request")
|
||||
self.listed = "worktree /code/api\nbranch refs/heads/main\n\nworktree /code/api-ABC-20\nbranch refs/heads/ABC-20\n"
|
||||
done, out = self.cleaned()
|
||||
self.assertEqual((done, out), (Unopened("no pull request is open; chunk-pr clean: no merged pull request", "/code/api-ABC-20"), ""))
|
||||
self.assertEqual(self.ran[1], ("/code/api", ["git", "worktree", "list", "--porcelain"]))
|
||||
self.assertEqual(list(parked.parked_chunks(self.folder)), ["ABC-20"])
|
||||
|
||||
def test_a_clean_that_failed_after_removing_the_worktree_finishes_the_chunk_and_says_why(self) -> None:
|
||||
self.clean = Failure("chunk-pr clean: its main checkout has uncommitted files")
|
||||
done, out = self.cleaned()
|
||||
self.assertEqual(done, Merged())
|
||||
self.assertIn(" pull request merged: removed /code/api-ABC-20, but chunk-pr clean: its main checkout has uncommitted files\n", out)
|
||||
|
||||
def test_a_parked_file_that_cannot_be_removed_stops_the_loop(self) -> None:
|
||||
self.folder.joinpath(parked.FOLDER).chmod(0o555)
|
||||
self.addCleanup(lambda: self.folder.joinpath(parked.FOLDER).chmod(0o755))
|
||||
done, _ = self.cleaned()
|
||||
self.assertEqual(done, Stop(1, f"cannot remove {parked.file_of(self.folder, 'ABC-20')}: Permission denied"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -514,7 +514,7 @@ def benched(bench: Bench, planned: Planner) -> list[str] | Failure:
|
||||
def baseline_failure(bench: Bench) -> Failure | None:
|
||||
"""Why a side's tests don't pass without a task; None where they pass at both sides."""
|
||||
for side, tree in bench.trees.items():
|
||||
ran = tests_in_copy(bench.containers, tree, bench.folder)
|
||||
ran = tests_in_copy(bench.containers, tree, bench.folder, bench.git)
|
||||
if isinstance(ran, Failure) or ran.code:
|
||||
return ran if isinstance(ran, Failure) else failed(f"The tests fail at the {side} without {bench.asked.kind.without}: the test command", ran)
|
||||
return None
|
||||
@@ -630,7 +630,7 @@ def planted_tree(bench: Bench, side: Side, tree: pathlib.Path, path: str, change
|
||||
(tree / path).write_bytes(changed)
|
||||
except OSError as failure:
|
||||
return Failure(f"could not plant the bug in {tree}: {failure}")
|
||||
ran = tests_in_copy(bench.containers, str(tree), bench.folder)
|
||||
ran = tests_in_copy(bench.containers, str(tree), bench.folder, bench.git)
|
||||
# Tests that never end under the bug have no message.
|
||||
if isinstance(ran, TimedOut):
|
||||
return None
|
||||
|
||||
@@ -103,14 +103,15 @@ def committed(git: Git, tree: str) -> Failure | None:
|
||||
return None
|
||||
|
||||
|
||||
def tests_in_copy(containers: Containers, tree: str, folder: pathlib.Path) -> Ran | Failure:
|
||||
"""The test command's run in a copy of tree, removed afterwards, so what the tests write stays out of tree."""
|
||||
def tests_in_copy(containers: Containers, tree: str, folder: pathlib.Path, git: Git) -> Ran | Failure:
|
||||
"""The test command's run in a copy of tree, removed afterwards, so what the tests write stays out of tree. The copy gets a repository
|
||||
of its own with one commit first, since a project's tests may call git and a tree from `git archive` holds none."""
|
||||
copy = folder / "tested"
|
||||
copied = on_disk(f"copy {tree} to test it", lambda: shutil.copytree(tree, copy, symlinks=True))
|
||||
if isinstance(copied, Failure):
|
||||
return copied
|
||||
try:
|
||||
return ran_tests(containers, str(copy))
|
||||
return committed(git, str(copy)) or ran_tests(containers, str(copy))
|
||||
finally:
|
||||
shutil.rmtree(copy, ignore_errors=True)
|
||||
|
||||
|
||||
@@ -298,6 +298,11 @@ class BenchTest(unittest.TestCase):
|
||||
self.assertEqual(log, "task-bench Import\n")
|
||||
self.assertEqual(subprocess.run(["git", "status", "--porcelain"], cwd=tree, env=self.env, check=True, capture_output=True, text=True).stdout, "")
|
||||
|
||||
def test_tests_that_call_git_run_in_a_repository_at_each_side(self):
|
||||
# `git ls-files` fails in a tree that isn't a repository.
|
||||
found = self.bench(**{"--test": "git ls-files --error-unmatch calc.go >/dev/null && sh calc_test.go"})
|
||||
self.assertNotIsInstance(found, Failure, found)
|
||||
|
||||
def test_claude_runs_in_the_benchs_image_on_its_network_with_the_message_alone_and_the_token_by_name(self):
|
||||
self.bench(**{"--runs": "1"})
|
||||
calls = self.calls()
|
||||
@@ -589,7 +594,13 @@ class RunOutcomesTest(unittest.TestCase):
|
||||
|
||||
def test_a_tree_that_cannot_be_copied_for_its_tests_fails_the_bench_naming_it(self):
|
||||
gone = str(self.folder / "gone")
|
||||
self.assertFailsWith(main.tests_in_copy(self.containers(), gone, self.folder), f"could not copy {gone} to test it: ")
|
||||
self.assertFailsWith(main.tests_in_copy(self.containers(), gone, self.folder, self.bench().git), f"could not copy {gone} to test it: ")
|
||||
|
||||
def test_a_copy_that_cannot_be_committed_fails_the_bench_and_is_removed(self):
|
||||
tree = self.folder / "tree"
|
||||
tree.mkdir(exist_ok=True)
|
||||
self.assertFailsWith(main.tests_in_copy(self.containers(), str(tree), self.folder, lambda *args, **given: Failure("no git")), "no git")
|
||||
self.assertFalse((self.folder / "tested").exists())
|
||||
|
||||
def test_a_tree_whose_folder_cannot_be_made_fails_the_bench_naming_it(self):
|
||||
(self.folder / "file").write_text("")
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ Valid while `~/.claude` is a checkout of this repo.
|
||||
- **Releases.** An epic item has no release. It ships into its repo's unreleased work: where the repo publishes something others consume, a bullet under `CHANGELOG.md` → `## Unreleased`, or nothing where the repo's plan is in Jira. The issue is no item of the repo's plan, so the chunk's worker writes the bullet in its branch and runs `chunk-pr merge` without `--finish`.
|
||||
- **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. 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. A gate is a pull request's pending checks or, on GitHub, the approval its branch protection requires; a draft waits on neither, since its worker has yet to mark it ready. On Gitea a draft is a pull request whose title opens with `WIP:` or `[WIP]`, Gitea's default `WORK_IN_PROGRESS_PREFIXES`. Changes a reviewer requested resume the chunk only while that review was made on the pull request's head commit and the pull request's author has not commented or replied after it; once the worker pushed or replied, the chunk parks on a new review, since GitHub keeps the decision until the reviewer reviews again. The chunk's window reads the forge once a minute, which no forge's rate limit notices. A chunk resumes only into a free slot, under the limits a starting chunk meets, and stays parked until then. `do-epic <key>` starts a parked chunk's window again whatever the limits, since the chunk stays parked. do-epic sets `CHUNK_PR_PARKS=1` for each worker, so `chunk-pr merge` fails at once where the pull request awaits an approval, and the worker's run doesn't hold a slot while the pull request waits. In a repo whose config sets `merge = "human"`, the merge itself is a gate: `chunk-pr merge` leaves the pull request ready, the chunk parks on `your merge` once nothing else holds the pull request, and it resumes when the forge no longer reports the pull request open, to clean up and finish. It resumes too once the pull request conflicts with its base branch, or is behind it where GitHub's branch protection requires an up-to-date branch, so the person finds a pull request they can merge. The worker then runs `chunk-pr merge` again, which levels the branch, waits for the checks and leaves the pull request ready. A chunk whose cycle ends on such a pull request is not handed on: its worker is told after each cycle until the pull request merges into its base. While GitHub still computes whether the pull request merges, the chunk stays parked until the next read. Gitea also reports a pull request as not mergeable for the seconds it checks for conflicts. A read in those seconds resumes the chunk for a run that doesn't change anything, which costs less than reading every gate twice to tell the two apart. The judge may rule such a chunk finished while its pull request is open, since its worker ends each run there. So do-epic reads a gate it could not read again before it hands the chunk on, and tells the worker once to remove a worktree whose pull request is no longer open.
|
||||
- **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. A gate is a pull request's pending checks or, on GitHub, the approval its branch protection requires; a draft waits on neither, since its worker has yet to mark it ready. On Gitea a draft is a pull request whose title opens with `WIP:` or `[WIP]`, Gitea's default `WORK_IN_PROGRESS_PREFIXES`. Changes a reviewer requested resume the chunk only while that review was made on the pull request's head commit and the pull request's author has not commented or replied after it; once the worker pushed or replied, the chunk parks on a new review, since GitHub keeps the decision until the reviewer reviews again. The chunk's window reads the forge once a minute, which no forge's rate limit notices. A chunk resumes only into a free slot, under the limits a starting chunk meets, and stays parked until then. `do-epic <key>` starts a parked chunk's window again whatever the limits, since the chunk stays parked. do-epic sets `CHUNK_PR_PARKS=1` for each worker, so `chunk-pr merge` fails at once where the pull request awaits an approval, and the worker's run doesn't hold a slot while the pull request waits. In a repo whose config sets `merge = "human"`, the merge itself is a gate: `chunk-pr merge` leaves the pull request ready, the chunk parks on `your merge` once nothing else holds the pull request, and it gets its gate read again when the forge no longer reports the pull request open, so that its worktree is removed and the chunk finishes. It resumes too once the pull request conflicts with its base branch, or is behind it where GitHub's branch protection requires an up-to-date branch, so the person finds a pull request they can merge. The worker then runs `chunk-pr merge` again, which levels the branch, waits for the checks and leaves the pull request ready. A chunk whose cycle ends on such a pull request is not handed on: its worker is told after each cycle until the pull request merges into its base. While GitHub still computes whether the pull request merges, the chunk stays parked until the next read. Gitea also reports a pull request as not mergeable for the seconds it checks for conflicts. A read in those seconds resumes the chunk for a run that doesn't change anything, which costs less than reading every gate twice to tell the two apart. The judge may rule such a chunk finished while its pull request is open, since its worker ends each run there. So do-epic reads a gate it could not read again before it hands the chunk on, and does the removal itself where it can. For a chunk whose pull request is no longer open, do-epic runs `chunk-pr clean` in the chunk's worktree. That command acts only on a pull request the forge reports merged at the worktree's head, and refuses a worktree with uncommitted or untracked files. Where it removed the worktree, the chunk finishes without a worker and, where it was parked, without a running slot, even if the command then failed on the main checkout, whose reason do-epic says. Where it left the worktree, as for a pull request closed unmerged, do-epic tells the worker once to remove it, and a parked chunk waits for a slot as for any other news.
|
||||
- **Human tasks.** do-epic leaves a human task's issue as the team filed it. The task gets a window of its own while it is open, no issue blocks it, and it blocks another open issue. The window DMs the human once, through the notifier of the first repo whose project config names one (the repos of the issues it holds up come first, then those of the epic's other issues; where none does, the window says so), shows as parked (`awaits a human's task`) so that it doesn't take a running slot, and polls the epic every minute until the task no longer holds up an open issue. Then the issues it held up may start. A window that starts again, as after a reboot, DMs again.
|
||||
- **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.
|
||||
- **Finishing.** When the epic holds no open item: release-review passes on each repo the epic changed, then the items they file, then the human confirms each achieve goal and that no maintain goal has a defect. For a goal that isn't met, do-epic proposes items for approval. Then a summary comment on the epic, and closing the epic in Jira, as the very last step.
|
||||
|
||||
@@ -20,10 +20,8 @@
|
||||
| 483 | 0.18.0 | 482, 484 | owner | **Run every claude the loop starts in a Claude home that the commands generate under `~/.local/share/build-release/` and refresh when the clone's tag changes, with the enabled plugins installed there and the person signed in by `/login` in that home.** | 4 | 2 | 3 | 7 | 7 | 2 by 8 | 0.5 |
|
||||
| 486 | 0.18.0 | 483, 485 | owner | **Open an interactive claude with the setup loaded through one wrapper command, which sets the generated home and `PATH` and passes every argument on to claude.** | 2 | 1 | 1 | 2 | 3 | 2 by 2 | 0.5 |
|
||||
| 577 | 0.18.0 | 483, 486, 575 | owner | **Test in the gate that a container holding only a stock Claude Code runs a chunk from a clone, against a mock Messages API, and that the run leaves the container's own `~/.claude` as it was.** | 3 | 1 | 2 | 4 | 6 | 3 by 9, 2 by 5 | 5.2 |
|
||||
| 571 | 0.18.0 | | | **Make `task-bench` run a project's tests that call git, such as `git ls-files` and `git show :settings.json`, when started from a chunk's worktree, or fail before its first run with a message naming the cause.** | 2 | 1 | 1 | 2 | 3 | 1.1 by 3, 1.4 by 2 | 1.4 |
|
||||
| 576 | 0.18.0 | 485, 575 | owner | **Name the project `dev-factory` in the README, the prose and the tools, and say in the changelog that the repo moved.** | 2 | 2 | 2 | 4 | 4 | 2 by 1, 6 by 1 | 0.4 |
|
||||
| 578 | 0.18.0 | 576, 577 | owner | **Ship one chunk of this repo, to a merged pull request, from a clone of `main` that runs in the generated home, beside the untouched `~/.claude`.** | 1 | 2 | 1 | 2 | 1 | 2 by 4 | 1.2 |
|
||||
| 561 | 0.18.0 | | | **Clean up a do-epic chunk whose pull request has merged without waiting for a running slot, and close its window.** | 2 | 2 | 2 | 4 | 3 | 1.5 by 2 | 0.5 |
|
||||
| 487 | 0.20.0 | 483 | owner | **Run larv-review's passes from a program that picks them from the diff and the item, counts rounds against the cap and decides each rerun, with each reviewer returning its findings as JSON against a schema.** | 4 | 2 | 3 | 7 | 8 | 1.1 by 5, 1.4 by 5 | 0.4 |
|
||||
| 498 | 0.20.0 | 487 | owner | **Drive each chunk as a state machine in `build-release`, from preflight through implementing, review, the pull request and the merge to finishing its items, with the worker as one model step that ends in a result that code checks.** | 4 | 2 | 3 | 7 | 8 | 1.1 by 4, 1.4 by 4 | 0.3 |
|
||||
| 488 | 0.20.0 | 498 | owner | **Cut the larv-review skill, `CLAUDE.md` and rule-hook down to what `build-release` doesn't own: the judgement the model makes and the safety guards.** | 2 | 2 | 3 | 5 | 5 | 1.4 by 4, code health by 2 | 2.3 |
|
||||
@@ -598,24 +596,6 @@ Touches:
|
||||
- `.gitignore`
|
||||
- `README.md`: `## Test` (small)
|
||||
|
||||
### 571. Make `task-bench` run a project's tests that call git, such as `git ls-files` and `git show :settings.json`, when started from a chunk's worktree, or fail before its first run with a message naming the cause.
|
||||
|
||||
Found while finishing item 565's chunk: `task-bench`, started from the chunk's worktree with `CLAUDE_CODE_OAUTH_TOKEN` exported, failed its baseline. Inside the container, this repo's tests failed with "not a git repository": `git ls-files` exited 128, and `git show :settings.json` failed. The chunk recorded no bench figures.
|
||||
|
||||
The cause is not verified, so the first step is to reproduce it: run the bench once from a worktree and once from the main checkout. Two causes fit:
|
||||
|
||||
- A worktree's `.git` is a file that points at the main checkout's git folder, which the container doesn't mount.
|
||||
- More likely from the code: `archived` in `bin/task_bench/main.py` builds each side's tree with `git archive`, which leaves out `.git`. `baseline_failure` then tests that tree through `tests_in_copy` before `committed` has given it a repository. So any test that calls git, such as `bin/repo_checks/test_settings.py`, `test_import_order.py` and `test_citations.py`, would fail from the main checkout too.
|
||||
|
||||
Where the second cause holds, give each side's tree a repository with its files staged and committed (`committed` in `bin/task_bench/tasks.py` already does this for a planted tree) before its tests run. Then the copy `tests_in_copy` makes carries it. Either way, write first a test in `bin/task_bench/test_task_bench.py` that fails today. Where no fix fits, fail before the first run, naming the cause.
|
||||
|
||||
`Planner` in `bin/task_bench/main.py:241` is a place the comprehension seats found hard. Leave it alone unless the change touches it; if it does, make it easier to read.
|
||||
|
||||
Touches:
|
||||
- `bin/task_bench/main.py`: `bench_in`, `archived` (small)
|
||||
- `bin/task_bench/tasks.py`: `committed`, `tests_in_copy` (small)
|
||||
- `bin/task_bench/test_task_bench.py`
|
||||
|
||||
### 576. Name the project `dev-factory` in the README, the prose and the tools, and say in the changelog that the repo moved.
|
||||
|
||||
Part of the standalone-install plan lilleman approved on 2026-11-20, as reshaped on 2026-12-03 when 0.18.0 was planned. Split from item 496, which keeps the renames that wait for the harness interface, such as `CLAUDE.md`. Renaming the repo on the forge is lilleman's, and it changes every clone's remote. A project's key comes from its clone's folder name, and tmux session names from the key, so say in the changelog what renaming the clone's folder changes. Revise the decision "names", which still says the code keeps today's names and calls harness independence an open aim: it is goal 6.
|
||||
@@ -660,22 +640,6 @@ Touches:
|
||||
|
||||
- `README.md`
|
||||
|
||||
### 561. Clean up a do-epic chunk whose pull request has merged without waiting for a running slot, and close its window.
|
||||
|
||||
Today a parked chunk whose pull request is no longer open (`gates.Unopened`, `bin/do_epic/gates.py`) gets news for its worker to remove the worktree (`parking.news_after`). That worker needs a running slot, so behind the epic's `**Max parallel chunks:**` cap or the repo's `parallel-chunks`, the chunk stays parked with "it may be merged or closed already, but the chunk stays parked", and its window lingers for days. On a team epic, the issue of one such chunk was already Done while its window still read "awaits a slot". The person reads that as stuck work, and once a slot frees, a whole worker run goes to `chunk-pr clean`.
|
||||
|
||||
Fix: where the pull request has merged and the worktree holds nothing the branch on origin lacks, do-epic runs `chunk-pr clean` in the worktree itself, finishes the chunk as a merged one, starts what it unblocks, and closes the window, taking no slot. A pull request closed unmerged, or a worktree with unpushed work, still goes to a worker as today.
|
||||
|
||||
Touches:
|
||||
|
||||
- `bin/do_epic/gates.py`: `Unopened`, `gate` (small)
|
||||
- `bin/do_epic/parking.py`: `parked_through`, `news_after`, `resumed_news`
|
||||
- `bin/do_epic/main.py`: `HELP` (small), `chunk_run` (small)
|
||||
- `bin/do_epic/test_gates.py`
|
||||
- `bin/do_epic/test_parking.py`
|
||||
- `bin/do_epic/test_main.py`: `AChunkWhosePullRequestWaitsOnAGate`
|
||||
- `README.md`: `#### Driving chunks` (small)
|
||||
|
||||
### 487. Run larv-review's passes from a program that picks them from the diff and the item, counts rounds against the cap and decides each rerun, with each reviewer returning its findings as JSON against a schema.
|
||||
|
||||
Part of the standalone-install plan lilleman approved on 2026-11-20. It applies the decision `loop: a step whose result a program can check …` in `docs/decisions.md`. The reviewer briefs stay prose. Start here, since larv-review holds the most sequencing rules.
|
||||
|
||||
Reference in New Issue
Block a user