From 11ee0f7bbfba813f22fee4dbc2e171cc7ff6e75a Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 21:37:01 +0100 Subject: [PATCH 1/9] Resume a chunk that awaits a person's merge once its pull request no longer merges into its base --- README.md | 2 +- bin/do_epic/gates.py | 14 ++++++---- bin/do_epic/test_gates.py | 26 +++++++++++++++--- bin/forge/pulls.py | 30 ++++++++++++++++++++- bin/forge/test_forge.py | 38 ++++++++++++++++++++++++++- docs/decisions.md | 2 +- skills/larv-review/standards/prose.md | 1 + 7 files changed, 101 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0cafcbbf..592eff7f 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ A legacy project with no container setup sets `tooling-on-host = true`, so the l A project whose pull requests need a human's approval sets `wait-for-approval = true` in its config. `chunk-pr merge` then waits, once the checks have passed, until GitHub reports the pull request approved as its branch protection requires, and merges it. It refuses on Gitea, where a reviewer requested changes and where the protection requires no review. While it waits, other chunks merge. It stops where a reviewer's comment waits for an answer, on an approved pull request too; answer it and run it again. It gives up after 90 minutes without an approval; run it again once the pull request is approved. Left out, the setting is false. -A project whose team merges its pull requests itself sets `merge = "human"`. `chunk-pr merge` then brings the branch level with origin's default branch, finishes the chunk's plan items, waits for the checks and marks the pull request ready, but leaves the merge to a person. A plan or changelog kept in the checkout is finished on the branch, so it lands with that merge; one kept in Jira, or in the config's folder, is finished at once. A do-epic chunk parks until the pull request is merged, and its window's name says `awaits your merge`. Left out, the setting is `"chunk"`: the chunk merges. +A project whose team merges its pull requests itself sets `merge = "human"`. `chunk-pr merge` then brings the branch level with origin's default branch, finishes the chunk's plan items, waits for the checks and marks the pull request ready, but leaves the merge to a person. A plan or changelog kept in the checkout is finished on the branch, so it lands with that merge; one kept in Jira, or in the config's folder, is finished at once. A do-epic chunk parks until the pull request is merged, and its window's name says `awaits your merge`. Where the pull request meanwhile conflicts with the default branch, or is behind it where GitHub's branch protection requires an up-to-date branch, the chunk resumes and brings the branch level again. Left out, the setting is `"chunk"`: the chunk merges. For a client's project, use one sandbox VM per client, so that one client's code, transcripts and credentials never share a machine with another's. What the client's repo should not hold lives in the config's folder, at paths written as `folder:`, as `project-config --help` shows: the plan, the working rules in an `AGENTS.md` I write for the agents, the records, and the goals and audience, as `goals-and-audience = "folder:goals.md"`. Name that file `goals.md`, so the rules for goals and audience load when an agent writes it. A file outside the checkout has no commits in the checkout's history, so four things are not supported for it yet. `score-outcomes` and loop-claude's routing figures count a project's chunks only where `todo.md`, `docs/comprehension-history.md` and `docs/reading-cost.md` are at those paths in the checkout; otherwise each says so, and the loop goes on. For a plan or a comprehension history outside the checkout, `larv-review` says it cannot tell whether a scoring run is owed, and for such a history it cannot find a paired ruling's base. For a plan outside the checkout, chunk-preflight and loop-claude don't see a release whose last item has shipped, and say that its release review and its cut are yours to call. And rule-hook checks a plan outside the checkout on every call, not only when it changed. diff --git a/bin/do_epic/gates.py b/bin/do_epic/gates.py index dd2877b3..b1f28ebe 100644 --- a/bin/do_epic/gates.py +++ b/bin/do_epic/gates.py @@ -5,7 +5,7 @@ import dataclasses import typing from forge.reviews import ANSWERED, APPROVED, CHANGES_REQUESTED, review_decision, REVIEW_REQUIRED, waiting_threads -from forge.pulls import CheckFailed, checks_now, open_pull, Pending, required_checks +from forge.pulls import CheckFailed, checks_now, open_pull, Pending, required_checks, unmergeable from failure import Failure from forge.commands import forge_of, Run @@ -42,7 +42,7 @@ class Unopened(Open): def gate(branch: str, checkout: str, at: typing.Callable[[str], Run], by_human: bool) -> Gate | Open | Failure: """What the chunk on branch waits on, in a worktree of checkout; at gives the runner of commands in a folder, and by_human says the project's config leaves the merge to a person (`merge = "human"`). A Failure where git or the forge cannot be read, which doesn't say anything about the gate. - A draft never waits on a gate: its worker still works on it. On Gitea only the checks are a gate, since chunk-pr reads approvals on GitHub only (`chunk_pr.approval.awaited`). Changes a reviewer requested are news until the worker answered them (`forge.reviews.answered`); from then on the pull request awaits a new review. Where a person merges, a pull request with nothing else to wait on awaits that merge, and the chunk has news again once the pull request is no longer open. + A draft never waits on a gate: its worker still works on it. On Gitea only the checks are a gate, since chunk-pr reads approvals on GitHub only (`chunk_pr.approval.awaited`). Changes a reviewer requested are news until the worker answered them (`forge.reviews.answered`); from then on the pull request awaits a new review. Where a person merges, a pull request with nothing else to wait on awaits that merge. The chunk has news again once the pull request is no longer open, or no longer merges into its base as it stands (`forge.pulls.unmergeable`), so the worker levels it for that person. """ worktree = worktree_of(branch, at(checkout)) if not isinstance(worktree, str): @@ -77,9 +77,13 @@ def gate(branch: str, checkout: str, at: typing.Callable[[str], Run], by_human: return Open(f"a reviewer's comment on pull request #{pull} waits for an answer, in {', '.join(waiting)}") if decision in (ANSWERED, REVIEW_REQUIRED): return Gate(worktree, pull, NEW_REVIEW if decision == ANSWERED else APPROVAL) - if by_human: - return Gate(worktree, pull, MERGE) - return Open(f"pull request #{pull} passed its checks" + (" and is approved" if decision == APPROVED else "")) + if not by_human: + return Open(f"pull request #{pull} passed its checks" + (" and is approved" if decision == APPROVED else "")) + blocked = unmergeable(forge, pull, run) + if isinstance(blocked, Failure): + return blocked + # The same flags, since merge passes over an item an earlier run finished, and finishes one that resolving a conflict brought back. + return Open(f"pull request #{pull} {blocked}; run chunk-pr merge again, with the flags it had, to level the branch") if blocked else Gate(worktree, pull, MERGE) def worktree_of(branch: str, run: Run) -> str | None | Failure: diff --git a/bin/do_epic/test_gates.py b/bin/do_epic/test_gates.py index 36a68cdb..df287192 100644 --- a/bin/do_epic/test_gates.py +++ b/bin/do_epic/test_gates.py @@ -28,7 +28,7 @@ def comment(by: str, at: str) -> dict: class Forge: """Stands in for git and the forge's CLI in the checkout and the chunk's worktree; `ran` holds each folder a command ran in. Only the CLI of origin's forge answers: `gh` fails on a Gitea origin, and `tea` on a GitHub one.""" - def __init__(self, origin: str = "git@github.com:o/billing.git", pulls: str = f"7\t{HEAD}\tfalse\n", draft: bool = False, decision: str = "REVIEW_REQUIRED", buckets: tuple[str, ...] = ("pass",), threads: tuple[dict, ...] = (), status: str = '{"state": "success", "total_count": 1}', worktrees: str = WORKTREES, fails: str = "", reviews: tuple[dict, ...] = (), comments: tuple[dict, ...] = (), title: str = "Add x") -> None: + def __init__(self, origin: str = "git@github.com:o/billing.git", pulls: str = f"7\t{HEAD}\tfalse\n", draft: bool = False, decision: str = "REVIEW_REQUIRED", buckets: tuple[str, ...] = ("pass",), threads: tuple[dict, ...] = (), status: str = '{"state": "success", "total_count": 1}', mergeable: str = "MERGEABLE", merge_state: str = "CLEAN", worktrees: str = WORKTREES, fails: str = "", reviews: tuple[dict, ...] = (), comments: tuple[dict, ...] = (), title: str = "Add x") -> None: self.cli = "gh" if "github.com" in origin else "tea" self.ran: list[str] = [] self.commands: list[list[str]] = [] @@ -39,11 +39,11 @@ class Forge: "git rev-parse": HEAD + "\n", "git symbolic-ref": "origin/main\n", "gh pr list": pulls, - "gh pr view": json.dumps({"isDraft": draft, "reviewDecision": decision, "author": {"login": "worker"}, "reviews": list(reviews), "comments": list(comments)}), + "gh pr view": json.dumps({"isDraft": draft, "reviewDecision": decision, "author": {"login": "worker"}, "reviews": list(reviews), "comments": list(comments), "mergeable": mergeable, "mergeStateStatus": merge_state}), "gh pr checks": json.dumps([{"bucket": bucket} for bucket in buckets]), "gh api graphql": json.dumps({"data": {"repository": {"pullRequest": {"author": {"login": "worker"}, "reviewThreads": {"nodes": list(threads)}}}}}), "tea api repos/{owner}/{repo}/pulls?state=open&limit=50": json.dumps([{"number": 7, "merged": False, "head": {"label": "ABC-21", "sha": HEAD, "repo": {"full_name": "o/billing"}}, "base": {"repo": {"full_name": "o/billing"}}}]), - "tea api repos/{owner}/{repo}/pulls/7": json.dumps({"number": 7, "title": title}), + "tea api repos/{owner}/{repo}/pulls/7": json.dumps({"number": 7, "title": title, "mergeable": mergeable == "MERGEABLE"}), "tea api repos/{owner}/{repo}/branches/main": '{"name": "main"}', "tea api repos/{owner}/{repo}/commits/" + HEAD + "/status": status, } @@ -79,6 +79,26 @@ class GateOfAChunk(unittest.TestCase): self.assertEqual(forge.gate(by_human=True), Gate("/code/billing-ABC-21", "7", MERGE)) self.assertEqual(Forge(decision="APPROVED").gate(by_human=False), Open("pull request #7 passed its checks and is approved")) + def test_where_a_person_merges_a_pull_request_that_no_longer_merges_into_its_base_is_news_to_level_it(self): + gitea = "https://gitea.larvit.se/o/billing.git" + again = "run chunk-pr merge again, with the flags it had, to level the branch" + self.assertEqual(Forge(decision="APPROVED", mergeable="CONFLICTING", merge_state="DIRTY").gate(by_human=True), Open(f"pull request #7 conflicts with its base branch; {again}")) + self.assertEqual(Forge(gitea, mergeable="CONFLICTING").gate(by_human=True), Open(f"pull request #7 conflicts with its base branch; {again}")) + self.assertEqual(Forge(decision="", merge_state="BEHIND").gate(by_human=True), Open(f"pull request #7 is behind its base branch, whose protection requires it up to date; {again}")) + + def test_where_a_person_merges_a_pull_request_awaits_that_merge_while_github_computes_whether_it_merges(self): + self.assertEqual(Forge(decision="APPROVED", mergeable="UNKNOWN", merge_state="UNKNOWN").gate(by_human=True), Gate("/code/billing-ABC-21", "7", MERGE)) + + def test_where_a_person_merges_a_mergeability_that_cannot_be_read_is_a_failure(self): + forge = Forge("https://gitea.larvit.se/o/billing.git") + forge.answers["tea api repos/{owner}/{repo}/pulls/7"] = '{"number": 7, "title": "Add x"}' + self.assertEqual(forge.gate(by_human=True), Failure("tea api answered pull request 7 in a shape that can't be read: {'number': 7, 'title': 'Add x'}")) + + def test_where_the_loop_merges_nobody_reads_whether_the_pull_request_merges(self): + forge = Forge(decision="APPROVED", mergeable="CONFLICTING") + self.assertEqual(forge.gate(), Open("pull request #7 passed its checks and is approved")) + self.assertNotIn(["gh", "pr", "view", "7", "--json", "mergeable,mergeStateStatus"], forge.commands) + def test_where_a_person_merges_every_other_gate_and_all_news_stay_as_they_are(self): same = (Forge(), Forge(buckets=("pending",)), Forge(draft=True), Forge(decision="CHANGES_REQUESTED"), Forge(threads=(thread(False, "reviewer"),)), Forge(buckets=("fail",)), Forge(pulls="")) for forge in same: diff --git a/bin/forge/pulls.py b/bin/forge/pulls.py index 42b1bd31..de0b4ccc 100644 --- a/bin/forge/pulls.py +++ b/bin/forge/pulls.py @@ -1,4 +1,4 @@ -"""Finding a pull request from origin's own branch, and waiting for the checks on its head commit.""" +"""Finding a pull request from origin's own branch, reading whether it merges into its base, and waiting for the checks on its head commit.""" import dataclasses import fnmatch import json @@ -44,6 +44,34 @@ def pull_at(forge: Forge, branch: str, head: str, state: typing.Literal["open", return Failure(f"tea api listed pull requests in a shape that can't be read: {str(pulls)[:200]}") +# Why a pull request doesn't merge into its base as it stands, as the words after "pull request #". +CONFLICTS = "conflicts with its base branch" +BEHIND = "is behind its base branch, whose protection requires it up to date" + + +def unmergeable(forge: Forge, number: str, run: Run) -> str | None | Failure: + """Why pull request number doesn't merge into its base as it stands: CONFLICTS or BEHIND. None where it merges, and while GitHub still computes whether it does. + + GitHub reports a pull request as behind only where the base's protection requires an up-to-date branch. Gitea's `mergeable` never tells that case. It is also false for the seconds Gitea checks for conflicts after a push to either branch, which reads as CONFLICTS here. + """ + if forge == "gh": + viewed = run(["gh", "pr", "view", number, "--json", "mergeable,mergeStateStatus"]) + if isinstance(viewed, Failure): + return viewed + try: + state = json.loads(viewed) + return CONFLICTS if state["mergeable"] == "CONFLICTING" else BEHIND if state["mergeStateStatus"] == "BEHIND" else None + except (ValueError, KeyError, TypeError): + return Failure(f"gh pr view printed no mergeability: {viewed.strip()[:200]}") + pull = gitea(run, f"repos/{{owner}}/{{repo}}/pulls/{number}") + if isinstance(pull, Failure): + return pull + try: + return CONFLICTS if pull["mergeable"] is False else None + except (KeyError, TypeError): + return Failure(f"tea api answered pull request {number} in a shape that can't be read: {str(pull)[:200]}") + + def required_checks(forge: Forge, base: str, run: Run) -> set[str] | Failure: """The checks, or glob patterns of checks, that the forge's protection of the branch base requires before a merge. None on GitHub, where gh's watch covers them. diff --git a/bin/forge/test_forge.py b/bin/forge/test_forge.py index da917564..4e642923 100644 --- a/bin/forge/test_forge.py +++ b/bin/forge/test_forge.py @@ -6,7 +6,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from forge.pulls import CheckFailed, checks_now, checks_passed, open_pull, Pending, POLL_SECONDS, required_checks, WAIT_SECONDS +from forge.pulls import BEHIND, CheckFailed, checks_now, checks_passed, CONFLICTS, open_pull, Pending, POLL_SECONDS, required_checks, unmergeable, WAIT_SECONDS from failure import Failure from forge.commands import forge_of, gitea, url_beside @@ -47,6 +47,42 @@ class OpenPull(unittest.TestCase): self.assertEqual(open_pull("tea", "item-3", "abc", lambda command: LONG).reason, f"tea api listed pull requests in a shape that can't be read: {LONG[:200]}") +class Unmergeable(unittest.TestCase): + def gh(self, mergeable: str, state: str) -> str | None | Failure: + commands: list[list[str]] = [] + answer = unmergeable("gh", "7", lambda command: commands.append(command) or f'{{"mergeable": "{mergeable}", "mergeStateStatus": "{state}"}}') + self.assertEqual(commands, [["gh", "pr", "view", "7", "--json", "mergeable,mergeStateStatus"]]) + return answer + + def test_a_github_pull_request_that_conflicts_with_its_base_says_so(self): + self.assertEqual(self.gh("CONFLICTING", "DIRTY"), CONFLICTS) + + def test_a_github_pull_request_behind_a_base_that_requires_it_up_to_date_says_so(self): + self.assertEqual(self.gh("MERGEABLE", "BEHIND"), BEHIND) + + def test_a_github_pull_request_merges_whatever_else_holds_it_and_while_github_computes(self): + for mergeable, state in (("MERGEABLE", "CLEAN"), ("MERGEABLE", "BLOCKED"), ("MERGEABLE", "UNSTABLE"), ("UNKNOWN", "UNKNOWN")): + with self.subTest(mergeable=mergeable, state=state): + self.assertIsNone(self.gh(mergeable, state)) + + def test_a_gitea_pull_request_conflicts_only_where_gitea_says_it_is_not_mergeable(self): + commands: list[list[str]] = [] + self.assertEqual(unmergeable("tea", "7", lambda command: commands.append(command) or '{"number": 7, "mergeable": false}'), CONFLICTS) + self.assertEqual(commands, [["tea", "api", "repos/{owner}/{repo}/pulls/7"]]) + self.assertIsNone(unmergeable("tea", "7", lambda command: '{"number": 7, "mergeable": true}')) + + def test_fails_where_the_forge_cannot_be_read_or_answers_in_another_shape(self): + unread = Failure("no network") + for forge in ("gh", "tea"): + with self.subTest(forge=forge): + self.assertIs(unmergeable(forge, "7", lambda command: unread), unread) + self.assertEqual(unmergeable("gh", "7", lambda command: LONG).reason, f"gh pr view printed no mergeability: {LONG[:200]}") + self.assertEqual(unmergeable("gh", "7", lambda command: "not json").reason, "gh pr view printed no mergeability: not json") + self.assertEqual(unmergeable("gh", "7", lambda command: '{"mergeable": "MERGEABLE"}').reason, 'gh pr view printed no mergeability: {"mergeable": "MERGEABLE"}') + self.assertEqual(unmergeable("tea", "7", lambda command: LONG).reason, f"tea api answered pull request 7 in a shape that can't be read: {LONG[:200]}") + self.assertEqual(unmergeable("tea", "7", lambda command: '{"number": 7}').reason, "tea api answered pull request 7 in a shape that can't be read: {'number': 7}") + + def tea(statuses: typing.Iterable[str], branch: str = '{"name": "main"}') -> typing.Callable[[list[str]], str]: """A tea answering each read of the head's status with the next of statuses, and of branch main with branch.""" answers = iter(statuses) diff --git a/docs/decisions.md b/docs/decisions.md index a5c4b71d..95a56c28 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -153,7 +153,7 @@ Valid while `~/.claude` is a checkout of this repo. - **Releases.** An epic item has no release. It ships into its repo's unreleased work: where the repo publishes something others consume, a bullet under `CHANGELOG.md` → `## Unreleased`, or nothing where the repo's plan is in Jira. The issue is no item of the repo's plan, so the chunk's worker writes the bullet in its branch and runs `chunk-pr merge` without `--finish`. - **Repos.** A repo's name is its main checkout's folder name, and a project config names that checkout. A missing checkout is cloned from the host of the epic's other repos; where unsure, do-epic asks. Unsure means the other repos don't all sit under one host and owner (the same host spelt as https and as ssh counts as two), an origin can't be read or isn't an https, ssh or scp-style address, the folder to clone into holds something else, or the clone fails. A repo no config names is cloned into the clone folder, and the human is asked to write its config. Each chunk uses its repo's model, routing, and language for commits and PRs. Jira text is in the epic's language, or else the machine's default. - **Running.** The epic caps the chunks running at once, and each repo's `parallel-chunks` still applies. do-epic and loop-claude never run chunks in the same repo at once. The cap is a line of the epic's description, `**Max parallel chunks:** 2`, and 1 without it, as `parallel-chunks` is. A repo's `parallel-chunks` counts the chunks of every epic in its checkout. Each window is named for its issue's key, and a tmux window option, `@chunk-root`, names the folder its chunk works in, which is how loop-claude sees do-epic's chunks in a checkout. do-epic and loop-claude each hold the checkout's `starting` lock from checking the checkout's chunks to starting a window there. A chunk without a repo works in `~/.local/state/do-epic//`. 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. In a repo whose config sets `merge = "human"`, the merge itself is a gate: `chunk-pr merge` leaves the pull request ready, the chunk parks on `your merge` once nothing else holds the pull request, and it resumes when the forge no longer reports the pull request open, to clean up and finish. The judge may rule such a chunk finished while its pull request is open, since its worker ends each run there. So do-epic reads a gate it could not read again before it hands the chunk on, and tells the worker once to remove a worktree whose pull request is no longer open. +- **Long gates.** A chunk whose PR waits on a gate, such as a human approval, parks. It keeps its worktree, PR and session, and its state is in a file that survives a reboot. A parked chunk takes no running slot, and the items it blocks wait. do-epic polls the forge and resumes the chunk's session when the gate passes or a reviewer comments. It fixes reasonable feedback, replies to the rest, and changes the setup so review would have caught it. `do-epic --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. In a repo whose config sets `merge = "human"`, the merge itself is a gate: `chunk-pr merge` leaves the pull request ready, the chunk parks on `your merge` once nothing else holds the pull request, and it resumes when the forge no longer reports the pull request open, to clean up and finish. It resumes too once the pull request conflicts with its base branch, or is behind it where GitHub's branch protection requires an up-to-date branch, so the person finds a pull request they can merge: the worker runs `chunk-pr merge` again with the flags it had, which levels the branch, passes over each item already finished, waits for the checks and leaves the pull request ready. While GitHub still computes whether the pull request merges, the chunk stays parked until the next read. Gitea reports a pull request as not mergeable also for the seconds it checks for conflicts; a read in those seconds resumes the chunk for a run that changes nothing, which is cheaper than a second read every minute to rule it out. The judge may rule such a chunk finished while its pull request is open, since its worker ends each run there. So do-epic reads a gate it could not read again before it hands the chunk on, and tells the worker once to remove a worktree whose pull request is no longer open. - **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. diff --git a/skills/larv-review/standards/prose.md b/skills/larv-review/standards/prose.md index 43316a18..19112d77 100644 --- a/skills/larv-review/standards/prose.md +++ b/skills/larv-review/standards/prose.md @@ -12,3 +12,4 @@ Everything written — chat, commit messages, comments, docs, code — is in **E - **Write the thing, not an introduction to it.** A sentence announcing what follows, or flagging that it deserves attention, doesn't carry anything — if it matters, it is in what follows. A bare label is fine. BANNED: `Here's the new audience text, which is the part that needs your eye:`, `One thing I changed that deserves your attention.`, `One judgment call I'd flag rather than bury.`, `Three things came along that would otherwise have been left false.` GOOD: `New audience text:`, or the list alone. - **Write negations as people say them.** After a verb, or after its preposition, write `doesn't anything` or `anyone`, never ` nothing` or `no one`; each breach is a 🟡. BANNED: `stops nothing`, `depends on no one`, `so answering in time costs nothing`. GOOD: `doesn't stop anything`, `doesn't depend on anyone`, `so answering in time doesn't cost anything`. - **No contrastive tail.** `X rather than Y`, `not Y but X`, `instead of Y`: state X and stop. The rejected alternative is noise unless naming it stops a reader choosing Y. BANNED: `verified in CI rather than asserted`. GOOD: `verified in CI`. +- **A sentence about several named things holds for each of them.** Where one sentence gives a property to several named tables, fields, flags or files, check the property in each one's source. Where it fails for one, split the sentence. BANNED, where only `repos` has the column: `Each row of the repos and labels tables has a name`. GOOD: `Each row of the repos table has a name. A row of the labels table has only its label`. -- 2.52.0 From fc4b0387d6b9ba9aeac9b2884fe411eec3ded2f8 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 21:58:17 +0100 Subject: [PATCH 2/9] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 547afc6cf28c409a4d982261d63394ff5e42120f Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 22:04:59 +0100 Subject: [PATCH 3/9] =?UTF-8?q?Answer=20stability=20round=201:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(1=20misread);=20tell=20a=20?= =?UTF-8?q?finished=20chunk's=20worker=20of=20a=20pull=20request=20that=20?= =?UTF-8?q?no=20longer=20merges,=20in=20place=20of=20handing=20the=20chunk?= =?UTF-8?q?=20on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/do_epic/gates.py | 10 +++++++--- bin/do_epic/main.py | 8 ++++++-- bin/do_epic/test_gates.py | 12 ++++++------ bin/do_epic/test_main.py | 14 ++++++++++++++ docs/decisions.md | 2 +- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/bin/do_epic/gates.py b/bin/do_epic/gates.py index b1f28ebe..1c6494cd 100644 --- a/bin/do_epic/gates.py +++ b/bin/do_epic/gates.py @@ -39,10 +39,15 @@ class Unopened(Open): """An Open whose worktree stands though no pull request is open at its head: one that was merged or closed, whose chunk still has its worktree to remove.""" +@dataclasses.dataclass(frozen=True) +class Unmergeable(Open): + """An Open whose pull request awaits a person's merge and doesn't merge into its base as it stands: its worker levels the branch.""" + + def gate(branch: str, checkout: str, at: typing.Callable[[str], Run], by_human: bool) -> Gate | Open | Failure: """What the chunk on branch waits on, in a worktree of checkout; at gives the runner of commands in a folder, and by_human says the project's config leaves the merge to a person (`merge = "human"`). A Failure where git or the forge cannot be read, which doesn't say anything about the gate. - A draft never waits on a gate: its worker still works on it. On Gitea only the checks are a gate, since chunk-pr reads approvals on GitHub only (`chunk_pr.approval.awaited`). Changes a reviewer requested are news until the worker answered them (`forge.reviews.answered`); from then on the pull request awaits a new review. Where a person merges, a pull request with nothing else to wait on awaits that merge. The chunk has news again once the pull request is no longer open, or no longer merges into its base as it stands (`forge.pulls.unmergeable`), so the worker levels it for that person. + A draft never waits on a gate: its worker still works on it. On Gitea only the checks are a gate, since chunk-pr reads approvals on GitHub only (`chunk_pr.approval.awaited`). Changes a reviewer requested are news until the worker answered them (`forge.reviews.answered`); from then on the pull request awaits a new review. Where a person merges, a pull request with nothing else to wait on awaits that merge. The chunk has news again once the pull request is no longer open. It has news too once the pull request no longer merges into its base as it stands (`forge.pulls.unmergeable`): the worker then levels the branch for that person. """ worktree = worktree_of(branch, at(checkout)) if not isinstance(worktree, str): @@ -82,8 +87,7 @@ def gate(branch: str, checkout: str, at: typing.Callable[[str], Run], by_human: blocked = unmergeable(forge, pull, run) if isinstance(blocked, Failure): return blocked - # The same flags, since merge passes over an item an earlier run finished, and finishes one that resolving a conflict brought back. - return Open(f"pull request #{pull} {blocked}; run chunk-pr merge again, with the flags it had, to level the branch") if blocked else Gate(worktree, pull, MERGE) + return Unmergeable(f"pull request #{pull} {blocked}; run chunk-pr merge again to level the branch") if blocked else Gate(worktree, pull, MERGE) def worktree_of(branch: str, run: Run) -> str | None | Failure: diff --git a/bin/do_epic/main.py b/bin/do_epic/main.py index 88758999..cdb738d5 100644 --- a/bin/do_epic/main.py +++ b/bin/do_epic/main.py @@ -287,7 +287,7 @@ def chunk_run(key: str, epic: EpicRun) -> Stop: def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finished: bool) -> str | Stop: """Keeps the chunk in loop's window parked. Its work is in the repo called repo. It stays parked for as long as its pull request waits on a gate, and returns once its worker has something to do: what to tell that worker, or empty where the chunk was never parked. told is the news its last cycle's worker got, None where the window just started, and finished says the judge ruled the chunk finished. A window that just started parks the chunk only if its file says so: the forge isn't read for a chunk that starts afresh. - Where a person merges, a worker ends its run with the pull request open, so the judge may rule the chunk finished before it is. For such a finished chunk, a gate that cannot be read is read again until it can, and a pull request no longer open, in a worktree that still stands, is news the worker hasn't been told: the worker removes the worktree. + Where a person merges, a worker ends its run with the pull request open, so the judge may rule the chunk finished before it is. For such a finished chunk, a gate that cannot be read is read again until it can, and a pull request no longer open, in a worktree that still stands, is news the worker hasn't been told: the worker removes the worktree. A pull request that doesn't merge into its base is news after every cycle that leaves it so: the worker levels the branch. A chunk parks in three steps: its file is written, its window is shown as parked, and the epic's next chunks start in the slot it frees. It resumes in the reverse order: `scheduler.resume` gives it a running slot, then its file is removed. So a window that ends in between finds the chunk parked when it starts again. """ @@ -305,7 +305,11 @@ def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finis if not isinstance(entered, gates.Gate): if isinstance(entered, Failure): say(f"cannot tell whether the chunk's pull request waits on a gate, so the chunk isn't parked: {entered.reason}", epic.effects, stdout=True) - uncleaned = f"{chunk_prompt.DRIVER} keeps the chunk open while its worktree stands: {entered.news}." if finished and poll.by_human and isinstance(entered, gates.Unopened) else "" + if not (finished and poll.by_human and isinstance(entered, (gates.Unopened, gates.Unmergeable))): + return "" + if isinstance(entered, gates.Unmergeable): + return f"{chunk_prompt.DRIVER} keeps the chunk open while its pull request doesn't merge into its base: {entered.news}." + uncleaned = f"{chunk_prompt.DRIVER} keeps the chunk open while its worktree stands: {entered.news}." return "" if uncleaned in (told or "") else uncleaned if failed := poll.record(entered): return Stop(1, failed.reason) diff --git a/bin/do_epic/test_gates.py b/bin/do_epic/test_gates.py index df287192..0c480e49 100644 --- a/bin/do_epic/test_gates.py +++ b/bin/do_epic/test_gates.py @@ -5,7 +5,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from do_epic.gates import APPROVAL, CHECKS, gate, Gate, MERGE, NEW_REVIEW, Open, Unopened +from do_epic.gates import APPROVAL, CHECKS, gate, Gate, MERGE, NEW_REVIEW, Open, Unmergeable, Unopened from failure import Failure WORKTREES = "worktree /code/billing\nHEAD aaa\nbranch refs/heads/main\n\nworktree /code/billing-ABC-21\nHEAD abc\nbranch refs/heads/ABC-21\n" @@ -81,10 +81,10 @@ class GateOfAChunk(unittest.TestCase): def test_where_a_person_merges_a_pull_request_that_no_longer_merges_into_its_base_is_news_to_level_it(self): gitea = "https://gitea.larvit.se/o/billing.git" - again = "run chunk-pr merge again, with the flags it had, to level the branch" - self.assertEqual(Forge(decision="APPROVED", mergeable="CONFLICTING", merge_state="DIRTY").gate(by_human=True), Open(f"pull request #7 conflicts with its base branch; {again}")) - self.assertEqual(Forge(gitea, mergeable="CONFLICTING").gate(by_human=True), Open(f"pull request #7 conflicts with its base branch; {again}")) - self.assertEqual(Forge(decision="", merge_state="BEHIND").gate(by_human=True), Open(f"pull request #7 is behind its base branch, whose protection requires it up to date; {again}")) + again = "run chunk-pr merge again to level the branch" + self.assertEqual(Forge(decision="APPROVED", mergeable="CONFLICTING", merge_state="DIRTY").gate(by_human=True), Unmergeable(f"pull request #7 conflicts with its base branch; {again}")) + self.assertEqual(Forge(gitea, mergeable="CONFLICTING").gate(by_human=True), Unmergeable(f"pull request #7 conflicts with its base branch; {again}")) + self.assertEqual(Forge(decision="", merge_state="BEHIND").gate(by_human=True), Unmergeable(f"pull request #7 is behind its base branch, whose protection requires it up to date; {again}")) def test_where_a_person_merges_a_pull_request_awaits_that_merge_while_github_computes_whether_it_merges(self): self.assertEqual(Forge(decision="APPROVED", mergeable="UNKNOWN", merge_state="UNKNOWN").gate(by_human=True), Gate("/code/billing-ABC-21", "7", MERGE)) @@ -94,7 +94,7 @@ class GateOfAChunk(unittest.TestCase): forge.answers["tea api repos/{owner}/{repo}/pulls/7"] = '{"number": 7, "title": "Add x"}' self.assertEqual(forge.gate(by_human=True), Failure("tea api answered pull request 7 in a shape that can't be read: {'number': 7, 'title': 'Add x'}")) - def test_where_the_loop_merges_nobody_reads_whether_the_pull_request_merges(self): + def test_where_the_chunk_merges_nobody_reads_whether_the_pull_request_merges(self): forge = Forge(decision="APPROVED", mergeable="CONFLICTING") self.assertEqual(forge.gate(), Open("pull request #7 passed its checks and is approved")) self.assertNotIn(["gh", "pr", "view", "7", "--json", "mergeable,mergeStateStatus"], forge.commands) diff --git a/bin/do_epic/test_main.py b/bin/do_epic/test_main.py index 49f9a274..4cbe2bcf 100644 --- a/bin/do_epic/test_main.py +++ b/bin/do_epic/test_main.py @@ -746,6 +746,20 @@ class AChunkWhosePullRequestWaitsOnAGate(DoEpicTest): self.assertIn(fact, prompts[1].split("\n\n")[0]) self.assertNotIn("parked: ", out) + def test_where_a_person_merges_a_finished_chunk_whose_pull_request_no_longer_merges_is_told_until_it_does(self) -> None: + self.repo_config.write_text(self.repo_config.read_text(encoding="utf-8") + 'merge = "human"\n', encoding="utf-8") + for unmergeable, why in (({"mergeable": "CONFLICTING"}, "conflicts with its base branch"), ({"merge_state": "BEHIND"}, "is behind its base branch")): + with self.subTest(why=why): + self.forges = [awaiting(decision="APPROVED", **unmergeable), awaiting(decision="APPROVED", **unmergeable), CLEANED] + self.gate_reads = 0 + fake = FakeEffects(streams=[self.worker(), self.worker(), self.worker()], claude=[judged("finished"), judged("finished"), judged("finished")], git=UNREAD, windows=PARKED_WINDOW) + code, out, err, prompts = self.parked_run(fake) + self.assertEqual((code, len(prompts)), (0, 3), err) + for prompt in prompts[1:]: + for fact in ("keeps the chunk open while its pull request doesn't merge into its base", f"pull request #7 {why}", "run chunk-pr merge again"): + self.assertIn(fact, prompt.split("\n\n")[0]) + self.assertNotIn("parked: ", out) + def test_where_a_person_merges_an_unfinished_chunk_goes_on_without_news_or_a_wait(self) -> None: self.repo_config.write_text(self.repo_config.read_text(encoding="utf-8") + 'merge = "human"\n', encoding="utf-8") self.forges = [awaiting(pulls=""), awaiting(decision="APPROVED", fails="gh pr checks"), CLEANED] diff --git a/docs/decisions.md b/docs/decisions.md index 95a56c28..7d5dffe6 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -153,7 +153,7 @@ Valid while `~/.claude` is a checkout of this repo. - **Releases.** An epic item has no release. It ships into its repo's unreleased work: where the repo publishes something others consume, a bullet under `CHANGELOG.md` → `## Unreleased`, or nothing where the repo's plan is in Jira. The issue is no item of the repo's plan, so the chunk's worker writes the bullet in its branch and runs `chunk-pr merge` without `--finish`. - **Repos.** A repo's name is its main checkout's folder name, and a project config names that checkout. A missing checkout is cloned from the host of the epic's other repos; where unsure, do-epic asks. Unsure means the other repos don't all sit under one host and owner (the same host spelt as https and as ssh counts as two), an origin can't be read or isn't an https, ssh or scp-style address, the folder to clone into holds something else, or the clone fails. A repo no config names is cloned into the clone folder, and the human is asked to write its config. Each chunk uses its repo's model, routing, and language for commits and PRs. Jira text is in the epic's language, or else the machine's default. - **Running.** The epic caps the chunks running at once, and each repo's `parallel-chunks` still applies. do-epic and loop-claude never run chunks in the same repo at once. The cap is a line of the epic's description, `**Max parallel chunks:** 2`, and 1 without it, as `parallel-chunks` is. A repo's `parallel-chunks` counts the chunks of every epic in its checkout. Each window is named for its issue's key, and a tmux window option, `@chunk-root`, names the folder its chunk works in, which is how loop-claude sees do-epic's chunks in a checkout. do-epic and loop-claude each hold the checkout's `starting` lock from checking the checkout's chunks to starting a window there. A chunk without a repo works in `~/.local/state/do-epic//`. 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. In a repo whose config sets `merge = "human"`, the merge itself is a gate: `chunk-pr merge` leaves the pull request ready, the chunk parks on `your merge` once nothing else holds the pull request, and it resumes when the forge no longer reports the pull request open, to clean up and finish. It resumes too once the pull request conflicts with its base branch, or is behind it where GitHub's branch protection requires an up-to-date branch, so the person finds a pull request they can merge: the worker runs `chunk-pr merge` again with the flags it had, which levels the branch, passes over each item already finished, waits for the checks and leaves the pull request ready. While GitHub still computes whether the pull request merges, the chunk stays parked until the next read. Gitea reports a pull request as not mergeable also for the seconds it checks for conflicts; a read in those seconds resumes the chunk for a run that changes nothing, which is cheaper than a second read every minute to rule it out. The judge may rule such a chunk finished while its pull request is open, since its worker ends each run there. So do-epic reads a gate it could not read again before it hands the chunk on, and tells the worker once to remove a worktree whose pull request is no longer open. +- **Long gates.** A chunk whose PR waits on a gate, such as a human approval, parks. It keeps its worktree, PR and session, and its state is in a file that survives a reboot. A parked chunk takes no running slot, and the items it blocks wait. do-epic polls the forge and resumes the chunk's session when the gate passes or a reviewer comments. It fixes reasonable feedback, replies to the rest, and changes the setup so review would have caught it. `do-epic --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. In a repo whose config sets `merge = "human"`, the merge itself is a gate: `chunk-pr merge` leaves the pull request ready, the chunk parks on `your merge` once nothing else holds the pull request, and it resumes when the forge no longer reports the pull request open, to clean up and finish. It resumes too once the pull request conflicts with its base branch, or is behind it where GitHub's branch protection requires an up-to-date branch, so the person finds a pull request they can merge. The worker then runs `chunk-pr merge` again, which levels the branch, waits for the checks and leaves the pull request ready. A chunk whose cycle ends on such a pull request is not handed on: its worker is told after each cycle until the pull request merges into its base. While GitHub still computes whether the pull request merges, the chunk stays parked until the next read. Gitea also reports a pull request as not mergeable for the seconds it checks for conflicts. A read in those seconds resumes the chunk for a run that doesn't change anything, which costs less than reading every gate twice to tell the two apart. The judge may rule such a chunk finished while its pull request is open, since its worker ends each run there. So do-epic reads a gate it could not read again before it hands the chunk on, and tells the worker once to remove a worktree whose pull request is no longer open. - **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. -- 2.52.0 From e2c4993cc66ed234a97674d58de474adb6dfdbe8 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 22:04:59 +0100 Subject: [PATCH 4/9] =?UTF-8?q?Answer=20product-owner=20round=201:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(1=20misread);=20the=20stabi?= =?UTF-8?q?lity=20round's=20answer=20fixes=20the=20same=20handed-on=20chun?= =?UTF-8?q?k?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 0f5e8897e28d809d3b3264054e4b0fd3af524bf8 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 22:04:59 +0100 Subject: [PATCH 5/9] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=203=20=F0=9F=9F=A1=20(1=20misread);=20drop=20the?= =?UTF-8?q?=20flags=20a=20do-epic=20worker=20never=20passes,=20and=20rewor?= =?UTF-8?q?d=20the=20added=20sentences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- bin/forge/pulls.py | 2 +- skills/larv-review/standards/prose.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 592eff7f..a9ed27f9 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ A legacy project with no container setup sets `tooling-on-host = true`, so the l A project whose pull requests need a human's approval sets `wait-for-approval = true` in its config. `chunk-pr merge` then waits, once the checks have passed, until GitHub reports the pull request approved as its branch protection requires, and merges it. It refuses on Gitea, where a reviewer requested changes and where the protection requires no review. While it waits, other chunks merge. It stops where a reviewer's comment waits for an answer, on an approved pull request too; answer it and run it again. It gives up after 90 minutes without an approval; run it again once the pull request is approved. Left out, the setting is false. -A project whose team merges its pull requests itself sets `merge = "human"`. `chunk-pr merge` then brings the branch level with origin's default branch, finishes the chunk's plan items, waits for the checks and marks the pull request ready, but leaves the merge to a person. A plan or changelog kept in the checkout is finished on the branch, so it lands with that merge; one kept in Jira, or in the config's folder, is finished at once. A do-epic chunk parks until the pull request is merged, and its window's name says `awaits your merge`. Where the pull request meanwhile conflicts with the default branch, or is behind it where GitHub's branch protection requires an up-to-date branch, the chunk resumes and brings the branch level again. Left out, the setting is `"chunk"`: the chunk merges. +A project whose team merges its pull requests itself sets `merge = "human"`. `chunk-pr merge` then brings the branch level with origin's default branch, finishes the chunk's plan items, waits for the checks and marks the pull request ready, but leaves the merge to a person. A plan or changelog kept in the checkout is finished on the branch, so it lands with that merge; one kept in Jira, or in the config's folder, is finished at once. A do-epic chunk parks until the pull request is merged, and its window's name says `awaits your merge`. The chunk resumes and brings the branch level again once the pull request conflicts with the default branch. It does so too once the branch is behind a default branch whose protection, on GitHub, requires an up-to-date branch. Left out, the setting is `"chunk"`: the chunk merges. For a client's project, use one sandbox VM per client, so that one client's code, transcripts and credentials never share a machine with another's. What the client's repo should not hold lives in the config's folder, at paths written as `folder:`, as `project-config --help` shows: the plan, the working rules in an `AGENTS.md` I write for the agents, the records, and the goals and audience, as `goals-and-audience = "folder:goals.md"`. Name that file `goals.md`, so the rules for goals and audience load when an agent writes it. A file outside the checkout has no commits in the checkout's history, so four things are not supported for it yet. `score-outcomes` and loop-claude's routing figures count a project's chunks only where `todo.md`, `docs/comprehension-history.md` and `docs/reading-cost.md` are at those paths in the checkout; otherwise each says so, and the loop goes on. For a plan or a comprehension history outside the checkout, `larv-review` says it cannot tell whether a scoring run is owed, and for such a history it cannot find a paired ruling's base. For a plan outside the checkout, chunk-preflight and loop-claude don't see a release whose last item has shipped, and say that its release review and its cut are yours to call. And rule-hook checks a plan outside the checkout on every call, not only when it changed. diff --git a/bin/forge/pulls.py b/bin/forge/pulls.py index de0b4ccc..7de3e4ca 100644 --- a/bin/forge/pulls.py +++ b/bin/forge/pulls.py @@ -52,7 +52,7 @@ BEHIND = "is behind its base branch, whose protection requires it up to date" def unmergeable(forge: Forge, number: str, run: Run) -> str | None | Failure: """Why pull request number doesn't merge into its base as it stands: CONFLICTS or BEHIND. None where it merges, and while GitHub still computes whether it does. - GitHub reports a pull request as behind only where the base's protection requires an up-to-date branch. Gitea's `mergeable` never tells that case. It is also false for the seconds Gitea checks for conflicts after a push to either branch, which reads as CONFLICTS here. + GitHub reports a pull request as behind only where the base's protection requires an up-to-date branch. Gitea's `mergeable` never tells that case. Gitea also answers false for the seconds it checks for conflicts after a push to either branch, which reads as CONFLICTS here. """ if forge == "gh": viewed = run(["gh", "pr", "view", number, "--json", "mergeable,mergeStateStatus"]) diff --git a/skills/larv-review/standards/prose.md b/skills/larv-review/standards/prose.md index 19112d77..3f6ad0a3 100644 --- a/skills/larv-review/standards/prose.md +++ b/skills/larv-review/standards/prose.md @@ -12,4 +12,4 @@ Everything written — chat, commit messages, comments, docs, code — is in **E - **Write the thing, not an introduction to it.** A sentence announcing what follows, or flagging that it deserves attention, doesn't carry anything — if it matters, it is in what follows. A bare label is fine. BANNED: `Here's the new audience text, which is the part that needs your eye:`, `One thing I changed that deserves your attention.`, `One judgment call I'd flag rather than bury.`, `Three things came along that would otherwise have been left false.` GOOD: `New audience text:`, or the list alone. - **Write negations as people say them.** After a verb, or after its preposition, write `doesn't anything` or `anyone`, never ` nothing` or `no one`; each breach is a 🟡. BANNED: `stops nothing`, `depends on no one`, `so answering in time costs nothing`. GOOD: `doesn't stop anything`, `doesn't depend on anyone`, `so answering in time doesn't cost anything`. - **No contrastive tail.** `X rather than Y`, `not Y but X`, `instead of Y`: state X and stop. The rejected alternative is noise unless naming it stops a reader choosing Y. BANNED: `verified in CI rather than asserted`. GOOD: `verified in CI`. -- **A sentence about several named things holds for each of them.** Where one sentence gives a property to several named tables, fields, flags or files, check the property in each one's source. Where it fails for one, split the sentence. BANNED, where only `repos` has the column: `Each row of the repos and labels tables has a name`. GOOD: `Each row of the repos table has a name. A row of the labels table has only its label`. +- **A sentence about several named things holds for each of them.** Where one sentence gives a property to several named fields, files, flags or tables, check the property in each one's source. Where it fails for one, split the sentence. BANNED, where only `repos` has the column: `Each row of the repos and labels tables has a name`. GOOD: `Each row of the repos table has a name. A row of the labels table has only its label`. -- 2.52.0 From 427a2cb7c3a105489e8670b41ba493d0eb1f36a7 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 22:24:56 +0100 Subject: [PATCH 6/9] =?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);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 8c693ea5de78813c20fd3ee062f3a627fe38ba10 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 22:24:57 +0100 Subject: [PATCH 7/9] =?UTF-8?q?Answer=20product-owner=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From b5597754557efda2bae096ee9fc7ac7f5e82e5ac Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 23:39:46 +0100 Subject: [PATCH 8/9] Finish item 458 in the plan --- CHANGELOG.md | 1 + todo.md | 17 ----------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a709e4be..cbe07aae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- `do-epic` resumes a chunk parked on `your merge` when its pull request no longer merges into its base, so the worker runs `chunk-pr merge` again to level the branch; a finished chunk in that state stays open until its pull request merges. - `larv-review prepare-scoring` takes the scoring run's project values from the checkout's `skills/comprehension-panel/seat-prompts.md` where the working-rules file holds no "Scoring run" section, not only where that file is missing. ## 0.13.0 diff --git a/todo.md b/todo.md index 2083d60d..8e36eda7 100644 --- a/todo.md +++ b/todo.md @@ -15,7 +15,6 @@ | 460 | 0.14.0 | | | **Review the judge's fix for quoting the worker's task as evidence with every larv-review pass it fires, and adjust it to their findings.** | 2 | 2 | 3 | 5 | 2 | code health by 3, 1.1 by 5 | 7.2 | | 452 | 0.14.0 | | | **Make do-epic's view of the Jira workflow settings: the statuses at which an issue unblocks the issues it blocks, and the moves the team's own automation makes, so do-epic makes none of those.** | 3 | 2 | 2 | 5 | 5 | 1.6 by 7, 1.5 by 3 | 2.1 | | 449 | 0.14.0 | | | **Record do-epic's repo picks and sub-task summaries in the team's own spelling, such as `core-4` and `core-4: Bygg …`, as its config sets them.** | 2 | 2 | 2 | 4 | 3 | 1.6 by 6 | 2.0 | -| 458 | 0.14.0 | | | **Resume a chunk whose pull request awaits a person's merge once it no longer merges cleanly into the default branch, so the worker brings it level again.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 4, 1.5 by 3 | 1.9 | | 453 | 0.14.0 | | | **Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type.** | 2 | 2 | 1 | 3 | 2 | 1.6 by 5 | 1.8 | | 457 | 0.14.0 | | | **Keep loop-claude from starting a chunk for an item whose pull request is ready and awaits a person's merge under `merge = "human"`.** | 3 | 2 | 2 | 5 | 5 | 1.6 by 5, 1.4 by 3 | 1.7 | | 450 | 0.14.0 | | | **Add `do-epic --dry-run`, which prints every Jira write planning would make and each chunk that would start, and makes none of them.** | 2 | 2 | 2 | 4 | 3 | 1.6 by 5 | 1.6 | @@ -132,22 +131,6 @@ Touches: - `bin/do_epic/test_split.py` - `README.md`: `### Set up a project` (small) -### 458. Resume a chunk whose pull request awaits a person's merge once it no longer merges cleanly into the default branch, so the worker brings it level again. - -Under `merge = "human"` a pull request stays ready for hours or days while the default branch moves. A conflict, such as each branch holding its own changelog bullet or plan edit, or a branch protection that requires an up-to-date branch, then blocks the person who would merge it. Yet `gate` in `bin/do_epic/gates.py` reads only the draft state, the checks, the review decision and the waiting threads, so the window and `--status` keep saying `awaits your merge`, and nothing resumes the chunk unless a reviewer comments. - -- Where `by_human`, `gate` reads the forge's mergeability before it returns the `your merge` gate: GitHub's `mergeable` and `mergeStateStatus`, Gitea's `mergeable`. No reader exists yet under `bin/forge/`; add one beside `open_pull` in `bin/forge/pulls.py`. -- A pull request that conflicts with the default branch, or is behind it where the branch protection requires an up-to-date branch, gives an `Open` whose news tells the worker to run `chunk-pr merge` again, which levels, pushes, waits for the checks and marks ready. Settle whether that rerun passes `--finish` again, since the items are already finished on the branch. -- GitHub reports `mergeable` as `UNKNOWN` while it computes it: that keeps the `your merge` gate until the next read, rather than resuming the chunk. -- State the new resume in `docs/decisions.md` → "Long gates". - -Touches: - -- `bin/do_epic/gates.py`: `gate` (small) -- `bin/forge/pulls.py` -- `bin/forge/test_forge.py` -- `bin/do_epic/test_gates.py` - ### 453. Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type. do-epic and `todo-item add` file every new issue as a Task, the name `plan_store/jira_epic.py` sets as `ISSUE_TYPE`. A Jira project without a Task type, such as TW, whose types are Feature, Bug, Chore and Investigation, refuses each one. So `do-epic --file` fails there, and so does the epic's finishing, which files a release review for each repo. -- 2.52.0 From 69cf298597c140b9c70d98ad728a2a8321c2d1b1 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Thu, 19 Nov 2026 23:39:46 +0100 Subject: [PATCH 9/9] Finish item 459 in the plan --- CHANGELOG.md | 1 + todo.md | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbe07aae..0cea3ec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- The prose standard asks that a sentence about several named things holds for each of them. - `do-epic` resumes a chunk parked on `your merge` when its pull request no longer merges into its base, so the worker runs `chunk-pr merge` again to level the branch; a finished chunk in that state stays open until its pull request merges. - `larv-review prepare-scoring` takes the scoring run's project values from the checkout's `skills/comprehension-panel/seat-prompts.md` where the working-rules file holds no "Scoring run" section, not only where that file is missing. diff --git a/todo.md b/todo.md index 8e36eda7..cc5ead8e 100644 --- a/todo.md +++ b/todo.md @@ -18,7 +18,6 @@ | 453 | 0.14.0 | | | **Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type.** | 2 | 2 | 1 | 3 | 2 | 1.6 by 5 | 1.8 | | 457 | 0.14.0 | | | **Keep loop-claude from starting a chunk for an item whose pull request is ready and awaits a person's merge under `merge = "human"`.** | 3 | 2 | 2 | 5 | 5 | 1.6 by 5, 1.4 by 3 | 1.7 | | 450 | 0.14.0 | | | **Add `do-epic --dry-run`, which prints every Jira write planning would make and each chunk that would start, and makes none of them.** | 2 | 2 | 2 | 4 | 3 | 1.6 by 5 | 1.6 | -| 459 | 0.14.0 | | | **Make the prose standard require that a sentence giving one property to several named tables, fields or flags holds for each of them.** | 1 | 2 | 2 | 3 | 1 | 1.1 by 3 | 1.3 | | 454 | 0.14.0 | | | **Start a do-epic chunk's issue as the team's board expects, by settings: assigned to the account do-epic works as, moved by a start transition and added to a board's active sprint.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 4 | 1.1 | | 446 | 0.15.0 | | question | **Kill the process a stuck check names where its verdict is `stuck`, once the human says the recorded verdicts match what they would have done.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 3 | 1.0 | | 77 | 0.15.0 | | | **Teach `bin/metric-bench` Go and TypeScript, rerun it once two projects' comprehension histories name places, and bring into review only a metric that tracks the panel.** | 4 | 2 | 1 | 5 | 6 | 1.1 by 7, 1.4 by 7 | 2.1 | @@ -186,13 +185,6 @@ Touches: - `bin/do_epic/test_planning.py` - `README.md`: `## Tools` (small) -### 459. Make the prose standard require that a sentence giving one property to several named tables, fields or flags holds for each of them. - -An outside reviewer's finding on a README raised it: a sentence described the rows of two tables, saying each has a `name`, and only one of the two tables has that column. The prose pass read the sentence and not the two sources behind it. Add the rule to `skills/larv-review/standards/prose.md`: a sentence that gives a property to several named things holds for every one, checked in each source; where it fails for one, the sentence splits. - -Touches: -- `skills/larv-review/standards/prose.md` - ### 454. Start a do-epic chunk's issue as the team's board expects, by settings: assigned to the account do-epic works as, moved by a start transition and added to a board's active sprint. When a do-epic chunk starts, its issue stays as Jira holds it: unassigned, in New and outside the sprint. A team whose board shows who works on what, such as TW, where an issue being worked is assigned to the person, In Progress and in the active sprint, then sees nothing of the loop's work. Today each worker would have to do this by hand, from rules only some machines hold. -- 2.52.0