Answer product-owner round 2: 1 🔴, 0 🟡 (0 misread); DM through the notifier of a repo of the epic, and say in the window where none names one

This commit is contained in:
2026-11-19 03:01:31 +01:00
parent d4acb4b039
commit 4fac73c890
3 changed files with 43 additions and 14 deletions
+9 -6
View File
@@ -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)
+33 -7
View File
@@ -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",))])
+1 -1
View File
@@ -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/<EPIC-KEY>/`. do-epic archives its cycles under `~/.claude/do-epic-transcripts/`, not in loop-claude's archive, whose readers parse loop-claude's prompts. An open issue runs once a label records its repo; until do-epic picks repos itself, an issue without one waits, and `do-epic <EPIC-KEY>` says so.
- **Long gates.** A chunk whose PR waits on a gate, such as a human approval, parks. It keeps its worktree, PR and session, and its state is in a file that survives a reboot. A parked chunk takes no running slot, and the items it blocks wait. do-epic polls the forge and resumes the chunk's session when the gate passes or a reviewer comments. It fixes reasonable feedback, replies to the rest, and changes the setup so review would have caught it. `do-epic <key> --status` and the tmux window names show what each chunk waits on. A gate is a pull request's pending checks or, on GitHub, the approval its branch protection requires; a draft waits on neither, since its worker has yet to mark it ready. On Gitea a draft is a pull request whose title opens with `WIP:` or `[WIP]`, Gitea's default `WORK_IN_PROGRESS_PREFIXES`. Changes a reviewer requested resume the chunk only while that review was made on the pull request's head commit and the pull request's author has not commented or replied after it; once the worker pushed or replied, the chunk parks on a new review, since GitHub keeps the decision until the reviewer reviews again. The chunk's window reads the forge once a minute, which no forge's rate limit notices. A chunk resumes only into a free slot, under the limits a starting chunk meets, and stays parked until then. `do-epic <key>` starts a parked chunk's window again whatever the limits, since the chunk stays parked. do-epic sets `CHUNK_PR_PARKS=1` for each worker, so `chunk-pr merge` fails at once where the pull request awaits an approval, and the worker's run doesn't hold a slot while the pull request waits.
- **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.