From 4778a54b6cb7d10ec4c9fc6260f9e8a108992899 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 01:53:32 +0100 Subject: [PATCH 01/11] DM the human when a human-task issue blocks the epic's next item, and poll until it closes --- README.md | 2 +- bin/do_epic/human_tasks.py | 41 +++++++++++++ bin/do_epic/main.py | 21 ++++--- bin/do_epic/scheduler.py | 42 +++++++++++--- bin/do_epic/test_human_tasks.py | 100 ++++++++++++++++++++++++++++++++ bin/do_epic/test_main.py | 18 +++--- bin/do_epic/test_scheduler.py | 23 ++++++++ docs/decisions.md | 2 +- docs/reading-cost.md | 11 ++++ 9 files changed, 233 insertions(+), 27 deletions(-) create mode 100644 bin/do_epic/human_tasks.py create mode 100644 bin/do_epic/test_human_tasks.py diff --git a/README.md b/README.md index 11cc9134..bcb01a5c 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ The last line prints each setting's path once the config is complete. `do-epic` keeps its settings per machine, not per project, in `~/.claude-projects/do-epic/`, two files for every epic: - `config.toml` sets `jira-url`, the site, such as `https://acme.atlassian.net`; `env-file`, the file holding `ATLASSIAN_EMAIL` and `ATLASSIAN_API_TOKEN`, a path that starts with `/` or `~/`, outside the clone folder and every folder of `~/.claude-projects`; and `repoless-model`, the model that works an item with no repo. It may also set `clone-folder`, where a missing repo is cloned, `~/code` if left out; `language`, the language of Jira text, English if left out; and `jira-finish-transition` with `jira-finish-status`, which name the workflow transition that closes a finished epic and the status it leads to, such as `"Mark as done"` and `"Done"`. Set both or neither: without them do-epic closes no epic. -- `repo-rule.md` is prose that says how to tell an item's repo, such as "a label that equals a repo's name names that repo". It may not be blank. do-epic doesn't read it yet: until it picks each item's repo from the rule, an issue runs once a label `repo:` records its repo, `do-epic-claude` marks work of Claude's that changes no repo, and `do-epic-human` a task of yours. +- `repo-rule.md` is prose that says how to tell an item's repo, such as "a label that equals a repo's name names that repo". It may not be blank. do-epic doesn't read it yet: until it picks each item's repo from the rule, an issue runs once a label `repo:` records its repo, `do-epic-claude` marks work of Claude's that changes no repo, and `do-epic-human` a task of yours. An open task of yours that blocks another issue gets a tmux window that DMs you once and reads the issue every minute; once you close it, the issues it blocked may start. do-epic never edits the issue. Each repo an epic changes has a project config of its own, as in the rest of this section. `do-epic` fails and names each setting or file that is missing or invalid. diff --git a/bin/do_epic/human_tasks.py b/bin/do_epic/human_tasks.py new file mode 100644 index 00000000..fde88f48 --- /dev/null +++ b/bin/do_epic/human_tasks.py @@ -0,0 +1,41 @@ +"""A human's task that holds up other issues of an epic (docs/decisions.md → `do-epic: drives one Jira epic …`, "Human tasks"). + +do-epic leaves the issue as the team filed it. While it is open and blocks an open issue, its window DMs the human once, shows itself as parked so that it takes no running slot, and reads the epic every `poll` seconds. Once the issue is closed, or blocks nothing any more, the window ends, and the chunks it held up may start. A window that starts again, as after a reboot, DMs again.""" +from agent_cycle import tmux +from agent_cycle.direct_message import tell +from do_epic import scheduler +from do_epic.backend.protocol import EpicIssue, EpicStore +from failure import Failure +from loop_effects.effects import Effects, say + +# What the window of a human's task awaits, in its name. +AWAITS = "a human's task" + + +def holds_up(key: str, issues: list[EpicIssue]) -> list[str]: + """The keys of the open issues that the human's task called key holds up; none where it is no such task, or is closed.""" + if not any(chunk.human and chunk.issue == key for chunk in scheduler.chunks(issues)[0]): + return [] + return scheduler.held_up(issues)[key] + + +def message(task: EpicIssue, epic: str, held: list[str]) -> str: + return f"do-epic {epic} awaits you: {task.key}, \"{task.summary}\", blocks {' and '.join(held)}. It goes on once you close {task.key} in Jira." + + +def awaited(task: EpicIssue, epic: str, store: EpicStore, window: tmux.Window, poll: int, effects: Effects) -> None: + """Waits in window for the human to close the human's task `task` of the epic called epic, and returns once it holds up no issue. A read of the epic that fails is said once and tried again.""" + told, said = False, None + while True: + issues = store.read() + if isinstance(issues, Failure): + if issues.reason != said: + say(f"cannot read the epic, so cannot tell whether {task.key} is closed; trying again every {poll} seconds: {issues.reason}", effects, stdout=True) + said = issues.reason + elif not (held := holds_up(task.key, issues)): + return + elif not told: + tell(message(task, epic, held), effects) + tmux.park(window, AWAITS, effects.tmux) + told = True + effects.sleep(poll) diff --git a/bin/do_epic/main.py b/bin/do_epic/main.py index fb08fae4..6421eb19 100644 --- a/bin/do_epic/main.py +++ b/bin/do_epic/main.py @@ -9,7 +9,7 @@ import sys import typing from loop_claude.loop.chunk_start import archived_route, routed -from do_epic import chunk_prompt, findings, finish, gates, parked, scheduler +from do_epic import chunk_prompt, findings, finish, gates, human_tasks, parked, scheduler from do_epic.repo_pick import ClaudeWork, HumanTask, recorded, Repo from loop_claude.loop.close import closed_cycle from loop_claude.project.records import CONSEQUENCE, read_records @@ -46,6 +46,7 @@ HELP = f"""usage: do-epic [--status] Runs the chunks of one Jira epic, such as ABC-12, each in its own window of the tmux session epic-. An open issue of the epic runs as a chunk once it has a label and no issue blocks it. +A `do-epic-human` issue that blocks another gets a window too: it DMs you once and waits, with no running slot, until you close the issue in Jira. 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. @@ -230,7 +231,14 @@ def chunk_run(key: str, epic: EpicRun) -> Stop: pane = epic.env.get("TMUX_PANE") if not pane: return Stop(1, f"{scheduler.CHUNK_FLAG} is how do-epic starts itself in a tmux window; run do-epic ") - place = chunk_root(key, epic) + # None for the epic's finishing, which is no issue. + issue = None if key == epic.key else issue_read(key, epic) + if isinstance(issue, Stop): + return issue + if issue and isinstance(recorded(issue), HumanTask): + human_tasks.awaited(issue, epic.key, epic.store, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.effects) + return handed_on(key, epic) + place = chunk_root(key, issue, epic) if isinstance(place, Stop): return place root, repo = place @@ -331,11 +339,8 @@ 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(key: str, epic: EpicRun) -> tuple[str, str | None] | Stop: - """The folder the chunk called key works in, and the name of the repo whose checkout it is: None for the epic's folder, which holds work without a repo, as the epic's finishing is. The chunk keeps both to its end, whatever its issue's labels become. The stop where the labels make the issue no chunk.""" - issue = None if key == epic.key else issue_read(key, epic) - if isinstance(issue, Stop): - return issue +def chunk_root(key: str, issue: EpicIssue | None, epic: EpicRun) -> tuple[str, str | None] | Stop: + """The folder the chunk called key works in, and the name of the repo whose checkout it is: None for the epic's folder, which holds work without a repo, as the epic's finishing is, and its issue is None. The chunk keeps both to its end, whatever its issue's labels become. The stop where the labels make the issue no chunk.""" pick = recorded(issue) if issue else ClaudeWork() if isinstance(pick, Failure): return Stop(1, pick.reason) @@ -344,7 +349,7 @@ def chunk_root(key: str, epic: EpicRun) -> tuple[str, str | None] | Stop: folder.mkdir(parents=True, exist_ok=True) return str(folder), None if not isinstance(pick, Repo): - return Stop(1, f"{key} is no chunk: {'it is a human\'s task' if isinstance(pick, HumanTask) else 'no label names its repo'}") + return Stop(1, f"{key} is no chunk: 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(real(found.checkout)), pick.name) diff --git a/bin/do_epic/scheduler.py b/bin/do_epic/scheduler.py index af65b832..93b02e4d 100644 --- a/bin/do_epic/scheduler.py +++ b/bin/do_epic/scheduler.py @@ -19,6 +19,8 @@ from agent_cycle import tmux # Under the home folder, a folder per epic key holds the epic's LOCK. A chunk without a repo works there. STATE = ".local/state/do-epic" +# Why a human's task with a live window waits, as the epic's status says. +HUMAN_WAIT = "it is a human's task; do-epic polls until its issue closes" # The flag that tells the do-epic in a window its chunk, as `--chunk ABC-34 ABC-12`. Nobody types it, so no panel picked it. CHUNK_FLAG = "--chunk" @@ -29,6 +31,8 @@ class Chunk: issue: str # The name of the repo it changes; None for work without a repo. repo: str | None + # Whether it is a human's task that holds up another open issue: its window only waits for the human to close the issue (`human_tasks`), and takes no running slot. + human: bool = False @dataclasses.dataclass(frozen=True) @@ -76,22 +80,41 @@ class Epic: return self.home / STATE / self.key -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 until the human removes the link, since its state is unknown.""" +def open_blockers(issue: EpicIssue, by_key: dict[str, EpicIssue]) -> list[str]: + """The keys of the issues that block issue, or its parent, that are not done. A blocker outside the epic counts, since its state is unknown.""" + parent = by_key.get(issue.parent) + return [key for key in (*issue.blockers, *(parent.blockers if parent else ())) if key not in by_key or not by_key[key].done] + + +def held_up(issues: list[EpicIssue]) -> dict[str, list[str]]: + """For each issue that blocks an open issue to work as a chunk, the keys of the open issues it blocks, in the tracker's rank order.""" by_key = {issue.key: issue for issue in issues} + held: dict[str, list[str]] = {} + for issue in issues: + if not issue.done and SPLIT_LABEL not in issue.labels: + for key in open_blockers(issue, by_key): + held.setdefault(key, []).append(issue.key) + return held + + +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 until the human removes the link, since its state is unknown. A human's task is a chunk only while it holds up another issue and nothing holds it up: its window waits for the human.""" + by_key = {issue.key: issue for issue in issues} + holding = held_up(issues) found: list[Chunk] = [] waits: list[Waits] = [] for issue in issues: if issue.done or SPLIT_LABEL in issue.labels: continue 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] + blocking = open_blockers(issue, by_key) 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: waits.append(Waits(issue.key, "no label names its repo")) + elif isinstance(pick, HumanTask) and not blocking and issue.key in holding: + found.append(Chunk(issue.key, None, human=True)) elif isinstance(pick, HumanTask): waits.append(Waits(issue.key, "it is a human's task")) elif blocking: @@ -131,11 +154,14 @@ def start_chunks(epic: Epic, issues: list[EpicIssue], finishing: bool, own: str for chunk in found: if chunk.issue in running or chunk.issue == own: continue - if chunk.issue in parked and chunk.issue in live: + slot = chunk.issue not in parked and not chunk.human + if chunk.human and chunk.issue in live: + waits.append(Waits(chunk.issue, HUMAN_WAIT)) + elif chunk.issue in parked and chunk.issue in live: waits.append(Waits(chunk.issue, parked[chunk.issue].waits(live[chunk.issue].awaits))) elif own and (chunk.issue in stopped or chunk.issue in parked): waits.append(Waits(chunk.issue, f"its window stopped; run `do-epic {epic.key}` to start it again")) - elif chunk.issue not in parked and len(running) + taken >= epic.cap: + elif slot and len(running) + taken >= epic.cap: waits.append(Waits(chunk.issue, f"the epic runs as many chunks as its `{CAP}` line allows: {epic.cap}")) else: now = start_chunk(epic, chunk if chunk.issue not in parked else Chunk(chunk.issue, None), own, windows, run) @@ -146,7 +172,7 @@ def start_chunks(epic: Epic, issues: list[EpicIssue], finishing: bool, own: str else: windows = now started.append(chunk.issue) - taken += chunk.issue not in parked + taken += slot except OSError as failure: return Failure(f"cannot lock {failure.filename or epic.folder / LOCK}: {failure.strerror}") # The epic's finishing is no issue: its wait is listed after every issue's. @@ -212,6 +238,8 @@ def status(key: str, home: pathlib.Path, issues: list[EpicIssue], run: tmux.Tmux for chunk in found: if chunk.issue in parked: reasons[chunk.issue] = parked[chunk.issue].waits(live[chunk.issue].awaits) if chunk.issue in live else f"{parked[chunk.issue].waits('')}, and its window stopped; {again}" + elif chunk.human and chunk.issue in live: + reasons[chunk.issue] = HUMAN_WAIT elif chunk.issue not in live: reasons[chunk.issue] = f"its window stopped; {again}" if chunk.issue in {window.name for window in windows} else f"it has not started; `do-epic {key}` starts it once the epic and its repo have room" return [f"{issue.key} waits: {reasons[issue.key]}" if issue.key in reasons else f"{issue.key} runs" for issue in issues if issue.key in reasons or issue.key in live] diff --git a/bin/do_epic/test_human_tasks.py b/bin/do_epic/test_human_tasks.py new file mode 100644 index 00000000..70df0416 --- /dev/null +++ b/bin/do_epic/test_human_tasks.py @@ -0,0 +1,100 @@ +import dataclasses +import pathlib +import sys +import unittest + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) + +from do_epic.backend.fake import MemoryEpic +from do_epic.epic_record import EpicRecord +from do_epic.test_main import Description, DoEpicTest, MODELS, UNREAD +from do_epic.test_scheduler import issue +from failure import Failure +from loop_claude.test_loop_claude import FakeEffects + +# The window of ABC-19, a human's task that blocks ABC-21. +WINDOW = "ABC-19\t0\t@9\n" + + +class AHumanTaskThatBlocksAnIssue(DoEpicTest): + def setUp(self) -> None: + super().setUp() + self.issues = [issue("ABC-19", "do-epic-human"), issue("ABC-21", "do-epic-claude", blockers=("ABC-19",))] + self.issues[0] = dataclasses.replace(self.issues[0], summary="Order the test certificate") + self.epic = MemoryEpic("ABC-12", self.issues) + self.backend = lambda config, key: (self.epic, EpicRecord(Description(self.description))) # type: ignore[method-assign, arg-type] + + def awaited(self, fake: FakeEffects, closes_after: int) -> tuple[int, str, str]: + """The window's run, where the human closes the task once the window has slept closes_after times.""" + slept: list[int] = [] + + def sleep(seconds: int) -> None: + slept.append(seconds) + if len(slept) == closes_after: + self.epic.change("ABC-19", done=True, status="Done") + fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=sleep) # type: ignore[method-assign] + self.slept = slept + return self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS) + + def test_dms_the_human_once_parks_its_window_and_polls_until_the_issue_closes_then_starts_the_next(self) -> None: + fake = FakeEffects(git=UNREAD, windows=WINDOW) + code, out, err = self.awaited(fake, closes_after=3) + self.assertEqual((code, err), (0, "")) + self.assertEqual(self.slept, [60, 60, 60]) + self.assertEqual(fake.dms, ["do-epic ABC-12 awaits you: ABC-19, \"Order the test certificate\", blocks ABC-21. It goes on once you close ABC-19 in Jira."]) + self.assertEqual([args for args in fake.tmux_calls if args[0] == "rename-window"], [["rename-window", "-t", "%1", "ABC-19 awaits a human's task"]]) + self.assertIn("the chunk finished; started ABC-21\n", out) + self.assertEqual([seam for seam, _ in fake.calls if seam == "stream_claude"], []) + + def test_a_task_that_blocks_two_issues_names_both(self) -> None: + self.epic.issues.append(issue("ABC-22", "do-epic-claude", blockers=("ABC-19",))) + fake = FakeEffects(git=UNREAD, windows=WINDOW) + self.awaited(fake, closes_after=1) + self.assertIn("blocks ABC-21 and ABC-22. ", fake.dms[0]) + + def test_goes_on_where_the_task_blocks_nothing_any_more(self) -> None: + fake = FakeEffects(git=UNREAD, windows=WINDOW) + fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=lambda seconds: self.epic.change("ABC-21", blockers=())) # type: ignore[method-assign] + code, out, err = self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS) + self.assertEqual((code, err), (0, "")) + self.assertIn("the chunk finished; started ABC-21\n", out) + + def test_says_once_why_a_read_failed_and_keeps_polling(self) -> None: + fake = FakeEffects(git=UNREAD, windows=WINDOW) + slept: list[int] = [] + + def sleep(seconds: int) -> None: + slept.append(seconds) + self.epic.fails = "Jira answered 503" if len(slept) < 3 else None + if len(slept) == 4: + self.epic.change("ABC-19", done=True) + fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=sleep) # type: ignore[method-assign] + code, out, err = self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS) + self.assertEqual((code, err), (0, "")) + self.assertEqual(out.count("Jira answered 503"), 1, out) + self.assertEqual(len(fake.dms), 1) + + def test_a_task_that_holds_nothing_up_at_its_start_hands_on_without_a_dm(self) -> None: + self.epic.change("ABC-21", blockers=()) + fake = FakeEffects(git=UNREAD, windows=WINDOW) + code, out, err = self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS) + self.assertEqual((code, err, fake.dms), (0, "", [])) + self.assertIn("the chunk finished; started ABC-21\n", out) + + def test_the_status_says_that_the_task_is_awaited(self) -> None: + fake = FakeEffects(windows="ABC-19 awaits a human's task\t0\t@9\n") + code, out, err = self.run_main(["ABC-12", "--status"], fake) + self.assertEqual((code, err), (0, "")) + self.assertEqual(out.replace("<1790000000> ", "").splitlines(), ["ABC-19 waits: it is a human's task; do-epic polls until its issue closes", "ABC-21 waits: ABC-19 blocks it"]) + + def test_the_epic_starts_a_window_for_the_task_and_none_for_the_issue_it_blocks(self) -> None: + fake = FakeEffects(windows="") + code, out, err = self.run_main(["ABC-12"], fake, {"TMUX_PANE": "%1"}) + self.assertEqual((code, err), (0, "")) + self.assertIn("started ABC-19 in the tmux session epic-ABC-12\n", out) + self.assertIn("ABC-21 waits: ABC-19 blocks it\n", out) + self.assertEqual(fake.dms, []) + + +if __name__ == "__main__": + unittest.main() diff --git a/bin/do_epic/test_main.py b/bin/do_epic/test_main.py index 6769fd61..9e706f3e 100644 --- a/bin/do_epic/test_main.py +++ b/bin/do_epic/test_main.py @@ -143,7 +143,7 @@ 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()) - place = main.chunk_root("ABC-21", epic) + place = main.chunk_root("ABC-21", self.issues[1], epic) assert isinstance(place, tuple) root, 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()) @@ -380,15 +380,13 @@ class AChunksRun(DoEpicTest): 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_an_issue_that_names_no_repo_is_no_chunk(self) -> None: + self.issues = [issue("ABC-20")] + fake = FakeEffects(git=UNREAD) + code, _, err = self.run_main(["--chunk", "ABC-20", "ABC-12"], fake, MODELS) + self.assertEqual(code, 1) + self.assertIn("ABC-20 is no chunk: no label names its repo\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() diff --git a/bin/do_epic/test_scheduler.py b/bin/do_epic/test_scheduler.py index 72a9c990..60eea5c9 100644 --- a/bin/do_epic/test_scheduler.py +++ b/bin/do_epic/test_scheduler.py @@ -68,6 +68,18 @@ class WhichIssuesAreChunks(unittest.TestCase): 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_a_human_task_that_blocks_an_open_issue_is_a_chunk_to_await_and_one_that_blocks_none_waits(self) -> None: + found = chunks([issue("ABC-20", "do-epic-human"), issue("ABC-21", "repo:api", blockers=("ABC-20",)), issue("ABC-22", "do-epic-human")]) + self.assertEqual(found, ([Chunk("ABC-20", None, human=True)], [Waits("ABC-21", "ABC-20 blocks it"), Waits("ABC-22", "it is a human's task")])) + + def test_a_human_task_is_awaited_while_it_blocks_a_sub_task_through_its_split_parent(self) -> None: + found = chunks([issue("ABC-19", "do-epic-human"), issue("ABC-20", "split-by-repo", blockers=("ABC-19",)), issue("ABC-23", "repo:api", parent="ABC-20")]) + self.assertEqual(found, ([Chunk("ABC-19", None, human=True)], [Waits("ABC-23", "ABC-19 blocks it")])) + + def test_a_human_task_that_is_blocked_itself_or_blocks_only_done_issues_waits(self) -> None: + found = chunks([issue("ABC-19", "repo:api"), issue("ABC-20", "do-epic-human", blockers=("ABC-19",)), issue("ABC-21", "repo:api", blockers=("ABC-20",)), issue("ABC-22", "do-epic-human"), issue("ABC-23", "repo:api", done=True, blockers=("ABC-22",))]) + self.assertEqual(found, ([Chunk("ABC-19", "api")], [Waits("ABC-20", "it is a human's task"), Waits("ABC-21", "ABC-20 blocks it"), Waits("ABC-22", "it is a human's task")])) + def test_what_blocks_a_split_item_blocks_its_sub_tasks(self) -> None: found = chunks([issue("ABC-19", "repo:api"), issue("ABC-20", "split-by-repo", blockers=("ABC-19",)), issue("ABC-23", "repo:api", parent="ABC-20")]) self.assertEqual(found, ([Chunk("ABC-19", "api")], [Waits("ABC-23", "ABC-19 blocks it")])) @@ -169,6 +181,17 @@ class StartingAnEpicsChunks(unittest.TestCase): self.assertEqual(run.windows[-1], ("epic-ABC-12", "ABC-20", False, str(self.home / ".local/state/do-epic/ABC-12"))) self.assertEqual([name for _, name, dead, _ in run.windows if dead], [""] * len(windows)) + def test_a_human_task_that_blocks_an_issue_gets_a_window_that_takes_no_slot_of_the_epics_cap(self) -> None: + run = Tmux() + found = self.start(self.epic(1, api=1), [issue("ABC-19", "do-epic-human"), issue("ABC-20", "do-epic-claude"), issue("ABC-21", "repo:api", blockers=("ABC-19",))], run) + self.assertEqual(found, Started(["ABC-19", "ABC-20"], [Waits("ABC-21", "ABC-19 blocks it")])) + + def test_a_human_task_with_a_window_that_awaits_it_starts_no_second_window(self) -> None: + run = Tmux(("epic-ABC-12", "ABC-19 awaits a human's task", False, "")) + found = self.start(self.epic(1, api=1), [issue("ABC-19", "do-epic-human"), issue("ABC-21", "repo:api", blockers=("ABC-19",))], run) + self.assertEqual(found, Started([], [Waits("ABC-19", "it is a human's task; do-epic polls until its issue closes"), Waits("ABC-21", "ABC-19 blocks it")])) + self.assertEqual(run.started(), []) + def test_a_parked_chunk_that_starts_again_leaves_the_epics_cap_to_the_others(self) -> None: self.parked("ABC-20") found = self.start(self.epic(1, api=2), [issue("ABC-20", "repo:api"), issue("ABC-21", "repo:api")], Tmux()) diff --git a/docs/decisions.md b/docs/decisions.md index 9e4a697c..9a890cd2 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -154,7 +154,7 @@ Valid while `~/.claude` is a checkout of this repo. - **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//`. 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 ` 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 --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 ` 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. -- **Human tasks.** do-epic DMs the human when one blocks the next item, and polls until its issue closes. +- **Human tasks.** do-epic leaves the issue as the team filed it. While an open human task that nothing blocks itself blocks another open issue, it has a window of its own that DMs the human once, shows as parked (`awaits a human's task`) so it takes no running slot, and polls the epic every minute until the issue closes or blocks nothing. 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. - **Tests.** Black-box tests run against a fake Jira backend. An opt-in e2e test runs as its own command against a sandbox epic on a real Jira site. diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 75c80cc7..452a3626 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2958,3 +2958,14 @@ Read most (opens and searches): - `bin/do_epic/scheduler.py` 1 - `bin/plan_store/jira_epic.py` 1 - `bin/release_plan/release_standing.py` 1 + +## Reading cost, chunk 9d8a10bb5ed7, finished 2026-11-19T00:37:04Z + +53622 new input tokens before the first commit. + +Read most (opens and searches): + +- `README.md` 7 +- `bin/do_epic/config.py` 1 +- `bin/do_epic/repo_pick.py` 1 +- `docs/decisions.md` 1 -- 2.52.0 From 00528e7df41c14d4f4e25842830455df32916b78 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 02:01:54 +0100 Subject: [PATCH 02/11] Sort the imports of the human-task modules --- bin/do_epic/human_tasks.py | 8 ++++---- bin/do_epic/test_human_tasks.py | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/do_epic/human_tasks.py b/bin/do_epic/human_tasks.py index fde88f48..4d53bf4a 100644 --- a/bin/do_epic/human_tasks.py +++ b/bin/do_epic/human_tasks.py @@ -1,12 +1,12 @@ """A human's task that holds up other issues of an epic (docs/decisions.md → `do-epic: drives one Jira epic …`, "Human tasks"). do-epic leaves the issue as the team filed it. While it is open and blocks an open issue, its window DMs the human once, shows itself as parked so that it takes no running slot, and reads the epic every `poll` seconds. Once the issue is closed, or blocks nothing any more, the window ends, and the chunks it held up may start. A window that starts again, as after a reboot, DMs again.""" -from agent_cycle import tmux -from agent_cycle.direct_message import tell -from do_epic import scheduler +from loop_effects.effects import Effects, say from do_epic.backend.protocol import EpicIssue, EpicStore from failure import Failure -from loop_effects.effects import Effects, say +from do_epic import scheduler +from agent_cycle.direct_message import tell +from agent_cycle import tmux # What the window of a human's task awaits, in its name. AWAITS = "a human's task" diff --git a/bin/do_epic/test_human_tasks.py b/bin/do_epic/test_human_tasks.py index 70df0416..3d561659 100644 --- a/bin/do_epic/test_human_tasks.py +++ b/bin/do_epic/test_human_tasks.py @@ -5,12 +5,11 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from do_epic.backend.fake import MemoryEpic -from do_epic.epic_record import EpicRecord from do_epic.test_main import Description, DoEpicTest, MODELS, UNREAD -from do_epic.test_scheduler import issue -from failure import Failure +from do_epic.epic_record import EpicRecord from loop_claude.test_loop_claude import FakeEffects +from do_epic.test_scheduler import issue +from do_epic.backend.fake import MemoryEpic # The window of ABC-19, a human's task that blocks ABC-21. WINDOW = "ABC-19\t0\t@9\n" -- 2.52.0 From ce266926766de2ffd419f110b31c8f303059e4f3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 02:20:23 +0100 Subject: [PATCH 03/11] Kill the surviving mutants of the human-task window --- bin/do_epic/test_human_tasks.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/do_epic/test_human_tasks.py b/bin/do_epic/test_human_tasks.py index 3d561659..50acab33 100644 --- a/bin/do_epic/test_human_tasks.py +++ b/bin/do_epic/test_human_tasks.py @@ -5,7 +5,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from do_epic.test_main import Description, DoEpicTest, MODELS, UNREAD +from do_epic.test_main import DESCRIPTION, Description, DoEpicTest, MODELS, UNREAD from do_epic.epic_record import EpicRecord from loop_claude.test_loop_claude import FakeEffects from do_epic.test_scheduler import issue @@ -45,6 +45,21 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest): self.assertIn("the chunk finished; started ABC-21\n", out) self.assertEqual([seam for seam, _ in fake.calls if seam == "stream_claude"], []) + def test_the_window_of_a_closed_task_goes_on_while_another_human_task_still_holds_an_issue_up(self) -> None: + self.epic.issues.extend([issue("ABC-30", "do-epic-human"), issue("ABC-31", "do-epic-claude", blockers=("ABC-30",))]) + fake = FakeEffects(git=UNREAD, windows=WINDOW) + code, out, err = self.awaited(fake, closes_after=1) + self.assertEqual((code, err), (0, "")) + self.assertEqual(len(fake.dms), 1) + self.assertIn("the chunk finished; started ABC-21, ABC-30\n", out) + + def test_the_window_takes_no_running_slot_when_it_starts_the_next_chunk(self) -> None: + self.description = DESCRIPTION.replace("2", "1") + fake = FakeEffects(git=UNREAD, windows=WINDOW) + code, out, err = self.awaited(fake, closes_after=1) + self.assertEqual((code, err), (0, "")) + self.assertIn("the chunk finished; started ABC-21\n", out) + def test_a_task_that_blocks_two_issues_names_both(self) -> None: self.epic.issues.append(issue("ABC-22", "do-epic-claude", blockers=("ABC-19",))) fake = FakeEffects(git=UNREAD, windows=WINDOW) -- 2.52.0 From 1c6f229cd92219de5009c37818269300043e2718 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 02:44:22 +0100 Subject: [PATCH 04/11] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=208=20=F0=9F=9F=A1=20(0=20misread);=20reword=20th?= =?UTF-8?q?e=20human-task=20docs=20and=20README=20placement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- docs/decisions.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bcb01a5c..309b2862 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ The last line prints each setting's path once the config is complete. `do-epic` keeps its settings per machine, not per project, in `~/.claude-projects/do-epic/`, two files for every epic: - `config.toml` sets `jira-url`, the site, such as `https://acme.atlassian.net`; `env-file`, the file holding `ATLASSIAN_EMAIL` and `ATLASSIAN_API_TOKEN`, a path that starts with `/` or `~/`, outside the clone folder and every folder of `~/.claude-projects`; and `repoless-model`, the model that works an item with no repo. It may also set `clone-folder`, where a missing repo is cloned, `~/code` if left out; `language`, the language of Jira text, English if left out; and `jira-finish-transition` with `jira-finish-status`, which name the workflow transition that closes a finished epic and the status it leads to, such as `"Mark as done"` and `"Done"`. Set both or neither: without them do-epic closes no epic. -- `repo-rule.md` is prose that says how to tell an item's repo, such as "a label that equals a repo's name names that repo". It may not be blank. do-epic doesn't read it yet: until it picks each item's repo from the rule, an issue runs once a label `repo:` records its repo, `do-epic-claude` marks work of Claude's that changes no repo, and `do-epic-human` a task of yours. An open task of yours that blocks another issue gets a tmux window that DMs you once and reads the issue every minute; once you close it, the issues it blocked may start. do-epic never edits the issue. +- `repo-rule.md` is prose that says how to tell an item's repo, such as "a label that equals a repo's name names that repo". It may not be blank. do-epic doesn't read it yet: until it picks each item's repo from the rule, an issue runs once a label `repo:` records its repo, `do-epic-claude` marks work of Claude's that changes no repo, and `do-epic-human` a task of yours. Each repo an epic changes has a project config of its own, as in the rest of this section. `do-epic` fails and names each setting or file that is missing or invalid. @@ -190,7 +190,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `command-patterns [] [--calls ]` prints a table of the shell command patterns a release's archived chunks ran, such as `tea pr create`, for an audit of the release, and with `--calls ` saves each call as a JSON line; `command-patterns --help` states the columns and the line's keys. - `compress-archives` gzips each transcript in loop-claude's archive and each file in the review folders 30 days after it last changed, keeping all of them; Install's crontab line runs it daily. - `deploy-release [--cut] []` moves `~/.claude`, or the checkout named, to the newest release, as Update says; with `--cut`, run in the development clone, it first cuts the next release, as Release says. -- `do-epic ` runs the chunks of one Jira epic whose items span repos, or have none, each in its own window of the tmux session `epic-`, on the same cycle, judge and interrupt as loop-claude. The epic's description is its record: goals, audience, scoring and decisions. An open issue runs once a label names its repo, in Jira's backlog order, as many at once as a line such as `**Max parallel chunks:** 2` in the epic's description allows, 1 without it, and as each repo's `parallel-chunks` allows. A chunk whose pull request waits on a gate parks. do-epic closes the epic only once you confirm every goal. Install → "Set up a project" says how to set it up; `do-epic --help` states the flags and the contract. +- `do-epic ` runs the chunks of one Jira epic whose items span repos, or have none, each in its own window of the tmux session `epic-`, on the same cycle, judge and interrupt as loop-claude. The epic's description is its record: goals, audience, scoring and decisions. An open issue runs once a label names its repo, in Jira's backlog order, as many at once as a line such as `**Max parallel chunks:** 2` in the epic's description allows, 1 without it, and as each repo's `parallel-chunks` allows. A chunk whose pull request waits on a gate parks. An open task of yours that blocks another issue gets a window that DMs you once and reads the epic every minute; once you close the task, the issues it blocked may start. do-epic closes the epic only once you confirm every goal. Install → "Set up a project" says how to set it up; `do-epic --help` states the flags and the contract. - `judge-replay [--offline]` replays loop-claude's judge on archived verdicts of the projects run on the model. It prints what each rung a review climbs to misses, and the lowest rung below those that returns every verdict, as each candidate above it does. With `--offline` it doesn't call a judge: it counts what a "?" rule, a decision table and a classifier trained on the archive decide of each verdict's kind from the worker's final message, and how many interrupts each misses. `judge-replay --help` states both replays. - `larv-review ` holds larv-review's mechanical rules: the chunk's review folder, the paired ruling's base and vote count, each pass's round count and the opening of its round commit's title, the scoring run's trigger and setup; the comprehension history's format, its latest places and its count of how often seats agree; and each reviewer's prompt header. `larv-review --help` states them. `settings.json` → `hooks` runs `larv-review reviewer-context` as each subagent starts. A reviewer under `agents/` whose frontmatter has `omitClaudeMd: true` starts without `CLAUDE.md`, and the command hands it that file's "Shared goal", "Prose" and "Vocabulary" sections. - `loop-claude ` runs a project's next chunks, each in its own tmux window, cycle after cycle; `loop-claude --help` states its contract. diff --git a/docs/decisions.md b/docs/decisions.md index 9a890cd2..e970b8a9 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -154,7 +154,7 @@ Valid while `~/.claude` is a checkout of this repo. - **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//`. 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 ` 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 --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 ` 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. -- **Human tasks.** do-epic leaves the issue as the team filed it. While an open human task that nothing blocks itself blocks another open issue, it has a window of its own that DMs the human once, shows as parked (`awaits a human's task`) so it takes no running slot, and polls the epic every minute until the issue closes or blocks nothing. Then the issues it held up may start. A window that starts again, as after a reboot, DMs again. +- **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, 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. - **Tests.** Black-box tests run against a fake Jira backend. An opt-in e2e test runs as its own command against a sandbox epic on a real Jira site. -- 2.52.0 From d652ab20d37244519e219b567e71b9cd3f7cee88 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 02:44:22 +0100 Subject: [PATCH 05/11] =?UTF-8?q?Answer=20product-owner=20round=201:=201?= =?UTF-8?q?=20=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(1=20misread);=20DM=20thr?= =?UTF-8?q?ough=20the=20checkout=20of=20a=20held-up=20issue's=20repo=20and?= =?UTF-8?q?=20show=20the=20DM=20in=20the=20window?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/agent_cycle/direct_message.py | 7 ++++--- bin/loop_claude/test_loop_claude.py | 7 +++++-- bin/loop_effects/effects.py | 6 +++--- bin/notifier/test_notifier.py | 9 ++++++++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/bin/agent_cycle/direct_message.py b/bin/agent_cycle/direct_message.py index 86cf10cf..32d3da83 100644 --- a/bin/agent_cycle/direct_message.py +++ b/bin/agent_cycle/direct_message.py @@ -1,7 +1,8 @@ from loop_effects.effects import Effects, say -def tell(text: str, effects: Effects) -> None: - """DMs text to the human. Where the DM fails, it says why on stderr and goes on: the DM only copies what the terminal shows, so its failure never stops the loop.""" - if failed := effects.dm(text): +def tell(text: str, effects: Effects, directory: str | None = None) -> bool: + """DMs text to the human through the notifier of the project whose checkout holds directory, else the current directory, and returns whether it went out. Where the DM fails, it says why on stderr and goes on: the DM only copies what the terminal shows, so its failure never stops the loop.""" + if failed := effects.dm(text, directory): say(f"could not DM you: {failed.reason}", effects) + return not failed diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index a3268f58..acf0f94c 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -109,6 +109,8 @@ class FakeEffects: self.owner = owner # Each direct message sent. They stay out of self.calls, so a test that lists every call doesn't list them. Without a script, each is sent. self.dms = [] + # The directory each DM named, in the order of self.dms; None where it named none. + self.dm_directories = [] self.dm_failures = list(dm_failures) self.scripts = {"claude": list(claude), "claude_on_terminal": list(on_terminal_claude), "git": list(git), "input": list(inputs), "python": list(python), "stream_claude": list(streams)} # Without a script, every read finds all memory available. @@ -144,8 +146,9 @@ class FakeEffects: return subprocess.CompletedProcess(args, 1 if self.windows is None else 0, self.windows or "", "no server") return subprocess.CompletedProcess(args, 0, {"-V": self.tmux_version + "\n", "show-options": self.owner + "\n"}.get(args[0], "@9\n"), "") - def dm(self, text): + def dm(self, text, directory): self.dms.append(text) + self.dm_directories.append(directory) return self.dm_failures.pop(0) if self.dm_failures else None def memory(self): @@ -832,7 +835,7 @@ class Interrupts(unittest.TestCase): def test_drops_the_keys_typed_before_the_question_ahead_of_the_dm_so_an_answer_typed_while_it_sends_counts(self): fake = FakeEffects(inputs=["Use B."]) seen = [] - effects = dataclasses.replace(fake.effects(), dm=lambda text: seen.append(list(fake.calls))) + effects = dataclasses.replace(fake.effects(), dm=lambda text, directory: seen.append(list(fake.calls))) self.assertEqual(self.put(fake, effects=effects)[0], "Use B.") self.assertEqual(seen, [[("discard_typed", None)]]) diff --git a/bin/loop_effects/effects.py b/bin/loop_effects/effects.py index 457ef24e..ebec0392 100644 --- a/bin/loop_effects/effects.py +++ b/bin/loop_effects/effects.py @@ -36,8 +36,8 @@ class Effects: claude_on_terminal: typing.Callable[[list[str], str, dict[str, str]], int] # Drops what was typed on the terminal and not yet read. discard_typed: typing.Callable[[], None] - # Sends the human a direct message through the notifier the project's config names, as `notify` does, for the project whose checkout holds the current directory; a Failure where it could not. - dm: typing.Callable[[str], Failure | None] + # Sends the human a direct message through the notifier the project's config names, as `notify` does, for the project whose checkout holds the given directory, else the current directory; a Failure where it could not. + dm: typing.Callable[[str, str | None], Failure | None] execv: typing.Callable[[str, list[str]], None] git: git_repo.Git input: typing.Callable[[str], str] @@ -75,7 +75,7 @@ def system_effects(backends: typing.Mapping[Notifier, Backend[typing.Any]] = BAC claude=lambda args, cwd, stdin: subprocess.run(["claude", *args], capture_output=True, cwd=cwd, input=stdin, text=True), claude_on_terminal=claude_on_terminal, discard_typed=lambda: termios.tcflush(sys.stdin, termios.TCIFLUSH), - dm=lambda text: notify(text, None, pathlib.Path.home(), backends), + dm=lambda text, directory: notify(text, directory, pathlib.Path.home(), backends), execv=os.execv, git=git_repo.git, input=input, diff --git a/bin/notifier/test_notifier.py b/bin/notifier/test_notifier.py index 44b1bd3c..ee563e57 100644 --- a/bin/notifier/test_notifier.py +++ b/bin/notifier/test_notifier.py @@ -73,7 +73,14 @@ class Notify(Project): self.name_notifier("slack", SLACK_KEYS) slack = Slack({"ok": True}) with contextlib.chdir(self.checkout): - self.assertIsNone(system_effects(through("slack", slack)).dm("Which one?")) + self.assertIsNone(system_effects(through("slack", slack)).dm("Which one?", None)) + self.assertEqual(slack.requests, [SLACK_POST]) + + def test_a_dm_that_names_a_directory_goes_through_the_notifier_for_the_project_holding_it_from_any_current_directory(self): + self.name_notifier("slack", SLACK_KEYS) + slack = Slack({"ok": True}) + with contextlib.chdir(self.home): + self.assertIsNone(system_effects(through("slack", slack)).dm("Which one?", str(self.checkout))) self.assertEqual(slack.requests, [SLACK_POST]) def test_skips_the_notice_for_a_project_that_names_no_notifier_even_where_its_env_file_holds_the_keys(self): -- 2.52.0 From 7ed020490cbf3948e3755be36c3b94a4aa3d6333 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 02:44:22 +0100 Subject: [PATCH 06/11] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=205=20=F0=9F=9F=A1=20(0=20misread);=20park=20the?= =?UTF-8?q?=20window=20first,=20resend=20a=20failed=20DM,=20reword=20docst?= =?UTF-8?q?rings=20and=20trim=20two=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/do_epic/human_tasks.py | 32 ++++++++++++++++++++++++-------- bin/do_epic/main.py | 12 ++++++------ bin/do_epic/scheduler.py | 10 +++++----- bin/do_epic/test_human_tasks.py | 33 +++++++++++++++++++++++---------- bin/do_epic/test_scheduler.py | 4 ++-- 5 files changed, 60 insertions(+), 31 deletions(-) diff --git a/bin/do_epic/human_tasks.py b/bin/do_epic/human_tasks.py index 4d53bf4a..ea8642f8 100644 --- a/bin/do_epic/human_tasks.py +++ b/bin/do_epic/human_tasks.py @@ -1,9 +1,13 @@ """A human's task that holds up other issues of an epic (docs/decisions.md → `do-epic: drives one Jira epic …`, "Human tasks"). -do-epic leaves the issue as the team filed it. While it is open and blocks an open issue, its window DMs the human once, shows itself as parked so that it takes no running slot, and reads the epic every `poll` seconds. Once the issue is closed, or blocks nothing any more, the window ends, and the chunks it held up may start. A window that starts again, as after a reboot, DMs again.""" +A window that starts again, as after a reboot, DMs again, and so does one whose DM failed, on its next read.""" +import pathlib + +from project_config.settings import by_name, ProjectConfig from loop_effects.effects import Effects, say from do_epic.backend.protocol import EpicIssue, EpicStore from failure import Failure +from do_epic.repo_pick import recorded, Repo from do_epic import scheduler from agent_cycle.direct_message import tell from agent_cycle import tmux @@ -13,18 +17,29 @@ AWAITS = "a human's task" def holds_up(key: str, issues: list[EpicIssue]) -> list[str]: - """The keys of the open issues that the human's task called key holds up; none where it is no such task, or is closed.""" + """The keys of the open issues that the human's task called key holds up; none where it is no such task, is closed, or an issue blocks it.""" if not any(chunk.human and chunk.issue == key for chunk in scheduler.chunks(issues)[0]): return [] return scheduler.held_up(issues)[key] def message(task: EpicIssue, epic: str, held: list[str]) -> str: - return f"do-epic {epic} awaits you: {task.key}, \"{task.summary}\", blocks {' and '.join(held)}. It goes on once you close {task.key} in Jira." + return f"do-epic {epic} awaits you: {task.key}, \"{task.summary}\", blocks {' and '.join(held)}. do-epic goes on once you close {task.key} in Jira." -def awaited(task: EpicIssue, epic: str, store: EpicStore, window: tmux.Window, poll: int, effects: Effects) -> None: - """Waits in window for the human to close the human's task `task` of the epic called epic, and returns once it holds up no issue. A read of the epic that fails is said once and tried again.""" +def checkout_of(held: list[EpicIssue], home: pathlib.Path) -> str | None: + """The checkout of the first issue of held whose repo a project config names: where the DM finds its notifier, since the window runs in no checkout. None where there is none, and the DM goes by the current directory.""" + for issue in held: + pick = recorded(issue) + found = by_name(pick.name, home) if isinstance(pick, Repo) else None + if isinstance(found, ProjectConfig): + return str(found.top) + return None + + +def awaited(task: EpicIssue, epic: str, store: EpicStore, window: tmux.Window, poll: int, home: pathlib.Path, effects: Effects) -> None: + """Waits in window for the human to close the human's task `task` of the epic called epic, and returns once it no longer holds up any issue. A read of the epic that fails is said once and tried again.""" + tmux.park(window, AWAITS, effects.tmux) told, said = False, None while True: issues = store.read() @@ -35,7 +50,8 @@ def awaited(task: EpicIssue, epic: str, store: EpicStore, window: tmux.Window, p elif not (held := holds_up(task.key, issues)): return elif not told: - tell(message(task, epic, held), effects) - tmux.park(window, AWAITS, effects.tmux) - told = True + text = message(task, epic, held) + say(text, effects, stdout=True) + by_key = {issue.key: issue for issue in issues} + told = tell(text, effects, checkout_of([by_key[key] for key in held], home)) effects.sleep(poll) diff --git a/bin/do_epic/main.py b/bin/do_epic/main.py index 6421eb19..5db12731 100644 --- a/bin/do_epic/main.py +++ b/bin/do_epic/main.py @@ -1,6 +1,6 @@ """The do-epic command (docs/decisions.md → `do-epic: drives one Jira epic …`). -`do-epic ` 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 `: the cycles of one issue's chunk, run by the code that runs loop-claude's (`agent_cycle`), until the judge rules it finished. Then it starts the chunks that may start now, and its window closes. +`do-epic ` 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 `: 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. The window of a human's task runs no cycle: it waits until the task no longer holds up an issue (`human_tasks`), then does the same. After each cycle of a chunk in a repo, the window reads what the chunk's pull request waits on (`gates`). While that is a gate only time or a person passes, the chunk is parked (`parked`): the window frees its running slot and polls the forge, and the chunk's next cycle starts once the worker has something to do and a slot is free. `do-epic --status` prints what each open issue does.""" import dataclasses @@ -46,8 +46,8 @@ HELP = f"""usage: do-epic [--status] Runs the chunks of one Jira epic, such as ABC-12, each in its own window of the tmux session epic-. An open issue of the epic runs as a chunk once it has a label and no issue blocks it. -A `do-epic-human` issue that blocks another gets a window too: it DMs you once and waits, with no running slot, until you close the issue in Jira. The label names the issue's repo, or says the work changes no repo. +A `do-epic-human` issue that blocks another gets a window too. The window DMs you once, then waits without taking a place until you close the issue in Jira. As many run at once as the epic's description allows with a line such as `**Max parallel chunks:** 2`, one where it has none. A repo takes as many chunks as its `parallel-chunks`, and none while loop-claude runs chunks in it. A chunk whose worker ends its run while its pull request waits on its checks, an approval or a new review @@ -62,7 +62,7 @@ The Jira site and its credentials are set in ~/.claude-projects/do-epic/config.t ARCHIVE = ".claude/do-epic-transcripts" # The flag that prints what each open issue does. STATUS_FLAG = "--status" -# How often a parked chunk reads its pull request's gate: a reviewer answers in hours, and each read is three or four calls to the forge. +# How often a parked chunk reads its pull request's gate, and a human task's window reads the epic: a person answers in hours, and each read is a few calls. POLL_SECONDS = 60 # The store of an epic's issues and its record, for the epic with this key. @@ -227,7 +227,7 @@ def real(checkout: pathlib.Path) -> pathlib.Path: 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. A chunk in a repo parks after each cycle that leaves its pull request waiting on a gate, and before its first where it was parked when its window last ended, as at a reboot.""" + """Runs the cycles of the chunk of the issue called key until one stops the loop, or the judge rules the chunk finished. For a human's task it runs no cycle: it waits until the task no longer holds up an issue (`human_tasks.awaited`), then starts the next chunks. A chunk in a repo parks after each cycle that leaves its pull request waiting on a gate, and before its first where it was parked when its window last ended, as at a reboot.""" pane = epic.env.get("TMUX_PANE") if not pane: return Stop(1, f"{scheduler.CHUNK_FLAG} is how do-epic starts itself in a tmux window; run do-epic ") @@ -236,7 +236,7 @@ def chunk_run(key: str, epic: EpicRun) -> Stop: if isinstance(issue, Stop): return issue if issue and isinstance(recorded(issue), HumanTask): - human_tasks.awaited(issue, epic.key, epic.store, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.effects) + human_tasks.awaited(issue, epic.key, epic.store, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.paths.home, epic.effects) return handed_on(key, epic) place = chunk_root(key, issue, epic) if isinstance(place, Stop): @@ -340,7 +340,7 @@ def issue_read(key: str, epic: EpicRun) -> EpicIssue | Stop: def chunk_root(key: str, issue: EpicIssue | None, epic: EpicRun) -> tuple[str, str | None] | Stop: - """The folder the chunk called key works in, and the name of the repo whose checkout it is: None for the epic's folder, which holds work without a repo, as the epic's finishing is, and its issue is None. The chunk keeps both to its end, whatever its issue's labels become. The stop where the labels make the issue no chunk.""" + """The folder the chunk called key works in, and the name of the repo whose checkout it is: None for the epic's folder, which holds work without a repo, as the epic's finishing is. issue is None for the epic's finishing. The chunk keeps both to its end, whatever its issue's labels become. The stop where the labels make the issue no chunk.""" pick = recorded(issue) if issue else ClaudeWork() if isinstance(pick, Failure): return Stop(1, pick.reason) diff --git a/bin/do_epic/scheduler.py b/bin/do_epic/scheduler.py index 93b02e4d..bae47b19 100644 --- a/bin/do_epic/scheduler.py +++ b/bin/do_epic/scheduler.py @@ -20,7 +20,7 @@ from agent_cycle import tmux # Under the home folder, a folder per epic key holds the epic's LOCK. A chunk without a repo works there. STATE = ".local/state/do-epic" # Why a human's task with a live window waits, as the epic's status says. -HUMAN_WAIT = "it is a human's task; do-epic polls until its issue closes" +HUMAN_WAIT = "it is a human's task; do-epic polls Jira until you close it" # The flag that tells the do-epic in a window its chunk, as `--chunk ABC-34 ABC-12`. Nobody types it, so no panel picked it. CHUNK_FLAG = "--chunk" @@ -31,7 +31,7 @@ class Chunk: issue: str # The name of the repo it changes; None for work without a repo. repo: str | None - # Whether it is a human's task that holds up another open issue: its window only waits for the human to close the issue (`human_tasks`), and takes no running slot. + # Whether it is a human's task that holds up another open issue: its window only waits for the human to close the issue (`human_tasks`), and doesn't take a running slot. human: bool = False @@ -87,7 +87,7 @@ def open_blockers(issue: EpicIssue, by_key: dict[str, EpicIssue]) -> list[str]: def held_up(issues: list[EpicIssue]) -> dict[str, list[str]]: - """For each issue that blocks an open issue to work as a chunk, the keys of the open issues it blocks, in the tracker's rank order.""" + """Each blocker's key, mapped to the keys of the open issues it holds up, in the tracker's rank order. A split item's blocker holds up the item's sub-tasks.""" by_key = {issue.key: issue for issue in issues} held: dict[str, list[str]] = {} for issue in issues: @@ -98,7 +98,7 @@ def held_up(issues: list[EpicIssue]) -> dict[str, list[str]]: 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 until the human removes the link, since its state is unknown. A human's task is a chunk only while it holds up another issue and nothing holds it up: its window waits for the human.""" + """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. A human's task gets a window only while it holds up another issue and nothing holds it up; that window waits for the human.""" by_key = {issue.key: issue for issue in issues} holding = held_up(issues) found: list[Chunk] = [] @@ -241,5 +241,5 @@ def status(key: str, home: pathlib.Path, issues: list[EpicIssue], run: tmux.Tmux elif chunk.human and chunk.issue in live: reasons[chunk.issue] = HUMAN_WAIT elif chunk.issue not in live: - reasons[chunk.issue] = f"its window stopped; {again}" if chunk.issue in {window.name for window in windows} else f"it has not started; `do-epic {key}` starts it once the epic and its repo have room" + reasons[chunk.issue] = f"its window stopped; {again}" if chunk.issue in {window.name for window in windows} else f"it has not started; `do-epic {key}` starts it" + ("" if chunk.human else " once the epic and its repo have room") return [f"{issue.key} waits: {reasons[issue.key]}" if issue.key in reasons else f"{issue.key} runs" for issue in issues if issue.key in reasons or issue.key in live] diff --git a/bin/do_epic/test_human_tasks.py b/bin/do_epic/test_human_tasks.py index 50acab33..e5fb7ad2 100644 --- a/bin/do_epic/test_human_tasks.py +++ b/bin/do_epic/test_human_tasks.py @@ -5,9 +5,12 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from do_epic.test_main import DESCRIPTION, Description, DoEpicTest, MODELS, UNREAD +from project_config.test_project_config import configured +from do_epic.test_main import Description, DoEpicTest, MODELS, UNREAD from do_epic.epic_record import EpicRecord +from failure import Failure from loop_claude.test_loop_claude import FakeEffects +from do_epic.scheduler import HUMAN_WAIT from do_epic.test_scheduler import issue from do_epic.backend.fake import MemoryEpic @@ -40,10 +43,27 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest): code, out, err = self.awaited(fake, closes_after=3) self.assertEqual((code, err), (0, "")) self.assertEqual(self.slept, [60, 60, 60]) - self.assertEqual(fake.dms, ["do-epic ABC-12 awaits you: ABC-19, \"Order the test certificate\", blocks ABC-21. It goes on once you close ABC-19 in Jira."]) + self.assertEqual(len(fake.dms), 1) + for fact in ("ABC-12", "ABC-19", "Order the test certificate", "ABC-21"): + self.assertIn(fact, fake.dms[0]) self.assertEqual([args for args in fake.tmux_calls if args[0] == "rename-window"], [["rename-window", "-t", "%1", "ABC-19 awaits a human's task"]]) self.assertIn("the chunk finished; started ABC-21\n", out) self.assertEqual([seam for seam, _ in fake.calls if seam == "stream_claude"], []) + self.assertEqual(fake.dm_directories, [None]) + self.assertIn(fake.dms[0], out) + + def test_a_dm_that_failed_is_sent_again_on_the_next_read(self) -> None: + fake = FakeEffects(git=UNREAD, windows=WINDOW, dm_failures=[Failure("the notifier answered 503")]) + self.awaited(fake, closes_after=2) + self.assertEqual(len(fake.dms), 2) + + def test_the_dm_goes_through_the_notifier_of_the_repo_of_an_issue_it_holds_up(self) -> None: + checkout = self.home / "code" / "api" + configured(self, checkout, home=self.home) + self.epic.change("ABC-21", labels=("repo:api",)) + fake = FakeEffects(git=UNREAD, windows=WINDOW) + self.awaited(fake, closes_after=1) + self.assertEqual(fake.dm_directories, [str(checkout)]) def test_the_window_of_a_closed_task_goes_on_while_another_human_task_still_holds_an_issue_up(self) -> None: self.epic.issues.extend([issue("ABC-30", "do-epic-human"), issue("ABC-31", "do-epic-claude", blockers=("ABC-30",))]) @@ -53,13 +73,6 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest): self.assertEqual(len(fake.dms), 1) self.assertIn("the chunk finished; started ABC-21, ABC-30\n", out) - def test_the_window_takes_no_running_slot_when_it_starts_the_next_chunk(self) -> None: - self.description = DESCRIPTION.replace("2", "1") - fake = FakeEffects(git=UNREAD, windows=WINDOW) - code, out, err = self.awaited(fake, closes_after=1) - self.assertEqual((code, err), (0, "")) - self.assertIn("the chunk finished; started ABC-21\n", out) - def test_a_task_that_blocks_two_issues_names_both(self) -> None: self.epic.issues.append(issue("ABC-22", "do-epic-claude", blockers=("ABC-19",))) fake = FakeEffects(git=UNREAD, windows=WINDOW) @@ -99,7 +112,7 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest): fake = FakeEffects(windows="ABC-19 awaits a human's task\t0\t@9\n") code, out, err = self.run_main(["ABC-12", "--status"], fake) self.assertEqual((code, err), (0, "")) - self.assertEqual(out.replace("<1790000000> ", "").splitlines(), ["ABC-19 waits: it is a human's task; do-epic polls until its issue closes", "ABC-21 waits: ABC-19 blocks it"]) + self.assertEqual(out.replace("<1790000000> ", "").splitlines(), [f"ABC-19 waits: {HUMAN_WAIT}", "ABC-21 waits: ABC-19 blocks it"]) def test_the_epic_starts_a_window_for_the_task_and_none_for_the_issue_it_blocks(self) -> None: fake = FakeEffects(windows="") diff --git a/bin/do_epic/test_scheduler.py b/bin/do_epic/test_scheduler.py index 60eea5c9..37e2cd9b 100644 --- a/bin/do_epic/test_scheduler.py +++ b/bin/do_epic/test_scheduler.py @@ -6,7 +6,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from do_epic.scheduler import Chunk, CHUNK_FLAG, chunks, Epic, refusal, RepoRoom, resume, start_chunks, Started, Waits +from do_epic.scheduler import Chunk, CHUNK_FLAG, chunks, Epic, HUMAN_WAIT, refusal, RepoRoom, resume, start_chunks, Started, Waits from do_epic import chunk_prompt from do_epic.backend.protocol import EpicIssue from failure import Failure @@ -189,7 +189,7 @@ class StartingAnEpicsChunks(unittest.TestCase): def test_a_human_task_with_a_window_that_awaits_it_starts_no_second_window(self) -> None: run = Tmux(("epic-ABC-12", "ABC-19 awaits a human's task", False, "")) found = self.start(self.epic(1, api=1), [issue("ABC-19", "do-epic-human"), issue("ABC-21", "repo:api", blockers=("ABC-19",))], run) - self.assertEqual(found, Started([], [Waits("ABC-19", "it is a human's task; do-epic polls until its issue closes"), Waits("ABC-21", "ABC-19 blocks it")])) + self.assertEqual(found, Started([], [Waits("ABC-19", HUMAN_WAIT), Waits("ABC-21", "ABC-19 blocks it")])) self.assertEqual(run.started(), []) def test_a_parked_chunk_that_starts_again_leaves_the_epics_cap_to_the_others(self) -> None: -- 2.52.0 From d4acb4b0392eef69889701a1c901544da6ac2c39 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 02:53:51 +0100 Subject: [PATCH 07/11] Kill the surviving mutants of the human-task window's second version --- bin/do_epic/test_human_tasks.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/do_epic/test_human_tasks.py b/bin/do_epic/test_human_tasks.py index e5fb7ad2..8bed17df 100644 --- a/bin/do_epic/test_human_tasks.py +++ b/bin/do_epic/test_human_tasks.py @@ -6,7 +6,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from project_config.test_project_config import configured -from do_epic.test_main import Description, DoEpicTest, MODELS, UNREAD +from do_epic.test_main import DESCRIPTION, Description, DoEpicTest, MODELS, UNREAD from do_epic.epic_record import EpicRecord from failure import Failure from loop_claude.test_loop_claude import FakeEffects @@ -73,6 +73,19 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest): self.assertEqual(len(fake.dms), 1) self.assertIn("the chunk finished; started ABC-21, ABC-30\n", out) + def test_the_window_leaves_itself_out_of_the_running_chunks_when_it_starts_the_next(self) -> None: + self.description = DESCRIPTION.replace("2", "1") + fake = FakeEffects(git=UNREAD, windows=WINDOW) + code, out, err = self.awaited(fake, closes_after=1) + self.assertEqual((code, err), (0, "")) + self.assertIn("the chunk finished; started ABC-21\n", out) + + def test_the_status_says_that_a_task_without_a_window_starts_at_once(self) -> None: + fake = FakeEffects(windows="") + code, out, err = self.run_main(["ABC-12", "--status"], fake) + self.assertEqual((code, err), (0, "")) + self.assertEqual(out.replace("<1790000000> ", "").splitlines()[0], "ABC-19 waits: it has not started; `do-epic ABC-12` starts it") + def test_a_task_that_blocks_two_issues_names_both(self) -> None: self.epic.issues.append(issue("ABC-22", "do-epic-claude", blockers=("ABC-19",))) fake = FakeEffects(git=UNREAD, windows=WINDOW) -- 2.52.0 From 4fac73c890531d473830d93337718dbb06f0a49b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 03:01:31 +0100 Subject: [PATCH 08/11] =?UTF-8?q?Answer=20product-owner=20round=202:=201?= =?UTF-8?q?=20=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20DM=20thr?= =?UTF-8?q?ough=20the=20notifier=20of=20a=20repo=20of=20the=20epic,=20and?= =?UTF-8?q?=20say=20in=20the=20window=20where=20none=20names=20one?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/do_epic/human_tasks.py | 15 ++++++++----- bin/do_epic/test_human_tasks.py | 40 +++++++++++++++++++++++++++------ docs/decisions.md | 2 +- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/bin/do_epic/human_tasks.py b/bin/do_epic/human_tasks.py index ea8642f8..68181c75 100644 --- a/bin/do_epic/human_tasks.py +++ b/bin/do_epic/human_tasks.py @@ -27,12 +27,12 @@ def message(task: EpicIssue, epic: str, held: list[str]) -> str: return f"do-epic {epic} awaits you: {task.key}, \"{task.summary}\", blocks {' and '.join(held)}. do-epic goes on once you close {task.key} in Jira." -def checkout_of(held: list[EpicIssue], home: pathlib.Path) -> str | None: - """The checkout of the first issue of held whose repo a project config names: where the DM finds its notifier, since the window runs in no checkout. None where there is none, and the DM goes by the current directory.""" - for issue in held: +def notifier_checkout(issues: list[EpicIssue], home: pathlib.Path) -> str | None: + """The checkout of the first of issues whose repo has a git checkout and a project config that names a notifier: where the DM finds that notifier, since the window runs in no checkout. None where there is none.""" + for issue in issues: pick = recorded(issue) found = by_name(pick.name, home) if isinstance(pick, Repo) else None - if isinstance(found, ProjectConfig): + if isinstance(found, ProjectConfig) and found.notifier and (found.top / ".git").exists(): return str(found.top) return None @@ -52,6 +52,9 @@ def awaited(task: EpicIssue, epic: str, store: EpicStore, window: tmux.Window, p elif not told: text = message(task, epic, held) say(text, effects, stdout=True) - by_key = {issue.key: issue for issue in issues} - told = tell(text, effects, checkout_of([by_key[key] for key in held], home)) + # The issues it holds up come first; any other open issue of the epic may do where they have no repo with a notifier. + where = notifier_checkout([*(issue for issue in issues if issue.key in held), *(issue for issue in issues if issue.key not in held and not issue.done)], home) + if where is None: + say("no DM went out: no open issue of the epic has a repo whose project config names a notifier and whose checkout exists", effects, stdout=True) + told = where is None or tell(text, effects, where) effects.sleep(poll) diff --git a/bin/do_epic/test_human_tasks.py b/bin/do_epic/test_human_tasks.py index 8bed17df..163de91c 100644 --- a/bin/do_epic/test_human_tasks.py +++ b/bin/do_epic/test_human_tasks.py @@ -1,5 +1,6 @@ import dataclasses import pathlib +import shutil import sys import unittest @@ -21,10 +22,20 @@ WINDOW = "ABC-19\t0\t@9\n" class AHumanTaskThatBlocksAnIssue(DoEpicTest): def setUp(self) -> None: super().setUp() - self.issues = [issue("ABC-19", "do-epic-human"), issue("ABC-21", "do-epic-claude", blockers=("ABC-19",))] + self.issues = [issue("ABC-19", "do-epic-human"), issue("ABC-21", "repo:api", blockers=("ABC-19",))] self.issues[0] = dataclasses.replace(self.issues[0], summary="Order the test certificate") self.epic = MemoryEpic("ABC-12", self.issues) self.backend = lambda config, key: (self.epic, EpicRecord(Description(self.description))) # type: ignore[method-assign, arg-type] + self.api = self.repo("api", notifier=True) + + def repo(self, name: str, notifier: bool) -> pathlib.Path: + """Makes the checkout of the repo called name that a project config names, with a notifier where notifier.""" + checkout = self.home / "code" / name + folder = configured(self, checkout, home=self.home) + if notifier: + with (folder / "config.toml").open("a") as config: + config.write('env-file = "~/.claude-projects/notifier.env"\nnotifier = "slack"\n') + return checkout def awaited(self, fake: FakeEffects, closes_after: int) -> tuple[int, str, str]: """The window's run, where the human closes the task once the window has slept closes_after times.""" @@ -49,7 +60,7 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest): self.assertEqual([args for args in fake.tmux_calls if args[0] == "rename-window"], [["rename-window", "-t", "%1", "ABC-19 awaits a human's task"]]) self.assertIn("the chunk finished; started ABC-21\n", out) self.assertEqual([seam for seam, _ in fake.calls if seam == "stream_claude"], []) - self.assertEqual(fake.dm_directories, [None]) + self.assertEqual(fake.dm_directories, [str(self.api)]) self.assertIn(fake.dms[0], out) def test_a_dm_that_failed_is_sent_again_on_the_next_read(self) -> None: @@ -57,13 +68,28 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest): self.awaited(fake, closes_after=2) self.assertEqual(len(fake.dms), 2) - def test_the_dm_goes_through_the_notifier_of_the_repo_of_an_issue_it_holds_up(self) -> None: - checkout = self.home / "code" / "api" - configured(self, checkout, home=self.home) - self.epic.change("ABC-21", labels=("repo:api",)) + def test_the_dm_goes_through_the_notifier_of_the_repo_of_an_issue_it_holds_up_before_any_other_repo(self) -> None: + self.repo("web", notifier=True) + self.epic.issues.append(issue("ABC-40", "repo:web")) fake = FakeEffects(git=UNREAD, windows=WINDOW) self.awaited(fake, closes_after=1) - self.assertEqual(fake.dm_directories, [str(checkout)]) + self.assertEqual(fake.dm_directories, [str(self.api)]) + + def test_the_dm_goes_through_the_notifier_of_another_open_issues_repo_where_the_held_up_issue_has_none(self) -> None: + self.epic.change("ABC-21", labels=("do-epic-claude",)) + self.epic.issues.append(issue("ABC-40", "repo:api")) + fake = FakeEffects(git=UNREAD, windows=WINDOW) + self.awaited(fake, closes_after=1) + self.assertEqual(fake.dm_directories, [str(self.api)]) + + def test_says_in_the_window_that_no_dm_went_out_where_no_repo_of_the_epic_names_a_notifier(self) -> None: + self.epic.change("ABC-21", labels=("repo:web",)) + self.repo("web", notifier=False) + shutil.rmtree(self.api) + fake = FakeEffects(git=UNREAD, windows=WINDOW) + code, out, err = self.awaited(fake, closes_after=1) + self.assertEqual((code, err, fake.dms), (0, "", [])) + self.assertEqual(out.count("no DM went out"), 1, out) def test_the_window_of_a_closed_task_goes_on_while_another_human_task_still_holds_an_issue_up(self) -> None: self.epic.issues.extend([issue("ABC-30", "do-epic-human"), issue("ABC-31", "do-epic-claude", blockers=("ABC-30",))]) diff --git a/docs/decisions.md b/docs/decisions.md index e970b8a9..0bdff439 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -154,7 +154,7 @@ Valid while `~/.claude` is a checkout of this repo. - **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//`. 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 ` 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 --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 ` 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. -- **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, 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. +- **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 open 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. - **Tests.** Black-box tests run against a fake Jira backend. An opt-in e2e test runs as its own command against a sandbox epic on a real Jira site. -- 2.52.0 From b63f79ff0bfdcaa69c372880e77dc81a9f0e41dd Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 03:17:32 +0100 Subject: [PATCH 09/11] Order the issues the DM tries by sorting, and pin the window's no-DM line --- bin/do_epic/human_tasks.py | 6 +++--- bin/do_epic/test_human_tasks.py | 2 +- docs/decisions.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/do_epic/human_tasks.py b/bin/do_epic/human_tasks.py index 68181c75..2eff5f23 100644 --- a/bin/do_epic/human_tasks.py +++ b/bin/do_epic/human_tasks.py @@ -52,9 +52,9 @@ def awaited(task: EpicIssue, epic: str, store: EpicStore, window: tmux.Window, p elif not told: text = message(task, epic, held) say(text, effects, stdout=True) - # The issues it holds up come first; any other open issue of the epic may do where they have no repo with a notifier. - where = notifier_checkout([*(issue for issue in issues if issue.key in held), *(issue for issue in issues if issue.key not in held and not issue.done)], home) + # The issues it holds up come first; any other issue of the epic may do where they have no repo with a notifier. + where = notifier_checkout(sorted(issues, key=lambda issue: issue.key not in held), home) if where is None: - say("no DM went out: no open issue of the epic has a repo whose project config names a notifier and whose checkout exists", effects, stdout=True) + say("no DM went out: no issue of the epic has a repo whose project config names a notifier and whose checkout exists", effects, stdout=True) told = where is None or tell(text, effects, where) effects.sleep(poll) diff --git a/bin/do_epic/test_human_tasks.py b/bin/do_epic/test_human_tasks.py index 163de91c..2c251797 100644 --- a/bin/do_epic/test_human_tasks.py +++ b/bin/do_epic/test_human_tasks.py @@ -89,7 +89,7 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest): fake = FakeEffects(git=UNREAD, windows=WINDOW) code, out, err = self.awaited(fake, closes_after=1) self.assertEqual((code, err, fake.dms), (0, "", [])) - self.assertEqual(out.count("no DM went out"), 1, out) + self.assertEqual(out.count("<1790000000> no DM went out"), 1, out) def test_the_window_of_a_closed_task_goes_on_while_another_human_task_still_holds_an_issue_up(self) -> None: self.epic.issues.extend([issue("ABC-30", "do-epic-human"), issue("ABC-31", "do-epic-claude", blockers=("ABC-30",))]) diff --git a/docs/decisions.md b/docs/decisions.md index 0bdff439..0c59f67e 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -154,7 +154,7 @@ Valid while `~/.claude` is a checkout of this repo. - **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//`. 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 ` 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 --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 ` 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. -- **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 open 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. +- **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. - **Tests.** Black-box tests run against a fake Jira backend. An opt-in e2e test runs as its own command against a sandbox epic on a real Jira site. -- 2.52.0 From dd9f00f09fe7ee707c8cd39c30446fea4925dd16 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 03:28:32 +0100 Subject: [PATCH 10/11] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20nothing=20t?= =?UTF-8?q?o=20answer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From b3398bcacea23a4e7ad3fe9fc22f8e621935adc3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 19 Nov 2026 03:47:39 +0100 Subject: [PATCH 11/11] Finish item 414 in the plan --- CHANGELOG.md | 1 + todo.md | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 997c1d97..f9f82176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- do-epic gives a `do-epic-human` issue that blocks another its own window: it DMs you once through the notifier of one of the epic's repos, takes no running slot, and polls until you close the issue in Jira, when the issues it held up may start. - do-epic tells an epic chunk's worker how its repo ships the change: a bullet under the repo's changelog where the repo publishes something, none where its plan is in Jira, and no `--finish` for `chunk-pr merge`. - `do-epic --status` says which chunk asks you a question, and since when each parked chunk has awaited its gate. - do-epic moves a chunk's issue to done in Jira when the chunk finishes, and the split item it belongs to once its last sub-task is done, so no finished chunk starts again and the chunks it blocks start. It moves them by the transition `jira-finish-transition` and `jira-finish-status` name, so set both; without them a finishing chunk stops with that reason. diff --git a/todo.md b/todo.md index 1a0f3271..58098668 100644 --- a/todo.md +++ b/todo.md @@ -13,7 +13,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| | 420 | 0.12.0 | | | **End a worker that printed its final result and lingers, by killing the background shells it left, after a few minutes, and print each kill with its evidence on loop-claude's terminal.** | 2 | 2 | 2 | 4 | 3 | 1.5 by 6 | 2.0 | -| 414 | 0.12.0 | | | **DM the human through the notifier when a human-task issue blocks the epic's next item, and poll until it closes.** | 2 | 2 | 2 | 4 | 3 | 1 by 5 | 1.9 | | 417 | 0.12.0 | | | **Run do-epic end to end against a sandbox epic on a real Jira site with a command of its own, outside `run-tests`.** | 2 | 1 | 1 | 2 | 3 | 1 by 5 | 1.9 | | 442 | 0.12.0 | | | **Have `do-epic ` split each open issue by repo, pick the repo of each issue that no label names one for, asking the human where unclear, and re-rank the epic, before it starts chunks.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 | | 310 | 0.12.0 | | | **Compact a waiting worker's session shortly before its prompt cache expires, only when the human has not answered an interrupt by then.** | 3 | 2 | 3 | 6 | 4 | 1.4 by 3 | 0.9 | @@ -86,15 +85,6 @@ Touches: - `bin/loop_claude/loop/lingering_workers.py` - `README.md`: `## Tools` (small) -### 414. DM the human through the notifier when a human-task issue blocks the epic's next item, and poll until it closes. - -do-epic leaves the issue as the team filed it (`docs/decisions.md` → `do-epic: drives one Jira epic …`). - -Touches: - -- `bin/agent_cycle/direct_message.py`: `tell` (small) -- `bin/do_epic/human_tasks.py` - ### 417. Run do-epic end to end against a sandbox epic on a real Jira site with a command of its own, outside `run-tests`. The sandbox is the Jira site `larvit.atlassian.net`, project `SCRUM`: a team-managed test-data space with Epic, Task, Story and Subtask issue types. The test creates its own epic there, with children and sub-tasks, and deletes them when it ends, so it leaves the space's other issues alone. Its account may create, edit, transition, comment on and delete issues in `SCRUM`. The command reads the env-file's path, holding `ATLASSIAN_EMAIL` and `ATLASSIAN_API_TOKEN`, from a setting of its own, never from the repo. -- 2.52.0