Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9e11f10a0 | |||
| ff1fd7596f | |||
| f75c13013d | |||
| afbaa953e6 | |||
| 713d559c5b | |||
| 1774bb4274 | |||
| dbe275e59f | |||
| 5e54057f9e | |||
| ee44c99f28 | |||
| 840cb21fbc | |||
| b76a3bcf24 | |||
| e062f71d47 | |||
| 32a81b0257 | |||
| 105e723617 | |||
| 4fe37104aa | |||
| 9e41a4fc64 | |||
| f3af5e23fd | |||
| 5ed3a55e3a | |||
| d516a28750 | |||
| 20b13065ea | |||
| 45115ef5e4 | |||
| 2797e11080 | |||
| 500bd126a4 | |||
| fb0a7ac8cf | |||
| 7f9237e91e | |||
| 6e22149334 | |||
| ee296c332a | |||
| a9bdef6fcb | |||
| 4586bfcbea | |||
| 3d19ec9c6c | |||
| 6fda959b52 | |||
| 04c67d958e | |||
| afc51efb1b | |||
| ecc69835b8 | |||
| 3d34411e24 | |||
| 535ad7fd6a | |||
| 5108ab97b9 | |||
| 3cce40437e | |||
| 69cf298597 | |||
| b559775455 | |||
| 3d6227009d | |||
| 2efe914521 | |||
| 04852c3417 | |||
| 0c52688ff8 | |||
| 356ae263e1 | |||
| 29b1be3fd7 | |||
| 1a23aa05b0 | |||
| daee3c671f | |||
| a357cc7b18 | |||
| 4c109b3411 | |||
| 7605094623 | |||
| f9959d25c5 | |||
| 1845d8ff37 | |||
| b940f902b8 | |||
| 9caac90a62 | |||
| 24bcb9060b | |||
| 7c178038c5 | |||
| 8c693ea5de | |||
| 427a2cb7c3 | |||
| d954fb0026 | |||
| 56c579bd54 | |||
| 470be28759 | |||
| 0f5e8897e2 | |||
| e2c4993cc6 | |||
| 547afc6cf2 | |||
| fc4b0387d6 | |||
| ceacc86a88 | |||
| 00975177ad | |||
| 18d28fa472 | |||
| 6d7c8b5c25 | |||
| 111cb9248e | |||
| 06a1398196 | |||
| 11ee0f7bbf |
@@ -1,5 +1,14 @@
|
||||
# Changelog
|
||||
|
||||
## 0.14.0
|
||||
|
||||
- `loop-claude`'s judge stops, naming how much to cut the records by, rather than judge a prompt that leaves it less than the transcript's last 50,000 characters. A file the project's config names for two records is read once.
|
||||
- Under `merge = "human"`, `loop-claude` and `chunk-preflight` pass over an item whose ready pull request awaits a person's merge, and `loop-claude` stops, naming those pull requests, once every item left awaits one.
|
||||
- do-epic reads two new settings from a project's config: `jira-unblocking-statuses` names the statuses at which an issue unblocks the issues it blocks, and `jira-automation-moves-issues` leaves the move out of "In Progress" to the team's own automation.
|
||||
- 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.
|
||||
|
||||
## 0.13.0
|
||||
|
||||
- Fix loop-claude stopping after a finished chunk: its judge may now quote the worker's task as evidence, so the loop starts the next chunks instead of exiting.
|
||||
|
||||
@@ -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; where you close the pull request unmerged, file the item again. 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. loop-claude doesn't start a chunk for an item that a ready pull request finishes. Once no item left in the release can start and one awaits a merge, loop-claude stops and names the pull requests to merge; run it again after you merge one. The first chunk after a merge runs `chunk-pr clean` in the worktree the merged pull request left, where nobody pushed to the pull request after the chunk did. Nobody works on a pull request that awaits your merge. To have a reviewer's comment answered, turn the pull request back into a draft: a chunk then takes its item up 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:<path>`, 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.
|
||||
|
||||
@@ -155,6 +155,9 @@ 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 moves a finished chunk's issue, and 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 moves no issue to done and closes no epic, and a chunk that finishes stops with that reason.
|
||||
- `config.toml` fits do-epic to a team whose own automation moves issues, such as a CI job that moves an issue when its pull request merges. Two settings do:
|
||||
- `jira-unblocking-statuses` lists the statuses at which an issue's work has landed though Jira doesn't count it done yet, such as `["Release Ready"]`, in upper or lower case. An issue in one of them takes no chunk and no longer blocks the issues it blocks, and `--status` names the statuses beside each blocker. A status Jira counts as done always does both. The release reviews, which are the epic's last chunk, still wait until Jira counts every issue done: run `do-epic <EPIC-KEY>` then, to start them.
|
||||
- `jira-automation-moves-issues = true` keeps do-epic from moving the issue of a finished chunk in a repo: the automation moves it, and do-epic waits for that move before it starts what the issue blocks. An issue without a repo has no pull request, so do-epic still moves it, with `jira-finish-transition`. The setting needs `jira-unblocking-statuses`, which names the status the automation gives an issue whose pull request merged.
|
||||
- `config.toml` may end with a `[label-repos]` table, for a team that already labels its issues by repo. Give it one line for each such label: the label, then the repo's name, such as `twu-4 = "tenant-web-ui-4"`. do-epic reads such a label as it reads its own `repo:<name>`. Where the label is the repo's name, map the name to itself, as in `core-4 = "core-4"`. Write every other setting above the table.
|
||||
- `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 <EPIC-KEY>` uses it to pick where each open issue without such a label is worked, and records the pick as a label: `repo:<name>` for its repo, `do-epic-claude` for work of Claude's that changes no repo, and `do-epic-human` for a task of yours. Where the rule leaves an issue unclear, do-epic asks you on the terminal. Answer with the label, or with Enter alone to leave the issue waiting. Change a pick by editing the label in Jira.
|
||||
|
||||
@@ -232,7 +235,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
|
||||
- `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`.
|
||||
- `deploy_release` imports `release_plan`'s `release_standing`.
|
||||
- `do_epic/` holds `do-epic`, the tool that drives one Jira epic. `main.py` starts the epic's chunks and runs one chunk's cycles in its window, through `agent_cycle`. `planning.py` settles, before the chunks start, where each open issue is worked and the order of the issues do-epic filed, through `split.py`, `repo_pick.py` and `ranking.py`. `scheduler.py` says which issues run now: as many as the epic's cap and each repo's `parallel-chunks` allow, and none in a repo where loop-claude runs chunks. `gates.py` reads once whether a chunk's pull request waits on its checks, an approval or a new review, and `parked.py` keeps each chunk that does in a state file, so it takes no running slot while it waits and goes on waiting after a reboot. `chunk_prompt.py` words what a chunk's worker reads. Through `findings.py` that worker files a finding as an issue of the epic, with `--file`, and appends a decision to its description, with `--record-decision`. `finish.py` ends an epic that holds no open issue: its finishing chunk files a release review of each repo the epic changed, has the human confirm each goal, and with `--close-epic` posts the summary on the epic and closes it. `config.py` reads its machine-wide settings, importing `project_config`'s settings and `model_routing`'s ladder file, and `epic_record.py` reads and writes an epic's description by section, language line and cap line, through `record_store`'s `EpicDescription`. `repos.py` finds a repo's checkout and project config by its name, and clones a missing checkout from the host and owner of the epic's other repos, through `forge`'s `url_beside`. `repo_pick.py` asks claude, by `repo-rule.md`, where an epic item is worked, and records the answer as a label on the issue. `split.py` has claude predict from the code which repos an item changes, and files a sub-task per repo under it where there are several. `ranking.py` orders an epic's items by score over one chain of goals, the epic's, then code health, then the item's repo's, through `plan`'s ranking, and re-ranks the tracker's backlog to that order through `backend/`. `backend/` reads, files and ranks the epic's issues, adds the labels `repo_pick.py` and `split.py` record, posts comments, moves a finished chunk's issue to done, and closes the epic. `e2e/` holds `do-epic-e2e`.
|
||||
- `forge/` tells a GitHub origin from a Gitea one, names a repo beside an origin's and runs that forge's CLI (`commands.py`), finds a pull request and reads its checks, once or until they settle (`pulls.py`), and reads a pull request's review state (`reviews.py`), for `chunk_preflight`, `chunk_pr`, `deploy_release`, `do_epic` and `larv_review`.
|
||||
- `forge/` tells a GitHub origin from a Gitea one, names a repo beside an origin's and runs that forge's CLI (`commands.py`), finds a pull request, lists the ready ones and reads its checks, once or until they settle (`pulls.py`), and reads a pull request's review state (`reviews.py`), for `chunk_preflight`, `chunk_pr`, `deploy_release`, `do_epic` and `larv_review`.
|
||||
- `git_cli/` runs git for every tool (`git_repo.py`), and reads the git calls in a shell command (`git_command.py`).
|
||||
- `judge_replay` imports `agent_cycle`'s judge and verdicts, and `chunk_driver`'s premises, records and `ANSWER_DESTINATIONS`.
|
||||
- `loop_claude` runs `chunk-preflight` as a process of its own.
|
||||
@@ -244,7 +247,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
|
||||
- `plan_store/` reads and writes a project's plan through the store the project's config names (`stores.py`). Every backend meets `plans.py`'s `PlanStore`: a markdown file (`todo_md.py`, which also ranks and checks the file in place, with its text edits in `markdown_edits.py`) or a Jira epic (`jira_epic.py`). `scoring.py` reads the goal weights that both backends rank by. `contract.py` holds the tests every backend that writes must pass; `jira_epic.py` doesn't yet, and its own tests stand in for Jira. `fakes.py` holds a plan in memory.
|
||||
- `rank_todo.py`, `settings_filter.py` and `statusline.py` are tools of one file each, tested beside them.
|
||||
- `record_store/` reads and writes a project's records, each through the store the project's config names (`stores.py`): a markdown file, a Confluence Cloud page (`confluence_page.py`), or, for the goals, a Jira epic's description (`jira_description.py`). `contract.py` holds the tests every backend must pass, and `fakes.py` a store in memory that the tests of other tools use.
|
||||
- `release_plan/` says which release is next and whether it is ready to cut (`release_standing.py`), from the plan, the changelog and the tags, and picks the item the next chunk takes first (`next_chunk.py`), for `chunk_preflight` and `loop_claude`.
|
||||
- `release_plan/` says which release is next and whether it is ready to cut (`release_standing.py`), from the plan, the changelog and the tags, picks the item the next chunk takes first (`next_chunk.py`), and marks each item that a ready pull request finishes (`awaiting_merge.py`), for `chunk_preflight` and `loop_claude`.
|
||||
- `repo_checks/` tests the repo itself.
|
||||
- `rest_client/` sends a JSON request to a REST API and reads its credentials from an env file, for `notifier`, `atlassian` and `record_store`.
|
||||
- `review_rules/` holds the larv-review rules that several tools apply: its passes, its review folder, its round commit titles and the comprehension history's format.
|
||||
|
||||
+21
-11
@@ -20,6 +20,8 @@ from claude_code.tokens import tokens_of
|
||||
|
||||
# At 3 to 4 characters a token, 100,000 to 133,000 tokens, which leaves a 200,000-token context room for the reply; the largest session rendered here was 364,000 characters on 2026-10-03.
|
||||
JUDGE_PROMPT_CHARS = 400000
|
||||
# The judge reads the transcript's last 50,000 characters at least, about 15,000 tokens, or all of a shorter one. Where the rest of its prompt leaves less room, the judge doesn't run, since a cut record could hide the rule that makes it interrupt.
|
||||
TRANSCRIPT_FLOOR = 50000
|
||||
INTERRUPT_RULES = (
|
||||
"""Decide whether the human must now be interrupted. ~/.claude/CLAUDE.md → "Working loop", "Ask, don't guess" says """
|
||||
"which choices are reserved for the human. interrupt=true when any of these appear:\n"
|
||||
@@ -74,6 +76,8 @@ def judge_rules(answer_destinations: str, driver: str) -> str:
|
||||
# Open the task and the transcript in the prompt; the premises and the records come before the task, the rules after the transcript.
|
||||
# judge_replay.archived_prompt splits each archived prompt on them, so rewording one makes every run archived before it replay as failed.
|
||||
TASK_HEADING = "The task the worker was given:\n"
|
||||
# Between the task and the tail that quotes_checked searches, so that no fragment of a quote runs across the join. plain() keeps it, and the judge's quotes hold no NUL.
|
||||
PASSAGE_BREAK = "\x00"
|
||||
|
||||
|
||||
def transcript_heading(driver: str) -> str:
|
||||
@@ -85,7 +89,7 @@ class Reply:
|
||||
answer: str = dataclasses.field(metadata={"description": "With interrupt false, the passage of the premises or the records that answers the worker's question, quoted verbatim, without elisions. Empty otherwise."})
|
||||
# Routes the worker one rung up, as the judge interrupts or quotes an answer, or on the next cycle: agent_cycle/escalation_mark.py.
|
||||
escalation: str = dataclasses.field(metadata={"description": "Empty unless the chunk is unfinished, interrupt is true or answer quotes a passage, and the worker's run ends {asks_higher_rung}, citing an escalation trigger. Then: a verbatim quote, without elisions, of the transcript passage where the trigger fired, such as a review round's commit title or the worker's report of the finding or failing test. {quote_after_step} Never a later mention of the trigger, and never the request itself."})
|
||||
evidence: str = dataclasses.field(metadata={"description": "A verbatim quote of the one transcript passage the verdict rests on, without elisions: what triggers the interrupt; for a quoted answer, the worker's question; else what shows the chunk finished or the work remaining."})
|
||||
evidence: str = dataclasses.field(metadata={"description": "A verbatim quote of the one passage of the task or the transcript the verdict rests on, without elisions: what triggers the interrupt; for a quoted answer, the worker's question; else what shows the chunk finished or the work remaining."})
|
||||
finished: bool = dataclasses.field(metadata={"description": "Whether the chunk is finished."})
|
||||
interrupt: bool = dataclasses.field(metadata={"description": "Whether the human must now be interrupted."})
|
||||
answered_before: str = dataclasses.field(metadata={"description": "With interrupt true, a [human] line from earlier in the chunk that answered the question the worker asks now, quoted verbatim, without elisions. Empty otherwise."})
|
||||
@@ -184,7 +188,10 @@ def judge(root: str, brief: Brief, rung: Rung, effects: Effects, keep: typing.Ca
|
||||
|
||||
def judge_once(root: str, brief: Brief, rung: Rung, effects: Effects) -> Verdict | Failure | Limited:
|
||||
"""One judge run on the brief, as judge retries it; judge-replay replays it."""
|
||||
prompt, grounds = judge_prompt(brief)
|
||||
built = judge_prompt(brief)
|
||||
if isinstance(built, Failure):
|
||||
return built
|
||||
prompt, grounds = built
|
||||
verdict = run_judge(root, judge_args(rung, brief.driver), prompt, grounds, effects)
|
||||
return verdict if isinstance(verdict, Failure | Limited) else escalation_mark.stamped(verdict, len(brief.entries))
|
||||
|
||||
@@ -248,20 +255,20 @@ def quotes_checked(verdict: Verdict, grounds: Grounds) -> Verdict | Failure:
|
||||
|
||||
Only a misquoted evidence fails. A Failure for any other would exit an unattended loop, so each changes the verdict instead.
|
||||
"""
|
||||
if not grounded(verdict.evidence, f"{grounds.task}\n\n{grounds.shown}"):
|
||||
if not grounded(verdict.evidence, f"{grounds.task}{PASSAGE_BREAK}{grounds.shown}"):
|
||||
return misquoted_evidence(verdict)
|
||||
verdict = re_ask_checked(verdict, grounds.shown)
|
||||
verdict = answer_checked(verdict, grounds.quotable)
|
||||
return escalation_mark.checked(verdict, after=grounds.after_mark, shown=grounds.shown)
|
||||
|
||||
|
||||
def grounded(evidence: str, rendered_transcript: str) -> bool:
|
||||
"""Whether the transcript holds the evidence word for word, once emphasis marks are stripped and whitespace is reflowed in both. The judge joins passages with an ellipsis though told to quote one, so each fragment between ellipses must come after the one before it."""
|
||||
transcript = plain(rendered_transcript)
|
||||
def grounded(evidence: str, searched: str) -> bool:
|
||||
"""Whether the searched text holds the evidence word for word, once emphasis marks are stripped and whitespace is reflowed in both. The judge joins passages with an ellipsis though told to quote one, so each fragment between ellipses must come after the one before it."""
|
||||
searched = plain(searched)
|
||||
fragments = [fragment.strip() for fragment in re.split(r"\.\.\.|…", plain(evidence)) if fragment.strip()]
|
||||
after = 0
|
||||
for fragment in fragments:
|
||||
at = transcript.find(fragment, after)
|
||||
at = searched.find(fragment, after)
|
||||
if at < 0:
|
||||
return False
|
||||
after = at + len(fragment)
|
||||
@@ -271,7 +278,7 @@ def grounded(evidence: str, rendered_transcript: str) -> bool:
|
||||
|
||||
def misquoted_evidence(verdict: Verdict) -> Failure:
|
||||
asked = f", for the question: {verdict.question}" if isinstance(verdict, Interrupt | QuotedAnswer) else ""
|
||||
return Failure(f"the judge quoted {verdict.evidence!r}, which is not in the transcript{asked}")
|
||||
return Failure(f"the judge quoted {verdict.evidence!r}, which is not in the task or the transcript{asked}")
|
||||
|
||||
|
||||
def re_ask_checked(verdict: Verdict, shown: str) -> Verdict:
|
||||
@@ -290,8 +297,8 @@ def answer_checked(verdict: Verdict, quotable: str) -> Verdict:
|
||||
return verdict
|
||||
|
||||
|
||||
def judge_prompt(brief: Brief) -> tuple[str, Grounds]:
|
||||
"""The prompt, and what the judge's quotes are checked against."""
|
||||
def judge_prompt(brief: Brief) -> tuple[str, Grounds] | Failure:
|
||||
"""The prompt, and what the judge's quotes are checked against; a Failure where the premises, the records, the task and the rules leave room for less than the transcript's last TRANSCRIPT_FLOOR characters, or all of a shorter transcript."""
|
||||
head = (
|
||||
f"From the goals file, {brief.premises}\n\n"
|
||||
f"The records: {brief.records_named}:\n{brief.records or 'none'}\n\n"
|
||||
@@ -299,8 +306,11 @@ def judge_prompt(brief: Brief) -> tuple[str, Grounds]:
|
||||
f"{transcript_heading(brief.driver)}"
|
||||
)
|
||||
rules = judge_rules(brief.answer_destinations, brief.driver)
|
||||
room = max(0, JUDGE_PROMPT_CHARS - len(head) - len(rules) - 2)
|
||||
room = JUDGE_PROMPT_CHARS - len(head) - len(rules) - 2
|
||||
transcript = escalation_mark.transcript(brief.entries, brief.escalated_at, typed_answer, brief.driver)
|
||||
needed = min(len(transcript), TRANSCRIPT_FLOOR)
|
||||
if room < needed:
|
||||
return Failure(f"the premises, the records, the task and the judge's rules leave {max(0, room):,} of the judge's {JUDGE_PROMPT_CHARS:,} characters for the transcript, less than the last {needed:,} characters of it that the judge must read. Cut the records, which take {len(brief.records):,}, by at least {needed - room:,}.")
|
||||
# The tail, where an interrupt or a finish lands; the session's transcript grows cycle over cycle.
|
||||
shown = transcript[max(0, len(transcript) - room):]
|
||||
grounds = Grounds(
|
||||
|
||||
@@ -124,19 +124,20 @@ class Verdict(unittest.TestCase):
|
||||
verdict = judge.judge_once("/r", judge.Brief("Do it.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 1, "loop-claude"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", evidence="round 2: 🔴")]).effects())
|
||||
self.assertEqual(verdict, Unfinished("round 2: 🔴", entries_read=2))
|
||||
|
||||
def test_takes_the_task_as_evidence_where_the_tail_it_shows_cuts_off_the_workers_first_prompt(self):
|
||||
def test_takes_the_task_as_evidence_where_the_tail_it_shows_cuts_off_the_workers_first_prompt_but_no_quote_across_the_join(self):
|
||||
entries = [human("Do the next chunk. " + "x" * judge.JUDGE_PROMPT_CHARS), assistant({"type": "text", "text": "Merged."})]
|
||||
def judged_on(evidence):
|
||||
return judge.judge_once("/r", judge.Brief("Do the next chunk.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 0, "loop-claude"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", evidence=evidence)] * 3).effects())
|
||||
self.assertEqual(judged_on("Do the next chunk."), Unfinished("Do the next chunk.", entries_read=2))
|
||||
self.assertEqual(judged_on("Do the next chunk. ... Merged."), Unfinished("Do the next chunk. ... Merged.", entries_read=2))
|
||||
self.assertIsInstance(judged_on("Do the next release."), Failure)
|
||||
self.assertIsInstance(judged_on("next chunk. xxx"), Failure)
|
||||
|
||||
|
||||
class JudgePrompt(unittest.TestCase):
|
||||
def brief(self, entries, escalated_at, answer_destinations="the plan or a comment"):
|
||||
def brief(self, entries, escalated_at, answer_destinations="the plan or a comment", records=""):
|
||||
"""What the judge of a-driver reads of a transcript holding entries."""
|
||||
return judge.Brief("Do it.", "## Goals", "", "the project's decisions", answer_destinations, kinds(*entries), escalated_at, "a-driver")
|
||||
return judge.Brief("Do it.", "## Goals", records, "the project's decisions", answer_destinations, kinds(*entries), escalated_at, "a-driver")
|
||||
|
||||
def test_shows_the_transcripts_tail_and_returns_what_it_showed(self):
|
||||
entries = [assistant({"type": "text", "text": "old " + "x" * judge.JUDGE_PROMPT_CHARS}), assistant({"type": "text", "text": "new"})]
|
||||
@@ -148,6 +149,41 @@ class JudgePrompt(unittest.TestCase):
|
||||
self.assertEqual(grounds.after_mark, "old " + "x" * judge.JUDGE_PROMPT_CHARS + "\n\nnew")
|
||||
self.assertEqual(grounds.quotable, "## Goals\n\n")
|
||||
|
||||
# A transcript longer than the floor: an old message, then the last one.
|
||||
LONG = [assistant({"type": "text", "text": "old " + "x" * judge.TRANSCRIPT_FLOOR}), assistant({"type": "text", "text": "Merged."})]
|
||||
|
||||
def overhead(self):
|
||||
"""The characters of the judge's prompt that are neither the records nor the transcript."""
|
||||
prompt, grounds = judge.judge_prompt(self.brief(self.LONG, 0, records="r"))
|
||||
return len(prompt) - len(grounds.shown) - 1
|
||||
|
||||
def test_fails_naming_the_shortfall_where_the_records_leave_less_than_the_transcripts_floor(self):
|
||||
failed = judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (judge.JUDGE_PROMPT_CHARS + 1)))
|
||||
self.assertIsInstance(failed, Failure)
|
||||
for fact in ("leave 0 of the judge's 400,000", "400,001", f"{judge.TRANSCRIPT_FLOOR:,}", f"by at least {judge.TRANSCRIPT_FLOOR + self.overhead() + 1:,}"):
|
||||
with self.subTest(fact=fact):
|
||||
self.assertIn(fact, failed.reason)
|
||||
|
||||
def test_judge_once_returns_that_failure_without_starting_claude(self):
|
||||
failed = judge.judge_once("/r", self.brief(self.LONG, 0, records="r" * judge.JUDGE_PROMPT_CHARS), Rung("judge-model"), FakeEffects(claude=[]).effects())
|
||||
self.assertIsInstance(failed, Failure)
|
||||
self.assertIn(f"{judge.TRANSCRIPT_FLOOR:,}", failed.reason)
|
||||
|
||||
def test_shows_the_whole_of_a_transcript_longer_than_the_floor_where_the_records_leave_room_for_it(self):
|
||||
whole = "old " + "x" * judge.TRANSCRIPT_FLOOR + "\n\nMerged."
|
||||
prompt, grounds = judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - self.overhead() - len(whole))))
|
||||
self.assertEqual(grounds.shown, whole)
|
||||
self.assertLessEqual(len(prompt), judge.JUDGE_PROMPT_CHARS)
|
||||
|
||||
def test_shows_the_floor_where_the_records_leave_exactly_that(self):
|
||||
at_floor = judge.JUDGE_PROMPT_CHARS - self.overhead() - judge.TRANSCRIPT_FLOOR
|
||||
self.assertEqual(len(judge.judge_prompt(self.brief(self.LONG, 0, records="r" * at_floor))[1].shown), judge.TRANSCRIPT_FLOOR)
|
||||
self.assertIsInstance(judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (at_floor + 1))), Failure)
|
||||
|
||||
def test_shows_a_transcript_shorter_than_the_floor_whole(self):
|
||||
_, grounds = judge.judge_prompt(self.brief([assistant({"type": "text", "text": "Merged."})], 0, records="r" * (judge.JUDGE_PROMPT_CHARS - 10000)))
|
||||
self.assertEqual(grounds.shown, "Merged.")
|
||||
|
||||
def test_the_judge_prompt_and_schema_call_the_worker_the_worker(self):
|
||||
prompt, _ = judge.judge_prompt(self.brief([assistant({"type": "text", "text": "done"})], 1))
|
||||
self.assertNotRegex(prompt + json.dumps(judge.judge_schema("a-driver")), r"\b[Aa]gent")
|
||||
|
||||
@@ -188,7 +188,7 @@ Worker: {OFF_LADDER}
|
||||
self.assertEqual(self.archived_outcomes(), [
|
||||
"Task: Do it.\n\n"
|
||||
f"{stamp} Judge reply rejected: the judge's reply has no answer of type string\n\nReply:\n> {unfilled.stdout}\n\nJudge: judge-model\n\n"
|
||||
f"{stamp} Judge reply rejected: the judge quoted 'never said', which is not in the transcript\n\nReply:\n> {misquoted.stdout}\n\nJudge: judge-model\n\n"
|
||||
f"{stamp} Judge reply rejected: the judge quoted 'never said', which is not in the task or the transcript\n\nReply:\n> {misquoted.stdout}\n\nJudge: judge-model\n\n"
|
||||
f"{stamp} Verdict: finished\n\nEvidence:\n> working\n\nConfig: {CONFIG}\nJudge: judge-model\nWorker: {OFF_LADDER}\n"])
|
||||
|
||||
def test_archives_each_judge_runs_prompt_and_reply_beside_the_rejection_interrupt_and_verdict_it_gave(self):
|
||||
|
||||
@@ -22,7 +22,7 @@ CONSEQUENCE = "the judge cannot read the records"
|
||||
|
||||
|
||||
def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path, first: tuple[tuple[str, str], ...] = ()) -> str | Failure:
|
||||
"""The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name; one that does not exist, or is empty, is left out.
|
||||
"""The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name. One that does not exist, or is empty, is left out. A text that several of them hold appears once, headed by all their names.
|
||||
|
||||
`AGENTS.md` is read where the config under home of root's project puts it, and the decision log from the store that config names. Each is headed by its name in RECORD_FILES wherever it is kept.
|
||||
|
||||
@@ -37,13 +37,14 @@ def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path,
|
||||
decisions = store(config, DECISIONS[1]).read()
|
||||
texts += [(WORKING_RULES[0], file_text(config.paths[WORKING_RULES[1]])), (DECISIONS[0], Failure(f"{decisions.reason} - {CONSEQUENCE}.") if isinstance(decisions, Failure) else decisions)]
|
||||
texts += [(named(rule, home, claude_dir), file_text(rule)) for rule in rules]
|
||||
records = []
|
||||
# Each text, with the names of the records that hold it: a config may keep the working rules in the decision log.
|
||||
records: dict[str, list[str]] = {}
|
||||
for heading, text in texts:
|
||||
if isinstance(text, Failure):
|
||||
return text
|
||||
if text.strip():
|
||||
records.append(f"From {heading}:\n{text.strip()}")
|
||||
return "\n\n".join(records)
|
||||
records.setdefault(text.strip(), []).append(heading)
|
||||
return "\n\n".join(f"From {' and '.join(headings)}:\n{text}" for text, headings in records.items())
|
||||
|
||||
|
||||
def file_text(path: pathlib.Path) -> str | Failure:
|
||||
|
||||
@@ -40,6 +40,10 @@ class Records(unittest.TestCase):
|
||||
pathlib.Path(root, "standards", "quality.md").write_text("# Elsewhere\n")
|
||||
self.assertTrue(records.read_records(root, claude_md.parents[1], claude_md.parent).endswith(f"From {root}/standards/quality.md:\n# Elsewhere"), "a folder outside home is named in full")
|
||||
|
||||
config.write_text(config.read_text().replace('"checkout:AGENTS.md"', '"checkout:docs/decisions.md"'))
|
||||
self.assertTrue(records.read_records(root, claude_md.parents[1], claude_md.parent).startswith("From AGENTS.md and docs/decisions.md:\n# Decisions\n\nFrom ~/.claude/CLAUDE.md:\n# Global"), "a file the config names for two records appears once")
|
||||
config.write_text(config.read_text().replace('"checkout:docs/decisions.md"', '"checkout:AGENTS.md"', 1))
|
||||
|
||||
config.write_text(config.read_text().replace('"checkout:AGENTS.md"', '"folder:AGENTS.md"').replace('"checkout:docs/decisions.md"', '"folder:log/decisions.md"'))
|
||||
self.assertTrue(records.read_records(root, claude_md.parents[1], claude_md.parent).startswith("From ~/.claude/CLAUDE.md:\n# Global"), "the checkout's AGENTS.md and docs/decisions.md are its owners'")
|
||||
pathlib.Path(config.parent, "log").mkdir()
|
||||
|
||||
@@ -476,6 +476,7 @@ def finished(run: Run, branch: str, finish: list[str], config: ProjectConfig) ->
|
||||
if isinstance(finishing, Failure):
|
||||
return finishing
|
||||
title = templates.title_of(config.commit_title, config.branch, branch, finish[0], f"Finish item {finish[0]} in the plan")
|
||||
# Under `merge = "human"` a plan or changelog outside the checkout is finished here, before the person merges, since no run follows that merge.
|
||||
# A plan in Jira, or a changelog on a Confluence page, is no file to commit.
|
||||
records = [record for record in (config.plan_file, config.paths.get("changelog")) if record is not None and record.is_file()]
|
||||
return committed(run, title, records)
|
||||
|
||||
@@ -9,11 +9,13 @@ PULLS_LIST: dict[Forge, tuple[str, ...]] = {"gh": ("gh", "pr", "list"), "tea": (
|
||||
|
||||
def worktree_on(porcelain: str, branch: str) -> pathlib.Path | None:
|
||||
"""The worktree on branch, in what `git worktree list --porcelain` printed; None where none is."""
|
||||
for block in porcelain.split("\n\n"):
|
||||
fields = dict(line.partition(" ")[::2] for line in block.splitlines())
|
||||
if fields.get("branch") == f"refs/heads/{branch}":
|
||||
return pathlib.Path(fields["worktree"])
|
||||
return None
|
||||
return next((path for path, on, _ in worktrees(porcelain) if on == branch), None)
|
||||
|
||||
|
||||
def worktrees(porcelain: str) -> list[tuple[pathlib.Path, str, str]]:
|
||||
"""Each worktree on a branch, in what `git worktree list --porcelain` printed: its path, its branch and its head commit."""
|
||||
blocks = [dict(line.partition(" ")[::2] for line in block.splitlines()) for block in porcelain.split("\n\n")]
|
||||
return [(pathlib.Path(fields["worktree"]), fields["branch"].removeprefix("refs/heads/"), fields.get("HEAD", "")) for fields in blocks if fields.get("branch", "").startswith("refs/heads/")]
|
||||
|
||||
|
||||
def worktree_add(branch: str, path: pathlib.Path, default: str, local: bool, pushed: bool) -> tuple[list[str], str]:
|
||||
|
||||
@@ -19,7 +19,7 @@ def render(found: Gathered) -> list[str]:
|
||||
"""One `- ` line per fact, then the item's tagline and detail, the detail of each item that may join its chunk, and what each tool printed."""
|
||||
note = [f"- {found.note}"] if found.note else []
|
||||
unseen = [f"- {UNSEEN_RELEASES}"] if found.plan_outside else []
|
||||
head = [*note, f"- {last_release(found.default, found.cut)}", *unseen]
|
||||
head = [*note, f"- {last_release(found.default, found.cut)}", *unseen, *merge_lines(found)]
|
||||
paths = f"- The project's config puts its files and plan at: {'; '.join(f'{setting} {path}' for setting, path in found.places.items())}."
|
||||
texts = f"- The project's config sets: {'; '.join(f'{setting} {text}' for setting, text in found.texts.items())}."
|
||||
if isinstance(found.item, NoItem):
|
||||
@@ -28,6 +28,16 @@ def render(found: Gathered) -> list[str]:
|
||||
return [*head, *lines[:2], paths, texts, *lines[2:]]
|
||||
|
||||
|
||||
def merge_lines(found: Gathered) -> list[str]:
|
||||
"""What `merge = "human"` leaves for the worker to know: each worktree a merged pull request left, the items passed over since their pull request awaits a person's merge, or why those pull requests could not be read."""
|
||||
left = [f"- The worktree {worktree.path}, on the branch {worktree.branch}, is left from pull request #{worktree.pull}, which has merged: run `~/.claude/bin/chunk-pr clean` in it as this chunk's first step." for worktree in found.left]
|
||||
items = found.item.plan.items if isinstance(found.item, ItemFacts) else []
|
||||
passed = [f"item {item.id}, by pull request {item.awaits_merge}" for item in items if item.awaits_merge]
|
||||
over = [f"- Items passed over, each finished on a branch whose ready pull request awaits a person's merge: {'; '.join(passed)}. No chunk takes one."] if passed else []
|
||||
unread = [f"- The pull requests that await a person's merge cannot be read, so no item is passed over for one: {found.merges_unread.reason}"] if found.merges_unread else []
|
||||
return [*left, *over, *unread]
|
||||
|
||||
|
||||
def last_release(default: str, release: LastCut) -> str:
|
||||
if isinstance(release.tag, Failure):
|
||||
return f"Last version cut: cannot be read: {release.tag.reason}"
|
||||
|
||||
@@ -44,6 +44,15 @@ class ItemFacts:
|
||||
tools: list[tuple[str, Ran | Failure]]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class LeftWorktree:
|
||||
"""A worktree on a branch whose pull request has merged."""
|
||||
path: pathlib.Path
|
||||
branch: str
|
||||
# The merged pull request's number.
|
||||
pull: str
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Gathered:
|
||||
"""Everything the preflight read and ran, for facts.render to state."""
|
||||
@@ -62,3 +71,7 @@ class Gathered:
|
||||
plan_outside: bool
|
||||
# The language and the templates the project's config names, by their settings.
|
||||
texts: dict[str, str]
|
||||
# Why the pull requests that await a person's merge could not be read; None where they were read or not asked for.
|
||||
merges_unread: Failure | None = None
|
||||
# The worktrees `chunk-pr clean` is still to remove.
|
||||
left: tuple[LeftWorktree, ...] = ()
|
||||
|
||||
@@ -16,10 +16,15 @@ and prints that the release reviews and the cuts are the human's to call. It pri
|
||||
newest version CHANGELOG.md heads `## X.Y.Z - YYYY-MM-DD`; an undated heading doesn't count.
|
||||
Then how many entries the default branch's CHANGELOG.md holds under ## Unreleased, or else how
|
||||
many commits followed the cut: the tag, or the commit that added that heading;
|
||||
- under `merge = "human"` (`project-config --help`), each worktree beside the checkout whose pull
|
||||
request has merged, for the worker to run `chunk-pr clean` in, and each item passed over: one
|
||||
finished on the branch of an open pull request that is not a draft, where the checkout holds
|
||||
the plan. Where no item of the release can start and one awaits such a merge, it names those
|
||||
pull requests and says the working loop stops there;
|
||||
- the next release and its first item that does not wait, the item loop-claude routes on, with its L
|
||||
and E + I; with --item <ID>, the plan item of that ID instead, which loop-claude names in a window
|
||||
named for an item. An item waits while it is marked question, or while an item still in todo.md
|
||||
blocks it. Where the last cut is a version x.y.z, the next release is the earliest after x.y.z
|
||||
named for an item. An item waits while it is marked question, while an item still in todo.md
|
||||
blocks it, or while it awaits such a merge. Where the last cut is a version x.y.z, the next release is the earliest after x.y.z
|
||||
that todo.md has named at that cut or since, less a release its ## Renamed section marks renamed.
|
||||
Where nothing is cut, it is the earliest release todo.md has ever named, less those renamed, so a
|
||||
release whose items are all done still reads as next.
|
||||
@@ -78,14 +83,15 @@ import typing
|
||||
|
||||
from git_cli.git_repo import commit_exists, default_branch, file_at, git, top
|
||||
from failure import Failure
|
||||
from forge.commands import Forge, forge_of
|
||||
from chunk_preflight.gathered import Gathered, ItemFacts, NamedPath, Ran, Worktree
|
||||
from forge.commands import Forge, forge_of, Run, runner
|
||||
from chunk_preflight.gathered import Gathered, ItemFacts, LeftWorktree, NamedPath, Ran, Worktree
|
||||
from chunk_preflight.facts import JOINING_DETAILS, render
|
||||
from project_config.main import located
|
||||
from forge.pulls import merged_pull
|
||||
from plan.named_paths import named_paths
|
||||
from release_plan.next_chunk import NextChunk, NoItem, plan_name, planned
|
||||
from release_plan.release_standing import project_plan
|
||||
from chunk_preflight.choices import pulls_command, worktree_add, worktree_on
|
||||
from chunk_preflight.choices import pulls_command, worktree_add, worktree_on, worktrees
|
||||
|
||||
BIN = pathlib.Path(__file__).resolve().parents[1]
|
||||
# Each tool run in the item's worktree, {item} standing for the item's ID.
|
||||
@@ -143,12 +149,13 @@ def preflight(root: pathlib.Path, timeout: float, make: bool, item_id: int | Non
|
||||
if isinstance(config, Failure):
|
||||
return config
|
||||
outside = None if config.tracked("plan") else config.plan_label
|
||||
held = project_plan(config, ref, str(root))
|
||||
forge_run = runner(str(root), timeout)
|
||||
held = project_plan(config, ref, str(root), forge_run=forge_run)
|
||||
plan = planned(held.plan, held.cut, ref, config.branch, outside, item_id)
|
||||
item = plan if isinstance(plan, NoItem) else item_facts(root, ref, plan, timeout, make)
|
||||
# A `checkout:` path lands in the worktree the chunk works in.
|
||||
made = located(str(item.worktree.path), pathlib.Path.home()) if isinstance(item, ItemFacts) and isinstance(item.worktree, Worktree) else config
|
||||
return render(Gathered(ref, note, held.cut, item, plan_name(ref, outside), (config if isinstance(made, Failure) else made).places, outside is not None, config.texts))
|
||||
return render(Gathered(ref, note, held.cut, item, plan_name(ref, outside), (config if isinstance(made, Failure) else made).places, outside is not None, config.texts, merges_unread=held.merges_unread, left=left_worktrees(root, forge_run) if config.merge == "human" else ()))
|
||||
|
||||
|
||||
def item_facts(root: pathlib.Path, default: str, plan: NextChunk, timeout: float, make: bool) -> ItemFacts:
|
||||
@@ -173,6 +180,15 @@ def item_worktree(root: pathlib.Path, branch: str, default: str) -> Worktree | F
|
||||
return Failure(f"none made: {added.reason}") if isinstance(added, Failure) else Worktree(path, how)
|
||||
|
||||
|
||||
def left_worktrees(root: pathlib.Path, forge_run: Run) -> tuple[LeftWorktree, ...]:
|
||||
"""Each worktree but root that is on a branch whose pull request merged with the worktree's head commit as its head: under `merge = "human"` a person merges after the chunk's run has ended, so its worker never ran `chunk-pr clean`. Where the forge can't be asked, no worktree counts as left."""
|
||||
listing, url = git("worktree", "list", "--porcelain"), git("remote", "get-url", "origin")
|
||||
if isinstance(listing, Failure) or isinstance(url, Failure):
|
||||
return ()
|
||||
merged = [(path, branch, merged_pull(forge_of(url), branch, head, forge_run)) for path, branch, head in worktrees(listing) if path != root]
|
||||
return tuple(LeftWorktree(path, branch, pull) for path, branch, pull in merged if isinstance(pull, str))
|
||||
|
||||
|
||||
def pull_listing(root: pathlib.Path, branch: str, timeout: float) -> tuple[Forge, Ran | Failure] | None:
|
||||
url = git("remote", "get-url", "origin")
|
||||
if isinstance(url, Failure):
|
||||
|
||||
@@ -12,14 +12,15 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
from project_config.templates import BRANCH
|
||||
from release_plan.next_chunk import CarriedOver, NoItem
|
||||
from failure import Failure
|
||||
from chunk_preflight.gathered import Gathered, ItemFacts, NamedPath, Ran, Worktree
|
||||
from chunk_preflight.gathered import Gathered, ItemFacts, LeftWorktree, NamedPath, Ran, Worktree
|
||||
from test_env import isolated_env
|
||||
from release_plan.release_standing import LastCut, UNSEEN_RELEASES
|
||||
from chunk_preflight.main import line_count, ran, seconds, TIMEOUT
|
||||
from release_plan.awaiting_merge import marked
|
||||
from release_plan import next_chunk
|
||||
from chunk_preflight.facts import open_pulls, render
|
||||
from plan_store.todo_md import plan_of
|
||||
from chunk_preflight.choices import worktree_add
|
||||
from chunk_preflight.choices import worktree_add, worktree_on, worktrees
|
||||
from project_config.doubles import write_config
|
||||
|
||||
BIN = pathlib.Path(__file__).resolve().parents[1]
|
||||
@@ -135,6 +136,34 @@ class Repo:
|
||||
|
||||
|
||||
class ChunkPreflightTool(unittest.TestCase):
|
||||
def test_passes_over_an_item_whose_pull_request_awaits_a_persons_merge_and_names_a_worktree_a_merged_one_left(self):
|
||||
repo = Repo(self, origin="github.com/o/r.git")
|
||||
config = repo.temp / "home" / ".claude-projects" / "proj" / "config.toml"
|
||||
config.write_text(config.read_text() + 'merge = "human"\n')
|
||||
repo.git(repo.root, "worktree", "add", "--quiet", "-b", "item-3", str(repo.temp / "proj-item-3"), "main")
|
||||
repo.write(repo.temp / "proj-item-3", "todo.md", TODO.replace("| 3 | 0.2.0 | | | **Do the next thing.** | 2 | 2 | 3 | 5 | 3 | 1 by 9 | 56.2 |\n", ""))
|
||||
repo.commit(repo.temp / "proj-item-3", "Finish item 3 in the plan")
|
||||
ready = repo.git(repo.temp / "proj-item-3", "rev-parse", "HEAD").strip()
|
||||
repo.git(repo.root, "worktree", "add", "--quiet", "-b", "item-2", str(repo.temp / "proj-item-2"), "main")
|
||||
left = repo.git(repo.temp / "proj-item-2", "rev-parse", "HEAD").strip()
|
||||
(repo.fake / "gh").write_text(f"""#!{sys.executable}
|
||||
import sys
|
||||
args = sys.argv[1:]
|
||||
if args[:4] == ["pr", "list", "--limit", "100"]:
|
||||
print("12\\thttps://github.com/o/r/pull/12\\t{ready}\\tfalse\\tfalse")
|
||||
elif args[:6] == ["pr", "list", "--head", "item-2", "--state", "merged"]:
|
||||
print("11\\t{left}\\tfalse")
|
||||
""")
|
||||
done = repo.preflight()
|
||||
self.assertEqual(done.returncode, 0, done.stderr)
|
||||
self.assertIn(f"- The worktree {repo.temp}/proj-item-2, on the branch item-2, is left from pull request #11, which has merged: run `~/.claude/bin/chunk-pr clean` in it as this chunk's first step.\n", done.stdout)
|
||||
self.assertNotIn("proj-item-3, on the branch", done.stdout, "an open pull request leaves no worktree to clean")
|
||||
self.assertIn("No plan item: every item of release 0.2.0 in origin/main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #12 https://github.com/o/r/pull/12, which finishes item 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again.", done.stdout)
|
||||
(repo.fake / "gh").write_text("#!/bin/sh\necho 'not logged in' >&2\nexit 1\n")
|
||||
unread = repo.preflight()
|
||||
self.assertIn("- The pull requests that await a person's merge cannot be read, so no item is passed over for one: gh pr list: not logged in\n", unread.stdout)
|
||||
self.assertIn("Its first item that does not wait: item 3,", unread.stdout)
|
||||
|
||||
def test_reads_a_plan_outside_the_checkout_as_it_stands_and_names_where_the_config_puts_each_file(self):
|
||||
repo = Repo(self)
|
||||
folder = repo.temp / "home" / ".claude-projects" / "proj"
|
||||
@@ -408,6 +437,20 @@ def rendered(item, release=CUT, note=None):
|
||||
|
||||
|
||||
class Render(unittest.TestCase):
|
||||
def test_reads_each_worktree_on_a_branch_from_gits_listing(self):
|
||||
porcelain = "worktree /c/proj\nHEAD aaa\nbranch refs/heads/main\n\nworktree /c/my proj-item-2\nHEAD bbb\nbranch refs/heads/item-2\n\nworktree /c/detached\nHEAD ccc\ndetached\n"
|
||||
self.assertEqual(worktrees(porcelain), [(pathlib.Path("/c/proj"), "main", "aaa"), (pathlib.Path("/c/my proj-item-2"), "item-2", "bbb")])
|
||||
self.assertEqual((worktree_on(porcelain, "item-2"), worktree_on(porcelain, "item-3")), (pathlib.Path("/c/my proj-item-2"), None))
|
||||
|
||||
def test_states_what_a_persons_merge_leaves_only_where_there_is_something(self):
|
||||
self.assertNotIn("merge", rendered(item_facts()))
|
||||
found = gathered(NoItem("the plan holds none."))
|
||||
left = dataclasses.replace(found, left=(LeftWorktree(pathlib.Path("/c/proj-item-2"), "item-2", "11"),), merges_unread=Failure("`gh pr list` exited 1: no"))
|
||||
passed = "\n".join(render(gathered(item_facts(marked(plan_of(TODO), {7: "#12 https://github.com/o/r/pull/12", 8: "#13 https://github.com/o/r/pull/13"})))))
|
||||
self.assertIn("\n- Items passed over, each finished on a branch whose ready pull request awaits a person's merge: item 7, by pull request #12 https://github.com/o/r/pull/12; item 8, by pull request #13 https://github.com/o/r/pull/13. No chunk takes one.\n", passed)
|
||||
self.assertIn("- No other item of release 0.2.0 may join item 3's chunk.", passed)
|
||||
self.assertEqual(render(left)[1:3], ["- The worktree /c/proj-item-2, on the branch item-2, is left from pull request #11, which has merged: run `~/.claude/bin/chunk-pr clean` in it as this chunk's first step.", "- The pull requests that await a person's merge cannot be read, so no item is passed over for one: `gh pr list` exited 1: no"])
|
||||
|
||||
def test_states_the_earliest_releases_first_item_its_levels_and_detail_and_each_item_that_may_join_its_chunk(self):
|
||||
said = rendered(item_facts())
|
||||
self.assertIn("origin/main's todo.md: 0.2.0", said)
|
||||
|
||||
+25
-3
@@ -17,6 +17,8 @@ One pair per machine, the same for every epic (docs/decisions.md → `do-epic: d
|
||||
- `clone-folder` is the folder a missing repo is cloned into: a path that starts with / or ~/. `~/code` where left out.
|
||||
- `language` is the default language of Jira text, by its English name. English where left out.
|
||||
- `jira-finish-transition` and `jira-finish-status` name the workflow transition that moves a finished chunk's issue and closes a finished epic, such as "Mark as done", and the status it leads to, such as "Done". A project's config names a plan item's the same way. Set both or neither; without them do-epic moves no issue to done and closes no epic.
|
||||
- `jira-unblocking-statuses` lists the statuses at which an issue's work has landed though Jira doesn't count it done yet, such as `["Release Ready"]`, in upper or lower case. An issue in one of them takes no chunk and no longer blocks the issues it blocks. A status Jira counts as done always does both, listed or not.
|
||||
- `jira-automation-moves-issues = true` says the team's own automation moves an issue when its pull request merges. do-epic then moves only the issue of a chunk without a repo, which has no pull request, and waits for the automation to move each other. It needs `jira-unblocking-statuses`, which then names the status the automation gives an issue whose pull request merged. false where left out.
|
||||
- `[label-repos]` has one line for each label of the team's own that names a repo: the label, then that repo's name, such as `twu-4 = "tenant-web-ui-4"`. do-epic reads such a label as it reads its own `repo:<name>`. A team whose label is the repo's name maps the name to itself.
|
||||
- `repo-rule.md` is prose that says how to tell an item's repo, and mustn't be blank."""
|
||||
import dataclasses
|
||||
@@ -24,7 +26,7 @@ import pathlib
|
||||
import re
|
||||
import types
|
||||
|
||||
from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, Finish, finish_faults, finish_of, JIRA_FINISH, LANGUAGE, language_fault, lies_in, parsed, PROJECTS, SITE
|
||||
from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, Finish, finish_faults, finish_of, JIRA_FINISH, LANGUAGE, language_fault, lies_in, name_of, parsed, PROJECTS, SITE
|
||||
from failure import Failure
|
||||
from do_epic.backend.protocol import LABEL
|
||||
from do_epic.repo_pick import LabelRepos, of_label, REPO_NAME, REVIEW_LABEL
|
||||
@@ -40,7 +42,10 @@ CLONE_FOLDER = "clone-folder"
|
||||
SETTINGS = (JIRA_URL, ENV_FILE, REPOLESS_MODEL)
|
||||
# Three readers, seated as those who write and read this config, picked `label-repos` from four candidates, over `repo-aliases`, `repo-labels` and `team-labels`, 2-1. All three readers would misread `repo-labels` as mapping a repo to its label.
|
||||
LABEL_REPOS = "label-repos"
|
||||
OPTIONAL = (CLONE_FOLDER, LANGUAGE, *JIRA_FINISH, LABEL_REPOS)
|
||||
# Three readers, seated as those who write and read this config, picked `jira-unblocking-statuses` from four candidates, 3-0, and `jira-automation-moves-issues` 2-1. `jira-unblock-statuses` reads as statuses do-epic moves an issue to, and `jira-finish-issues = false` as closing no epic either.
|
||||
UNBLOCKING_STATUSES = "jira-unblocking-statuses"
|
||||
AUTOMATION_MOVES = "jira-automation-moves-issues"
|
||||
OPTIONAL = (CLONE_FOLDER, LANGUAGE, *JIRA_FINISH, UNBLOCKING_STATUSES, AUTOMATION_MOVES, LABEL_REPOS)
|
||||
LISTED = f"The settings are {', '.join(SETTINGS)}, and optionally {listed(OPTIONAL, 'and')}."
|
||||
|
||||
|
||||
@@ -58,6 +63,9 @@ class DoEpicConfig:
|
||||
finish: Finish | None = None
|
||||
# The LABEL_REPOS table; empty where the config has none.
|
||||
label_repos: LabelRepos = types.MappingProxyType({})
|
||||
# The UNBLOCKING_STATUSES list; empty where the config has none.
|
||||
unblocking: tuple[str, ...] = ()
|
||||
automation_moves: bool = False
|
||||
|
||||
|
||||
def label_repo_faults(table: object) -> list[str]:
|
||||
@@ -72,6 +80,17 @@ def label_repo_faults(table: object) -> list[str]:
|
||||
]
|
||||
|
||||
|
||||
def workflow_faults(values: dict[str, object]) -> list[str]:
|
||||
"""What is wrong with the UNBLOCKING_STATUSES list and the AUTOMATION_MOVES switch in values."""
|
||||
statuses, moves = values.get(UNBLOCKING_STATUSES, ["Done"]), values.get(AUTOMATION_MOVES, False)
|
||||
return [
|
||||
*([f"`{UNBLOCKING_STATUSES}` is {statuses!r}, not a list of the status names Jira shows, such as [\"Release Ready\"]"] if not (isinstance(statuses, list) and statuses and all(name_of(status) for status in statuses)) else []),
|
||||
*([f"`{AUTOMATION_MOVES}` is {moves!r}, not true or false"] if not isinstance(moves, bool) else []),
|
||||
# With no status listed, an issue whose pull request merged would read as open, and its chunk would start again.
|
||||
*([f"`{AUTOMATION_MOVES}` is set, so `{UNBLOCKING_STATUSES}` must name the status the automation gives an issue whose pull request merged"] if moves is True and UNBLOCKING_STATUSES not in values else []),
|
||||
]
|
||||
|
||||
|
||||
def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfig | Failure:
|
||||
"""The settings and the repo rule under home; a Failure naming the file it can't read, else each missing or misspelt setting it finds, so that do-epic refuses to start."""
|
||||
folder = home / PROJECTS / DO_EPIC
|
||||
@@ -102,6 +121,7 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi
|
||||
*([f"`{LANGUAGE}` is {language!r}, {fault}"] if LANGUAGE in values and (fault := language_fault(language)) else []),
|
||||
*([f"`{REPOLESS_MODEL}` is {model!r}, not a model on the routing ladder: {', '.join(models)}"] if REPOLESS_MODEL in values and model not in models else []),
|
||||
*finish_faults(values),
|
||||
*workflow_faults(values),
|
||||
*label_repo_faults(values.get(LABEL_REPOS, {})),
|
||||
*([rule.reason] if isinstance(rule, Failure) else [f"`{REPO_RULE}` is blank"] if not rule.strip() else []),
|
||||
]
|
||||
@@ -111,4 +131,6 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi
|
||||
assert clone_folder and env_file and isinstance(url, str) and isinstance(model, str) and isinstance(language, str) and isinstance(rule, str)
|
||||
labels = values.get(LABEL_REPOS, {})
|
||||
assert isinstance(labels, dict)
|
||||
return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule, finish_of(values), types.MappingProxyType(labels))
|
||||
statuses = values.get(UNBLOCKING_STATUSES, [])
|
||||
assert isinstance(statuses, list)
|
||||
return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule, finish_of(values), types.MappingProxyType(labels), tuple(statuses), values.get(AUTOMATION_MOVES) is True)
|
||||
|
||||
+13
-5
@@ -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
|
||||
|
||||
@@ -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, 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. 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):
|
||||
@@ -77,9 +82,12 @@ 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
|
||||
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:
|
||||
|
||||
@@ -16,11 +16,11 @@ from agent_cycle import tmux
|
||||
AWAITS = "a human's task"
|
||||
|
||||
|
||||
def holds_up(key: str, issues: list[EpicIssue], team: LabelRepos) -> list[str]:
|
||||
def holds_up(key: str, issues: list[EpicIssue], team: LabelRepos, unblocking: tuple[str, ...]) -> list[str]:
|
||||
"""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, team)[0]):
|
||||
if not any(chunk.human and chunk.issue == key for chunk in scheduler.chunks(issues, team, unblocking)[0]):
|
||||
return []
|
||||
return scheduler.held_up(issues)[key]
|
||||
return scheduler.held_up(issues, unblocking)[key]
|
||||
|
||||
|
||||
def message(task: EpicIssue, epic: str, held: list[str]) -> str:
|
||||
@@ -37,7 +37,7 @@ def notifier_checkout(issues: list[EpicIssue], team: LabelRepos, home: pathlib.P
|
||||
return None
|
||||
|
||||
|
||||
def awaited(task: EpicIssue, epic: str, store: EpicStore, team: LabelRepos, window: tmux.Window, poll: int, home: pathlib.Path, effects: Effects) -> None:
|
||||
def awaited(task: EpicIssue, epic: str, store: EpicStore, team: LabelRepos, unblocking: tuple[str, ...], 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
|
||||
@@ -47,7 +47,7 @@ def awaited(task: EpicIssue, epic: str, store: EpicStore, team: LabelRepos, wind
|
||||
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, team)):
|
||||
elif not (held := holds_up(task.key, issues, team, unblocking)):
|
||||
return
|
||||
elif not told:
|
||||
text = message(task, epic, held)
|
||||
|
||||
+47
-16
@@ -27,6 +27,7 @@ from agent_cycle.verdicts import Finished, TakenIn
|
||||
from atlassian.jira import ISSUE_KEY
|
||||
from do_epic.backend.jira import JiraEpic
|
||||
from claude_code.reply import Limited
|
||||
from text_files.markdown_text import listed
|
||||
from do_epic.repos import locate
|
||||
from chunk_driver.this_loop import Loop
|
||||
from chunk_driver.project.model_choice import Models, overridden
|
||||
@@ -142,7 +143,7 @@ def run(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launcher:
|
||||
def status_printed(epic: EpicRun) -> Stop:
|
||||
"""What `do-epic <EPIC-KEY> --status` does: prints a line per open issue, and doesn't start anything."""
|
||||
issues = epic.store.read()
|
||||
lines = issues if isinstance(issues, Failure) else status.lines(epic.key, epic.paths.home, issues, epic.config.label_repos, epic.effects.tmux)
|
||||
lines = issues if isinstance(issues, Failure) else status.lines(epic.key, epic.paths.home, issues, epic.config.label_repos, epic.config.unblocking, epic.effects.tmux)
|
||||
return Stop(1, lines.reason) if isinstance(lines, Failure) else Stop(0, "\n".join(lines) or f"the epic {epic.key} has no open issue")
|
||||
|
||||
|
||||
@@ -211,7 +212,7 @@ def scheduled_epic(epic: EpicRun) -> scheduler.Epic | Failure:
|
||||
seen.append(found.checkout)
|
||||
return real(found.checkout), found.config.parallel_chunks
|
||||
|
||||
return scheduler.Epic(epic.key, cap, located, epic.paths.home, epic.launcher, epic.env, epic.config.label_repos)
|
||||
return scheduler.Epic(epic.key, cap, located, epic.paths.home, epic.launcher, epic.env, epic.config.label_repos, epic.config.unblocking)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -248,8 +249,8 @@ def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||
if isinstance(issue, Stop):
|
||||
return issue
|
||||
if issue and isinstance(recorded(issue, epic.config.label_repos), HumanTask):
|
||||
human_tasks.awaited(issue, epic.key, epic.store, epic.config.label_repos, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.paths.home, epic.effects)
|
||||
return handed_on(key, epic)
|
||||
human_tasks.awaited(issue, epic.key, epic.store, epic.config.label_repos, epic.config.unblocking, tmux.Window(epic.session, key, pane), POLL_SECONDS, epic.paths.home, epic.effects)
|
||||
return handed_on(key, epic, humans=True)
|
||||
place = chunk_root(key, issue, epic)
|
||||
if isinstance(place, Stop):
|
||||
return place
|
||||
@@ -281,13 +282,13 @@ def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||
news = parked_through(repo, loop, epic, told=news, finished=isinstance(concluded.verdict, Finished)) if repo is not None else ""
|
||||
# A chunk that was parked has work again, whatever the judge ruled before its pull request passed the gate.
|
||||
if isinstance(concluded.verdict, Finished) and news == "":
|
||||
return handed_on(key, epic)
|
||||
return handed_on(key, epic, repo is not None)
|
||||
|
||||
|
||||
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 +306,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)
|
||||
@@ -423,17 +428,23 @@ def folder_made(root: str) -> Failure | None:
|
||||
return None
|
||||
|
||||
|
||||
def handed_on(key: str, epic: EpicRun) -> Stop:
|
||||
"""The stop of a do-epic whose chunk finished. It first moves the chunk's issue to done (the epic's finishing has none), and its split item too where that was the last of the item's sub-tasks, so that no finished chunk starts again and what they block may start, then starts each chunk that may start now. Its window closes as it exits."""
|
||||
# The epic's finishing has no issue to move: the epic is closed by `--close-epic`.
|
||||
moved = None if key == epic.key else epic.store.finish_issue(key)
|
||||
if isinstance(moved, Failure):
|
||||
return Stop(1, f"the chunk finished, but its issue could not move to done: {moved.reason}; once it is done in Jira, run `do-epic {epic.key}` to start the chunks it blocks")
|
||||
issues = epic.store.read()
|
||||
def handed_on(key: str, epic: EpicRun, in_repo: bool = False, humans: bool = False) -> Stop:
|
||||
"""The stop of a do-epic whose chunk finished. It first moves the chunk's issue to done (the epic's finishing has none), and its split item too where that was the last of the item's sub-tasks, so that no finished chunk starts again and what they block may start, then starts each chunk that may start now. Where the team's automation moves issues, others move two kinds of issue. The automation moves the issue of a chunk in a repo, which in_repo marks, from its pull request: the stop waits for that move (`moved_by_automation`). The human moves their own task, which humans marks: the stop moves and awaits nothing. A chunk without a repo has no pull request, so its issue moves to done as ever, and so does a split item, once Jira counts each of its sub-tasks done. Its window closes as it exits."""
|
||||
automated = epic.config.automation_moves
|
||||
# The epic's finishing has no issue to move: the epic is closed by `--close-epic`. Nor has a human's task where the human moves it: its window waited until it holds up no issue.
|
||||
if key == epic.key or (humans and automated):
|
||||
issues: list[EpicIssue] | Failure = epic.store.read()
|
||||
elif in_repo and automated:
|
||||
issues = moved_by_automation(key, epic)
|
||||
else:
|
||||
moved = epic.store.finish_issue(key)
|
||||
if isinstance(moved, Failure):
|
||||
return Stop(1, f"the chunk finished, but its issue could not move to done: {moved.reason}; once it is done in Jira, run `do-epic {epic.key}` to start the chunks it blocks")
|
||||
issues = epic.store.read()
|
||||
# A search may not show the move yet, so the issue counts as done here whatever the read says.
|
||||
issues = issues if isinstance(issues, Failure) else [dataclasses.replace(each, done=True) if each.key == key else each for each in issues]
|
||||
if isinstance(issues, Failure):
|
||||
return Stop(1, f"the chunk finished, but the next could not start: {issues.reason}")
|
||||
# A search may not show the move yet, so the issue counts as done here whatever the read says.
|
||||
issues = [dataclasses.replace(each, done=True) if each.key == key else each for each in issues]
|
||||
closed = split_items_closed(epic, issues)
|
||||
if isinstance(closed, Stop):
|
||||
return closed
|
||||
@@ -444,6 +455,26 @@ def handed_on(key: str, epic: EpicRun) -> Stop:
|
||||
return Stop(0, "")
|
||||
|
||||
|
||||
def moved_by_automation(key: str, epic: EpicRun) -> list[EpicIssue]:
|
||||
"""The epic's issues once the issue called key no longer holds up another: read every POLL_SECONDS until the team's automation, or a person, has moved it. Until then a read would show it open, and its chunk would start again. A read that fails is made again."""
|
||||
told, unread = False, ""
|
||||
while True:
|
||||
issues = epic.store.read()
|
||||
if isinstance(issues, Failure):
|
||||
if issues.reason != unread:
|
||||
say(f"cannot read the epic, so cannot tell whether {key} has moved; trying again every {POLL_SECONDS} seconds: {issues.reason}", epic.effects, stdout=True)
|
||||
unread = issues.reason
|
||||
epic.effects.sleep(POLL_SECONDS)
|
||||
continue
|
||||
by_key = {each.key: each for each in issues}
|
||||
if key not in by_key or scheduler.settled(by_key[key], by_key, epic.config.unblocking):
|
||||
return issues
|
||||
if not told:
|
||||
say(f"{key} is {by_key[key].status}: it waits for the team's automation to move it to {listed(epic.config.unblocking, 'or')}; move it in Jira if the automation doesn't", epic.effects, stdout=True)
|
||||
told = True
|
||||
epic.effects.sleep(POLL_SECONDS)
|
||||
|
||||
|
||||
def split_items_closed(epic: EpicRun, issues: list[EpicIssue]) -> list[EpicIssue] | Stop:
|
||||
"""The issues, with each item split by repo whose sub-tasks are all done moved to done in the tracker and read as done; the stop where one cannot move. Its last sub-task to finish closes it, and one an earlier run left open closes with it."""
|
||||
for item in issues:
|
||||
|
||||
+34
-14
@@ -9,8 +9,9 @@ from do_epic.epic_record import CAP
|
||||
from chunk_driver.claims import CHUNK_FLAG, epic_chunks, HANDED, loop_chunks, project_lock, starting
|
||||
from do_epic.backend.protocol import EpicIssue
|
||||
from failure import Failure
|
||||
from do_epic.split import finished, is_split
|
||||
from do_epic.split import finished, is_split, SPLIT_LABEL
|
||||
from do_epic.repo_pick import HumanTask, LabelRepos, Pick, recorded, Repo
|
||||
from text_files.markdown_text import listed
|
||||
from project_config.settings import PARALLEL_CHUNKS
|
||||
from do_epic.parked import parked_chunks
|
||||
from chunk_pr.approval import PARKS
|
||||
@@ -73,43 +74,59 @@ class Epic:
|
||||
env: typing.Mapping[str, str]
|
||||
# The team's own labels for its repos.
|
||||
team: LabelRepos
|
||||
# The statuses `jira-unblocking-statuses` names; `settled` says what they do.
|
||||
unblocking: tuple[str, ...] = ()
|
||||
|
||||
@property
|
||||
def folder(self) -> pathlib.Path:
|
||||
return self.home / STATE / self.key
|
||||
|
||||
|
||||
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."""
|
||||
def unblocks(status: str, unblocking: tuple[str, ...]) -> bool:
|
||||
"""Whether status is one of the unblocking statuses, whatever its case, so a name typed in another case than Jira shows still matches."""
|
||||
return status.casefold() in {name.casefold() for name in unblocking}
|
||||
|
||||
|
||||
def settled(issue: EpicIssue, by_key: dict[str, EpicIssue], unblocking: tuple[str, ...]) -> bool:
|
||||
"""Whether the issue's work has landed, so that it takes no chunk and unblocks what it blocks: the tracker counts it done, or its status is one of unblocking, such as one the team's automation gives an issue whose pull request merged. An item marked SPLIT_LABEL has landed once each of its sub-tasks has, since nobody moves it before they are done."""
|
||||
tasks = [task for task in by_key.values() if task.parent == issue.key] if SPLIT_LABEL in issue.labels else []
|
||||
return issue.done or unblocks(issue.status, unblocking) or bool(tasks) and all(settled(task, by_key, unblocking) for task in tasks)
|
||||
|
||||
|
||||
def open_blockers(issue: EpicIssue, by_key: dict[str, EpicIssue], unblocking: tuple[str, ...] = ()) -> list[str]:
|
||||
"""The keys of the issues that block issue, or its parent, that are not settled. 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]
|
||||
return [key for key in (*issue.blockers, *(parent.blockers if parent else ())) if key not in by_key or not settled(by_key[key], by_key, unblocking)]
|
||||
|
||||
|
||||
def held_up(issues: list[EpicIssue]) -> dict[str, list[str]]:
|
||||
def held_up(issues: list[EpicIssue], unblocking: tuple[str, ...] = ()) -> dict[str, list[str]]:
|
||||
"""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:
|
||||
if not issue.done and not is_split(issue, issues):
|
||||
for key in open_blockers(issue, by_key):
|
||||
if not settled(issue, by_key, unblocking) and not is_split(issue, issues):
|
||||
for key in open_blockers(issue, by_key, unblocking):
|
||||
held.setdefault(key, []).append(issue.key)
|
||||
return held
|
||||
|
||||
|
||||
def chunks(issues: list[EpicIssue], team: LabelRepos) -> tuple[list[Chunk], list[Waits]]:
|
||||
"""The open issues to work as chunks, in the tracker's rank order, and those that wait. A split item is worked through its sub-tasks, and what blocks it blocks them."""
|
||||
def chunks(issues: list[EpicIssue], team: LabelRepos, unblocking: tuple[str, ...] = ()) -> tuple[list[Chunk], list[Waits]]:
|
||||
"""The open issues to work as chunks, in the tracker's rank order, and those that wait. A split item is worked through its sub-tasks, and what blocks it blocks them. An issue in one of the unblocking statuses is worked already: it waits until Jira counts it done."""
|
||||
by_key = {issue.key: issue for issue in issues}
|
||||
holding = held_up(issues)
|
||||
holding = held_up(issues, unblocking)
|
||||
found: list[Chunk] = []
|
||||
waits: list[Waits] = []
|
||||
for issue in issues:
|
||||
if issue.done:
|
||||
continue
|
||||
if unblocks(issue.status, unblocking):
|
||||
waits.append(Waits(issue.key, f"its work has landed: it is {issue.status}, and the epic's finishing waits until Jira counts it done"))
|
||||
continue
|
||||
if is_split(issue, issues):
|
||||
if all(task.done for task in issues if task.parent == issue.key) and not finished(issues, issue.key):
|
||||
waits.append(Waits(issue.key, "its sub-tasks are done; close it in Jira"))
|
||||
continue
|
||||
turn = turn_of(issue, recorded(issue, team), open_blockers(issue, by_key), by_key, issue.key in holding)
|
||||
turn = turn_of(issue, recorded(issue, team), open_blockers(issue, by_key, unblocking), by_key, issue.key in holding, unblocking)
|
||||
if isinstance(turn, Chunk):
|
||||
found.append(turn)
|
||||
else:
|
||||
@@ -117,7 +134,7 @@ def chunks(issues: list[EpicIssue], team: LabelRepos) -> tuple[list[Chunk], list
|
||||
return found, waits
|
||||
|
||||
|
||||
def turn_of(issue: EpicIssue, pick: Pick | None | Failure, blocking: list[str], by_key: dict[str, EpicIssue], holds: bool) -> Chunk | Waits:
|
||||
def turn_of(issue: EpicIssue, pick: Pick | None | Failure, blocking: list[str], by_key: dict[str, EpicIssue], holds: bool, unblocking: tuple[str, ...] = ()) -> Chunk | Waits:
|
||||
"""The open issue's chunk, or why it waits. blocking are its open blockers, and holds says it holds up another open issue. 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. A blocker outside the epic blocks until the human removes the link, since its state is unknown."""
|
||||
if isinstance(pick, Failure):
|
||||
return Waits(issue.key, pick.reason)
|
||||
@@ -128,7 +145,10 @@ def turn_of(issue: EpicIssue, pick: Pick | None | Failure, blocking: list[str],
|
||||
if blocking:
|
||||
outside = [key for key in blocking if key not in by_key]
|
||||
unseen = f"; do-epic cannot see {' and '.join(outside)}, outside the epic, finish: remove such a link in Jira once its issue is done" if outside else ""
|
||||
return Waits(issue.key, f"{' and '.join(blocking)} block{'s' if len(blocking) == 1 else ''} it{unseen}")
|
||||
inside = [key for key in blocking if key in by_key]
|
||||
whom = ("it is" if len(blocking) == 1 else "each is") if not outside else f"{' and '.join(inside)} {'is' if len(inside) == 1 else 'are'}"
|
||||
until = f", until {whom} {listed((*unblocking, 'done'), 'or')}" if unblocking and inside else ""
|
||||
return Waits(issue.key, f"{' and '.join(blocking)} block{'s' if len(blocking) == 1 else ''} it{until}{unseen}")
|
||||
return Chunk(issue.key, pick.name if isinstance(pick, Repo) else None)
|
||||
|
||||
|
||||
@@ -144,7 +164,7 @@ def refusal(repo: str, room: RepoRoom) -> str | None:
|
||||
def start_chunks(epic: Epic, issues: list[EpicIssue], finishing: bool, own: str | None, run: tmux.Tmux) -> Started | Failure:
|
||||
"""Starts a do-epic in a new window for each of the epic's chunks that may start now. Where finishing is set, no issue is open, and the one chunk to start is the epic's finishing (finish.py), in a window named for the epic's key. own is the key of the chunk that asks, which has finished or parked: it counts as running nowhere, and no stopped chunk starts again. Where own is None, the human's `do-epic <EPIC-KEY>` asks, and each stopped chunk starts again. A parked chunk waits in its window; one without a live window, as after a reboot, starts again as a stopped chunk does, whatever the limits, since it goes on parked. A Failure says why a window could not start; those before it run."""
|
||||
session = tmux.session_name(tmux.EPIC, epic.key)
|
||||
found, waits = chunks(issues, epic.team)
|
||||
found, waits = chunks(issues, epic.team, epic.unblocking)
|
||||
if finishing:
|
||||
found.append(Chunk(epic.key, None))
|
||||
started: list[str] = []
|
||||
|
||||
@@ -18,9 +18,9 @@ def since(folder: pathlib.Path, chunk: Parked) -> str:
|
||||
return ""
|
||||
|
||||
|
||||
def lines(key: str, home: pathlib.Path, issues: list[EpicIssue], team: LabelRepos, run: tmux.Tmux) -> list[str] | Failure:
|
||||
def lines(key: str, home: pathlib.Path, issues: list[EpicIssue], team: LabelRepos, unblocking: tuple[str, ...], run: tmux.Tmux) -> list[str] | Failure:
|
||||
"""A line per open issue of the epic called key, in the tracker's rank order: that its chunk runs or asks the human, or why it waits. It doesn't start anything or check any limit, so the line of a chunk that has yet to start doesn't say which limit holds it back."""
|
||||
found, waits = chunks(issues, team)
|
||||
found, waits = chunks(issues, team, unblocking)
|
||||
folder = home / STATE / key
|
||||
parked = parked_chunks(folder)
|
||||
if isinstance(parked, Failure):
|
||||
|
||||
@@ -78,6 +78,27 @@ class ConfigTest(unittest.TestCase):
|
||||
self.write(SETTINGS + 'jira-finish-status = " "\n')
|
||||
self.assertIn('`jira-finish-status` is \' \', not the name Jira shows, such as "Done"; `jira-finish-status` is set, so `jira-finish-transition` must be too', self.failure())
|
||||
|
||||
def test_reads_the_unblocking_statuses_and_that_the_teams_automation_moves_issues(self) -> None:
|
||||
self.write(SETTINGS)
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual((found.unblocking, found.automation_moves), ((), False))
|
||||
self.write(SETTINGS + 'jira-unblocking-statuses = ["Release Ready", "Done"]\njira-automation-moves-issues = true\n')
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual((found.unblocking, found.automation_moves), (("Release Ready", "Done"), True))
|
||||
|
||||
def test_refuses_unblocking_statuses_that_are_no_list_of_names_and_a_switch_that_is_no_boolean(self) -> None:
|
||||
for value in ('"Done"', '["Done", " "]', "[]", "[1]"):
|
||||
with self.subTest(value=value):
|
||||
self.write(SETTINGS + f"jira-unblocking-statuses = {value}\n")
|
||||
self.assertIn('`jira-unblocking-statuses` is ', self.failure())
|
||||
self.assertIn(', not a list of the status names Jira shows, such as ["Release Ready"]', self.failure())
|
||||
self.write(SETTINGS + "jira-automation-moves-issues = true\n")
|
||||
self.assertIn("`jira-automation-moves-issues` is set, so `jira-unblocking-statuses` must name the status the automation gives an issue whose pull request merged", self.failure())
|
||||
self.write(SETTINGS + 'jira-automation-moves-issues = "yes"\n')
|
||||
self.assertIn("`jira-automation-moves-issues` is 'yes', not true or false", self.failure())
|
||||
|
||||
def test_refuses_while_the_config_is_missing(self) -> None:
|
||||
self.write(None)
|
||||
self.assertIn(f"cannot read {self.folder / 'config.toml'}", self.failure())
|
||||
|
||||
@@ -27,6 +27,7 @@ class WhenTheFinishingIsDue(DoEpicTest):
|
||||
self.assertIs(finish.due([]), False)
|
||||
self.assertIs(finish.due([issue("ABC-20", done=True), issue("ABC-21")]), False)
|
||||
self.assertIs(finish.due([issue("ABC-20", done=True), issue("ABC-21", done=True)]), True)
|
||||
self.assertIs(finish.due([issue("ABC-20", done=True), issue("ABC-21", status="Release Ready")]), False)
|
||||
|
||||
def test_an_item_split_by_repo_is_done_once_its_sub_tasks_are(self) -> None:
|
||||
split = [issue("ABC-20", "split-by-repo"), issue("ABC-40", "repo:api", done=True, parent="ABC-20")]
|
||||
|
||||
@@ -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"
|
||||
@@ -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 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))
|
||||
|
||||
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_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)
|
||||
|
||||
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:
|
||||
|
||||
@@ -11,6 +11,7 @@ from do_epic.test_main import DESCRIPTION, Description, DoEpicTest, MODELS, UNRE
|
||||
from do_epic.epic_record import EpicRecord
|
||||
from failure import Failure
|
||||
from loop_effects.doubles import FakeEffects
|
||||
from do_epic.human_tasks import holds_up
|
||||
from do_epic.scheduler import HUMAN_WAIT
|
||||
from do_epic.test_scheduler import issue
|
||||
from do_epic.backend.fake import MemoryEpic
|
||||
@@ -49,6 +50,37 @@ class AHumanTaskThatBlocksAnIssue(DoEpicTest):
|
||||
self.slept = slept
|
||||
return self.run_main(["--chunk", "ABC-19", "ABC-12"], fake, MODELS)
|
||||
|
||||
def moved_to_an_unblocking_status(self, switch: str, frees: tuple[str, dict[str, object]] = ("ABC-19", {"status": "Release Ready"}), starts: str = "ABC-21") -> bool:
|
||||
"""Whether Jira counts the task done after its window's run, where the config ends with switch. frees is the change in Jira that ends the wait: by default the human moves the task to an unblocking status. starts is what the window then starts."""
|
||||
with (self.home / ".claude-projects" / "do-epic" / "config.toml").open("a") as config:
|
||||
config.write('jira-unblocking-statuses = ["Release Ready"]\n' + switch)
|
||||
fake = FakeEffects(git=UNREAD, windows=WINDOW)
|
||||
slept: list[int] = []
|
||||
|
||||
def sleep(seconds: int) -> None:
|
||||
slept.append(seconds)
|
||||
self.assertLess(len(slept), 5, "the window still waits")
|
||||
if len(slept) == 2:
|
||||
self.epic.change(frees[0], **frees[1])
|
||||
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, slept), (0, "", [60, 60]))
|
||||
self.assertIn(f"the chunk finished; started {starts}\n", out)
|
||||
return next(each.done for each in self.epic.issues if each.key == "ABC-19")
|
||||
|
||||
def test_a_task_the_human_moves_to_an_unblocking_status_no_longer_holds_up_an_issue_and_moves_to_done(self) -> None:
|
||||
self.assertTrue(self.moved_to_an_unblocking_status(""))
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_the_humans_task_stays_where_the_human_moved_it(self) -> None:
|
||||
self.assertFalse(self.moved_to_an_unblocking_status("jira-automation-moves-issues = true\n"))
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_a_task_that_blocks_no_open_issue_any_more_ends_its_window_unmoved(self) -> None:
|
||||
self.assertFalse(self.moved_to_an_unblocking_status("jira-automation-moves-issues = true\n", ("ABC-21", {"done": True}), starts="no other"))
|
||||
|
||||
def test_a_task_holds_up_only_the_issues_no_unblocking_status_settles(self) -> None:
|
||||
issues = [issue("ABC-19", "do-epic-human"), issue("ABC-20", "do-epic-claude", blockers=("ABC-19",), status="Release Ready"), issue("ABC-21", "do-epic-claude", blockers=("ABC-19",))]
|
||||
self.assertEqual(holds_up("ABC-19", issues, {}, ("Release Ready",)), ["ABC-21"])
|
||||
|
||||
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)
|
||||
|
||||
@@ -449,6 +449,18 @@ class AChunksRun(DoEpicTest):
|
||||
self.assertEqual(code, 0, err)
|
||||
self.assertIn("the chunk finished; started ABC-22\n", out)
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_a_finished_chunk_without_a_repo_still_moves_its_own(self) -> None:
|
||||
(self.home / ".claude-projects" / "do-epic" / "config.toml").write_text(SETTINGS + 'jira-unblocking-statuses = ["Release Ready"]\njira-automation-moves-issues = true\n', encoding="utf-8")
|
||||
parent = issue("ABC-23", "split-by-repo")
|
||||
store = MemoryEpic("ABC-12", [self.issues[0], parent, issue("ABC-21", "do-epic-claude", parent="ABC-23"), issue("ABC-22", "do-epic-claude", blockers=("ABC-23",))])
|
||||
self.backend = lambda config, key: (store, EpicRecord(Description(self.description))) # type: ignore[method-assign,arg-type]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows="ABC-21\t0\t@9\n")
|
||||
code, out, err = self.run_main(["--chunk", "ABC-21", "ABC-12"], fake, MODELS)
|
||||
self.assertEqual(code, 0, err)
|
||||
# No pull request carries ABC-21, so do-epic moves it; its split item, then all done, closes as ever.
|
||||
self.assertEqual({each.key: each.done for each in store.issues}, {"ABC-20": False, "ABC-23": True, "ABC-21": True, "ABC-22": False})
|
||||
self.assertIn("the chunk finished; started ABC-22\n", out)
|
||||
|
||||
def test_the_last_sub_task_of_a_split_item_to_finish_moves_the_item_to_done_and_starts_what_it_blocks(self) -> None:
|
||||
parent = issue("ABC-21", "split-by-repo")
|
||||
tasks = [issue("ABC-23", "do-epic-claude", parent="ABC-21"), issue("ABC-24", "do-epic-claude", parent="ABC-21", done=True)]
|
||||
@@ -746,6 +758,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]
|
||||
@@ -763,6 +789,27 @@ class AChunkWhosePullRequestWaitsOnAGate(DoEpicTest):
|
||||
code, _, err, prompts = self.parked_run(fake)
|
||||
self.assertEqual((code, len(prompts)), (0, 1), err)
|
||||
|
||||
def test_where_the_teams_automation_moves_issues_a_finished_chunk_in_a_repo_moves_none_and_waits_for_the_move(self) -> None:
|
||||
(self.home / ".claude-projects" / "do-epic" / "config.toml").write_text(SETTINGS + 'jira-unblocking-statuses = ["Release Ready", "Shipped"]\njira-automation-moves-issues = true\n', encoding="utf-8")
|
||||
store = MemoryEpic("ABC-12", [*self.issues[:-1], issue("ABC-22", "do-epic-claude", blockers=("ABC-20",))])
|
||||
self.backend = lambda config, key: (store, EpicRecord(Description(self.description))) # type: ignore[method-assign,arg-type]
|
||||
self.forges = [awaiting(pulls="")]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
slept: list[float] = []
|
||||
|
||||
def sleep(seconds: float) -> None:
|
||||
slept.append(seconds)
|
||||
store.fails = "Jira answered 503" if len(slept) in (1, 2) else None
|
||||
if len(slept) == 4:
|
||||
store.change("ABC-20", status="Release Ready")
|
||||
fake.effects = lambda made=fake.effects(): dataclasses.replace(made, sleep=sleep) # type: ignore[method-assign]
|
||||
code, out, err, _ = self.parked_run(fake)
|
||||
self.assertEqual((code, slept), (0, [60, 60, 60, 60]), err)
|
||||
self.assertEqual(out.count("cannot read the epic, so cannot tell whether ABC-20 has moved; trying again every 60 seconds: Jira answered 503\n"), 1, out)
|
||||
self.assertEqual([(each.status, each.done) for each in store.issues if each.key == "ABC-20"], [("Release Ready", False)])
|
||||
self.assertEqual(out.count("ABC-20 is To Do: it waits for the team's automation to move it to Release Ready or Shipped; move it in Jira if the automation doesn't\n"), 1, out)
|
||||
self.assertIn("the chunk finished; started ABC-22\n", out)
|
||||
|
||||
def test_where_the_chunk_merges_an_approved_pull_request_parks_no_chunk(self) -> None:
|
||||
self.forges = [awaiting(decision="APPROVED")]
|
||||
fake = FakeEffects(streams=[self.worker()], claude=[judged("finished")], git=UNREAD, windows=PARKED_WINDOW)
|
||||
|
||||
@@ -7,7 +7,7 @@ import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from do_epic.scheduler import Chunk, chunks, Epic, HUMAN_WAIT, refusal, RepoRoom, resume, start_chunks, Started, Waits
|
||||
from do_epic.scheduler import Chunk, chunks, Epic, held_up, HUMAN_WAIT, refusal, RepoRoom, resume, start_chunks, Started, Waits
|
||||
from chunk_driver.claims import CHUNK_FLAG
|
||||
from do_epic import chunk_prompt
|
||||
from do_epic.backend.protocol import EpicIssue
|
||||
@@ -21,8 +21,8 @@ from project_config import settings
|
||||
from agent_cycle import tmux
|
||||
|
||||
|
||||
def issue(key: str, *labels: str, done: bool = False, blockers: tuple[str, ...] = (), parent: str = "ABC-12") -> EpicIssue:
|
||||
return EpicIssue(key, f"Do {key}", "", tuple(sorted(labels)), None, "Done" if done else "To Do", done, parent, blockers=blockers)
|
||||
def issue(key: str, *labels: str, done: bool = False, blockers: tuple[str, ...] = (), parent: str = "ABC-12", status: str | None = None) -> EpicIssue:
|
||||
return EpicIssue(key, f"Do {key}", "", tuple(sorted(labels)), None, status or ("Done" if done else "To Do"), done, parent, blockers=blockers)
|
||||
|
||||
|
||||
class TheCapLine(unittest.TestCase):
|
||||
@@ -120,6 +120,39 @@ class WhichIssuesAreChunks(unittest.TestCase):
|
||||
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")]))
|
||||
|
||||
def test_an_issue_in_an_unblocking_status_unblocks_what_it_blocks_and_waits_to_be_done_itself(self) -> None:
|
||||
issues = [issue("ABC-19", "repo:api", status="Release Ready"), issue("ABC-20", "repo:api", blockers=("ABC-19",)), issue("ABC-21", "repo:api", status="Code Review"), issue("ABC-22", "repo:api", blockers=("ABC-21",)), issue("ABC-23", "repo:api", done=True), issue("ABC-24", "repo:api", blockers=("ABC-23", "ABC-21", "ABC-22"))]
|
||||
self.assertEqual(chunks(issues, {}, ("Release Ready", "Shipped")), ([Chunk("ABC-20", "api"), Chunk("ABC-21", "api")], [
|
||||
Waits("ABC-19", "its work has landed: it is Release Ready, and the epic's finishing waits until Jira counts it done"),
|
||||
Waits("ABC-22", "ABC-21 blocks it, until it is Release Ready, Shipped or done"),
|
||||
Waits("ABC-24", "ABC-21 and ABC-22 block it, until each is Release Ready, Shipped or done"),
|
||||
]))
|
||||
self.assertEqual(chunks(issues[:2], {}), ([Chunk("ABC-19", "api")], [Waits("ABC-20", "ABC-19 blocks it")]))
|
||||
self.assertEqual(held_up(issues, ("Release Ready", "Shipped")), {"ABC-21": ["ABC-22", "ABC-24"], "ABC-22": ["ABC-24"]})
|
||||
|
||||
def test_a_humans_task_gets_no_window_for_an_issue_it_blocks_that_is_in_an_unblocking_status(self) -> None:
|
||||
issues = [issue("ABC-19", "do-epic-human"), issue("ABC-20", "repo:api", blockers=("ABC-19",), status="Release Ready")]
|
||||
self.assertEqual(chunks(issues, {}, ("Release Ready",))[0], [])
|
||||
|
||||
def test_an_unblocking_status_matches_whatever_its_case(self) -> None:
|
||||
issues = [issue("ABC-19", "repo:api", status="Release Ready"), issue("ABC-20", "repo:api", blockers=("ABC-19",))]
|
||||
self.assertEqual(chunks(issues, {}, ("release ready",)), ([Chunk("ABC-20", "api")], [Waits("ABC-19", "its work has landed: it is Release Ready, and the epic's finishing waits until Jira counts it done")]))
|
||||
|
||||
def test_names_an_unblocking_status_only_for_a_blocker_inside_the_epic(self) -> None:
|
||||
unseen = "outside the epic, finish: remove such a link in Jira once its issue is done"
|
||||
issues = [issue("ABC-19", "repo:api"), issue("ABC-20", "repo:api", blockers=("XYZ-1",)), issue("ABC-21", "repo:api", blockers=("ABC-19", "XYZ-1")), issue("ABC-22", "repo:api", blockers=("ABC-19", "ABC-20", "XYZ-1"))]
|
||||
self.assertEqual(chunks(issues, {}, ("Release Ready",))[1], [
|
||||
Waits("ABC-20", f"XYZ-1 blocks it; do-epic cannot see XYZ-1, {unseen}"),
|
||||
Waits("ABC-21", f"ABC-19 and XYZ-1 block it, until ABC-19 is Release Ready or done; do-epic cannot see XYZ-1, {unseen}"),
|
||||
Waits("ABC-22", f"ABC-19 and ABC-20 and XYZ-1 block it, until ABC-19 and ABC-20 are Release Ready or done; do-epic cannot see XYZ-1, {unseen}"),
|
||||
])
|
||||
|
||||
def test_a_split_item_unblocks_what_it_blocks_once_each_sub_task_is_in_an_unblocking_status(self) -> None:
|
||||
issues = [issue("ABC-20", "split-by-repo"), issue("ABC-23", "repo:api", parent="ABC-20", status="Release Ready"), issue("ABC-24", "repo:web", parent="ABC-20", done=True), issue("ABC-21", "repo:api", blockers=("ABC-20",))]
|
||||
self.assertEqual(chunks(issues, {}, ("Release Ready",))[0], [Chunk("ABC-21", "api")])
|
||||
self.assertEqual(chunks(issues, {})[0], [Chunk("ABC-23", "api")])
|
||||
self.assertEqual(chunks([*issues[:2], issue("ABC-24", "repo:web", parent="ABC-20"), issues[3]], {}, ("Release Ready",))[0], [Chunk("ABC-24", "web")])
|
||||
|
||||
|
||||
class RoomInARepo(unittest.TestCase):
|
||||
def test_a_repo_with_room_and_no_loop_claude_takes_a_chunk(self) -> None:
|
||||
|
||||
@@ -23,13 +23,21 @@ class TheStatusLines(unittest.TestCase):
|
||||
parked.park(self.folder, parked.Parked(key, f"/code/api-{key}", "7", "s", on))
|
||||
os.utime(parked.file_of(self.folder, key), (SINCE, SINCE))
|
||||
|
||||
def lines(self, issues: list, *windows: tuple[str, str, bool, str]) -> list[str] | Failure:
|
||||
return status.lines("ABC-12", self.home, issues, {}, Tmux(*windows))
|
||||
def lines(self, issues: list, *windows: tuple[str, str, bool, str], unblocking: tuple[str, ...] = ()) -> list[str] | Failure:
|
||||
return status.lines("ABC-12", self.home, issues, {}, unblocking, Tmux(*windows))
|
||||
|
||||
def test_a_chunk_that_asks_says_where_to_answer_and_one_that_works_runs(self) -> None:
|
||||
found = self.lines([issue("ABC-20", "repo:api"), issue("ABC-21", "repo:api")], (EPIC, "ABC-20 ?", False, ""), (EPIC, "ABC-21", False, ""))
|
||||
self.assertEqual(found, ["ABC-20 asks you: answer its question in the tmux window epic-ABC-12:ABC-20", "ABC-21 runs"])
|
||||
|
||||
def test_names_the_status_a_blocker_must_reach_and_the_one_a_merged_issue_is_in(self) -> None:
|
||||
found = self.lines([issue("ABC-20", "repo:api", status="Release Ready"), issue("ABC-21", "repo:api", status="Code Review"), issue("ABC-22", "repo:api", blockers=("ABC-21",))], (EPIC, "ABC-21", False, ""), unblocking=("Release Ready",))
|
||||
self.assertEqual(found, [
|
||||
"ABC-20 waits: its work has landed: it is Release Ready, and the epic's finishing waits until Jira counts it done",
|
||||
"ABC-21 runs",
|
||||
"ABC-22 waits: ABC-21 blocks it, until it is Release Ready or done",
|
||||
])
|
||||
|
||||
def test_a_parked_chunk_says_what_it_awaits_and_since_when(self) -> None:
|
||||
self.park("ABC-20", "an approval")
|
||||
self.assertEqual(self.lines([issue("ABC-20", "repo:api")], (EPIC, "ABC-20 awaits its checks", False, "")), [f"ABC-20 waits: it is parked: its pull request #7 awaits its checks, since {SINCE_ON}"])
|
||||
|
||||
@@ -24,12 +24,15 @@ def url_beside(origin_url: str, name: str) -> str | None:
|
||||
return place.group(1) + name if place and not place.group(1).endswith("//") else None
|
||||
|
||||
|
||||
def runner(cwd: str) -> Run:
|
||||
def runner(cwd: str, timeout: float | None = None) -> Run:
|
||||
"""Runs a command in cwd, stopped after timeout seconds where one is given."""
|
||||
def run(command: list[str]) -> str | Failure:
|
||||
try:
|
||||
done = subprocess.run(command, capture_output=True, cwd=cwd, encoding="utf-8", errors="replace", stdin=subprocess.DEVNULL)
|
||||
done = subprocess.run(command, capture_output=True, cwd=cwd, encoding="utf-8", errors="replace", stdin=subprocess.DEVNULL, timeout=timeout)
|
||||
except OSError as failure:
|
||||
return Failure(f"{command[0]} could not start: {failure}")
|
||||
except subprocess.TimeoutExpired:
|
||||
return Failure(f"{' '.join(command[:3])}: stopped after {timeout} s")
|
||||
if done.returncode:
|
||||
return Failure(f"{' '.join(command[:3])}: {(done.stderr or done.stdout).strip()}")
|
||||
return done.stdout
|
||||
|
||||
+60
-1
@@ -1,11 +1,13 @@
|
||||
"""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, listing the ready ones, reading whether one merges into its base, and waiting for the checks on its head commit."""
|
||||
import dataclasses
|
||||
import fnmatch
|
||||
import json
|
||||
import re
|
||||
import typing
|
||||
|
||||
from failure import Failure
|
||||
from forge.commands import Forge, gitea, Run
|
||||
from forge.reviews import GITEA_DRAFT
|
||||
|
||||
# How long checks_passed waits between two reads: of the head commit's status on Gitea, or of gh's watch while it reports no checks.
|
||||
POLL_SECONDS = 10
|
||||
@@ -44,6 +46,63 @@ 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]}")
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ReadyPull:
|
||||
"""An open pull request from one of origin's own branches that is no draft."""
|
||||
number: str
|
||||
url: str
|
||||
# The commit ID of its head.
|
||||
head: str
|
||||
|
||||
|
||||
def ready_pulls(forge: Forge, run: Run) -> list[ReadyPull] | Failure:
|
||||
"""Each open pull request from origin's own branches that is no draft, which Gitea tells by its title (GITEA_DRAFT); Gitea names no head repo for a fork that was deleted. A row is left out where its head is no commit ID, since the caller passes the head to git, or where its number is not all digits, since the caller prints it."""
|
||||
if forge == "gh":
|
||||
# A limit: an awaited pull request past the first 100 open ones, drafts and forks counted, is not seen. `--draft=false` would make gh search, and GitHub's search index lags a pull request just marked ready.
|
||||
listed = run(["gh", "pr", "list", "--limit", "100", "--json", "number,url,headRefOid,isDraft,isCrossRepository", "--template", "{{range .}}{{.number}}\t{{.url}}\t{{.headRefOid}}\t{{.isDraft}}\t{{.isCrossRepository}}\n{{end}}"])
|
||||
if isinstance(listed, Failure):
|
||||
return listed
|
||||
rows = [line.split("\t") for line in listed.splitlines()]
|
||||
found = [ReadyPull(*row[:3]) for row in rows if row[3:] == ["false", "false"]]
|
||||
else:
|
||||
pulls = gitea(run, "repos/{owner}/{repo}/pulls?state=open&limit=50")
|
||||
if isinstance(pulls, Failure):
|
||||
return pulls
|
||||
try:
|
||||
found = [ReadyPull(str(pull["number"]), pull["html_url"], pull["head"]["sha"]) for pull in pulls if (pull["head"]["repo"] or {}).get("full_name") == pull["base"]["repo"]["full_name"] and not pull["title"].upper().startswith(GITEA_DRAFT)]
|
||||
except (AttributeError, KeyError, TypeError):
|
||||
return Failure(f"tea api listed pull requests in a shape that can't be read: {str(pulls)[:200]}")
|
||||
return [pull for pull in found if pull.number.isascii() and pull.number.isdigit() and isinstance(pull.head, str) and re.fullmatch(r"[0-9a-f]{40,64}", pull.head)]
|
||||
|
||||
|
||||
# Why a pull request doesn't merge into its base as it stands, as the words after "pull request #<N>".
|
||||
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. 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"])
|
||||
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.
|
||||
|
||||
|
||||
+79
-2
@@ -1,14 +1,17 @@
|
||||
import itertools
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
import typing
|
||||
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, ready_pulls, ReadyPull, required_checks, unmergeable, WAIT_SECONDS
|
||||
from failure import Failure
|
||||
from forge.commands import forge_of, gitea, url_beside
|
||||
from forge.commands import forge_of, gitea, runner, url_beside
|
||||
|
||||
|
||||
class ForgeOf(unittest.TestCase):
|
||||
@@ -47,6 +50,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)
|
||||
@@ -135,6 +174,44 @@ class ChecksPassed(unittest.TestCase):
|
||||
self.assertEqual(checks_passed("tea", "1", "abc", set(), tea([LONG]), self.fail).reason, f"tea api printed no commit status for abc: {LONG[:200]}")
|
||||
|
||||
|
||||
SHA = "a" * 40
|
||||
GITEA_PULL = {"number": 7, "html_url": "https://gitea.example/o/r/pulls/7", "title": "Do 7", "head": {"sha": SHA, "repo": {"full_name": "o/r"}}, "base": {"repo": {"full_name": "o/r"}}}
|
||||
|
||||
|
||||
class ReadyPulls(unittest.TestCase):
|
||||
def test_lists_on_gh_each_open_pull_request_from_origins_own_branches_that_is_no_draft(self):
|
||||
commands: list[list[str]] = []
|
||||
listed = f"7\thttps://github.com/o/r/pull/7\t{SHA}\tfalse\tfalse\n8\thttps://github.com/o/r/pull/8\t{SHA}\ttrue\tfalse\n9\thttps://github.com/o/r/pull/9\t{SHA}\tfalse\ttrue\n"
|
||||
self.assertEqual(ready_pulls("gh", lambda command: commands.append(command) or listed), [ReadyPull("7", "https://github.com/o/r/pull/7", SHA)])
|
||||
self.assertEqual(commands, [["gh", "pr", "list", "--limit", "100", "--json", "number,url,headRefOid,isDraft,isCrossRepository", "--template", "{{range .}}{{.number}}\t{{.url}}\t{{.headRefOid}}\t{{.isDraft}}\t{{.isCrossRepository}}\n{{end}}"]])
|
||||
|
||||
def test_leaves_out_on_gh_a_row_whose_head_is_no_commit_id(self):
|
||||
self.assertEqual(ready_pulls("gh", lambda command: "7\thttps://github.com/o/r/pull/7\t--upload-pack=x\tfalse\tfalse\n"), [])
|
||||
|
||||
def test_lists_on_tea_each_open_pull_request_from_origins_own_branches_whose_title_marks_no_draft(self):
|
||||
fork = {**GITEA_PULL, "number": 8, "head": {"sha": SHA, "repo": {"full_name": "other/r"}}}
|
||||
draft = {**GITEA_PULL, "number": 9, "title": "wip: Do 9"}
|
||||
deleted_fork = {**GITEA_PULL, "number": 10, "head": {"sha": SHA, "repo": None}}
|
||||
commands: list[list[str]] = []
|
||||
self.assertEqual(ready_pulls("tea", lambda command: commands.append(command) or json.dumps([GITEA_PULL, fork, draft, deleted_fork])), [ReadyPull("7", "https://gitea.example/o/r/pulls/7", SHA)])
|
||||
self.assertEqual(commands, [["tea", "api", "repos/{owner}/{repo}/pulls?state=open&limit=50"]])
|
||||
|
||||
def test_fails_where_the_forge_cannot_list_them(self):
|
||||
self.assertEqual(ready_pulls("gh", lambda command: Failure("gh: no network")).reason, "gh: no network")
|
||||
self.assertEqual(ready_pulls("tea", lambda command: LONG).reason, f"tea api listed pull requests in a shape that can't be read: {LONG[:200]}")
|
||||
|
||||
|
||||
class Runner(unittest.TestCase):
|
||||
def test_prints_what_a_command_printed_and_fails_where_it_exits_nonzero_cannot_start_or_outlasts_its_timeout(self):
|
||||
self.assertEqual(runner("/")(["echo", "hello"]), "hello\n")
|
||||
self.assertEqual(runner("/")(["sh", "-c", "echo no >&2; exit 3"]), Failure("sh -c echo no >&2; exit 3: no"))
|
||||
failed = runner("/")(["no-such-forge-cli", "pr", "list"])
|
||||
self.assertIsInstance(failed, Failure)
|
||||
self.assertTrue(failed.reason.startswith("no-such-forge-cli could not start: "), failed.reason)
|
||||
self.assertEqual(runner("/", 0.05)(["sh", "-c", "sleep 5", "later"]), Failure("sh -c sleep 5: stopped after 0.05 s"))
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
self.assertEqual(runner(folder)(["pwd", "-P"]), os.path.realpath(folder) + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -9,7 +9,7 @@ from agent_cycle.worker_prompts import typed_answer
|
||||
|
||||
|
||||
def grounds_of(prompt: str, entries: list[Entry]) -> Grounds | Failure:
|
||||
"""What the quotes of a judge run on prompt are checked against, as judge_prompt would have made it for the transcript's entries: the premises and the records before the task are quotable, the transcript the judge was shown comes before the rules. The prompt is split on the headings judge_prompt writes, at the first of each; a Failure where it lacks one. Rules of an earlier wording stay part of the transcript, a slack that lets an evidence quote them pass."""
|
||||
"""What the quotes of a judge run on prompt are checked against, as judge_prompt would have made it for the transcript's entries: the premises and the records before the task are quotable, the task is quotable as the evidence, and the transcript the judge was shown comes before the rules. The prompt is split on the headings judge_prompt writes, at the first of each; a Failure where it lacks one. Rules of an earlier wording stay part of the transcript, a slack that lets an evidence quote them pass."""
|
||||
before_task, task_heading, after_task = prompt.partition(f"\n\n{TASK_HEADING}")
|
||||
heading = transcript_heading(LOOP_CLAUDE)
|
||||
task, found_heading, shown = after_task.partition(heading)
|
||||
|
||||
@@ -145,7 +145,7 @@ class Main(unittest.TestCase):
|
||||
result = reply(Rung(args[args.index("--model") + 1], args[args.index("--effort") + 1]), "said Verdict: interrupt" in prompt.rsplit("latest last:", 1)[-1])
|
||||
return subprocess.CompletedProcess(args, 0, json.dumps(result), "")
|
||||
|
||||
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, git=unused, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, replace_file=unused, sleep=unused, stream_claude=unused, timer=unused, tmux=unused, tmux_on_terminal=unused)
|
||||
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, forge=unused, git=unused, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, replace_file=unused, sleep=unused, stream_claude=unused, timer=unused, tmux=unused, tmux_on_terminal=unused)
|
||||
out, err = io.StringIO(), io.StringIO()
|
||||
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
|
||||
code = main.main(argv, {}, self.home, effects)
|
||||
@@ -387,7 +387,7 @@ class JudgeArchivedRuns(unittest.TestCase):
|
||||
cwds.append(cwd)
|
||||
return subprocess.CompletedProcess(args, 0, json.dumps({"type": "result", "structured_output": output, "total_cost_usd": 0.25}), "")
|
||||
|
||||
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, git=unused, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, replace_file=unused, sleep=unused, stream_claude=unused, timer=unused, tmux=unused, tmux_on_terminal=unused)
|
||||
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, forge=unused, git=unused, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, replace_file=unused, sleep=unused, stream_claude=unused, timer=unused, tmux=unused, tmux_on_terminal=unused)
|
||||
grounds = grounds_of(prompt, self.ENTRIES)
|
||||
return (grounds if isinstance(grounds, Failure) else judge_archived("/code/p", prompt, grounds, len(self.ENTRIES), REFERENCE, LOOP_CLAUDE, effects)), cwds
|
||||
|
||||
@@ -403,6 +403,14 @@ class JudgeArchivedRuns(unittest.TestCase):
|
||||
self.assertIsInstance(self.judged(evidence="Do it.")[0], Unfinished)
|
||||
self.assertIsInstance(self.judged(evidence="Do it. ... Use Postgres.")[0], Unfinished)
|
||||
|
||||
def test_splits_the_prompt_into_the_premises_the_task_and_the_transcript_at_the_first_heading_of_each(self):
|
||||
heading = transcript_heading(LOOP_CLAUDE)
|
||||
again = self.PROMPT.replace("Worker chose option B.", f"Worker chose option B. {heading}Again.", 1)
|
||||
for prompt in (self.PROMPT, again):
|
||||
grounds = grounds_of(prompt, self.ENTRIES)
|
||||
self.assertEqual((grounds.quotable, grounds.task), ("HEAD: Ship fast.", "Do it."))
|
||||
self.assertEqual(grounds_of(self.PROMPT, self.ENTRIES).shown, "Worker chose option B.\n[human] Use Postgres.")
|
||||
|
||||
def test_keeps_the_cost_and_the_run_of_a_rejected_reply(self):
|
||||
rejected, _ = self.judged(evidence="Never said.")
|
||||
self.assertEqual((rejected.cost, rejected.run.prompt), (0.25, self.PROMPT))
|
||||
|
||||
@@ -91,8 +91,9 @@ prepare-scoring sets up a scoring run in the chunk's review folder: a detached w
|
||||
checkout's HEAD, which the seats read, and one prompt file per seat beside it, as
|
||||
skills/comprehension-panel/seat-prompts.md builds them. It prints the worktree's path and each
|
||||
prompt's. It takes {{language}}, {{kind}}, {{domain}}, {{domain docs}} and {{3am question}} from the
|
||||
checkout's AGENTS.md → "Scoring run". claude-config keeps no AGENTS.md, so there it takes them from
|
||||
seat-prompts.md → "claude-config's values". It fills the other placeholders from the worktree and
|
||||
project's working-rules file → "Scoring run", which is the checkout's AGENTS.md unless the config
|
||||
names another. Where that file holds no such section, as in claude-config, it takes them from the
|
||||
checkout's seat-prompts.md → "claude-config's values". It fills the other placeholders from the worktree and
|
||||
the panel's SKILL.md. Where any one of the five values is missing, it exits 1 and doesn't write
|
||||
anything. Where a setup that record-scoring never removed is still there, it removes it first and
|
||||
says so.
|
||||
|
||||
@@ -61,9 +61,12 @@ def score_bullets(skill: str) -> tuple[list[str], list[str]] | Failure:
|
||||
return anchors, [line.replace("**", "") for _, line in dimensions]
|
||||
|
||||
|
||||
VALUES_HEADING = r"(\d+\.\s+)?Scoring run|.+'s values"
|
||||
|
||||
|
||||
def project_values(text: str, source: str) -> dict[str, str] | Failure:
|
||||
"""Each value seat-prompts.md fills from the project, from the section of text, read from source, headed `Scoring run` or `<name>'s values`."""
|
||||
lines = section(text, r"(\d+\.\s+)?Scoring run|.+'s values")
|
||||
lines = section(text, VALUES_HEADING)
|
||||
if lines is None:
|
||||
return Failure(f"{source} has no \"Scoring run\" section to fill the seats' prompts from; add one with {listed([f'{{{name}}}' for name in VALUE_NAMES], 'and')}")
|
||||
values = {}
|
||||
@@ -137,13 +140,15 @@ def prepare_scoring(worktree: str, home: pathlib.Path, run: Git = git) -> str |
|
||||
config = located(worktree, home, run)
|
||||
if isinstance(config, Failure):
|
||||
return config
|
||||
# Where AGENTS.md is missing, this repo keeps the values in seat-prompts.md: .claude/rules/this-repo-keeps-no-agents-md.md.
|
||||
source = config.paths["working-rules"]
|
||||
if not source.is_file() and (own := pathlib.Path(worktree) / "skills" / "comprehension-panel" / "seat-prompts.md").is_file():
|
||||
source = own
|
||||
rules = read(source) if source.is_file() else ""
|
||||
if isinstance(rules, Failure):
|
||||
return rules
|
||||
# This repo keeps the values in seat-prompts.md, so its working rules hold none: .claude/rules/this-repo-keeps-no-agents-md.md.
|
||||
if section(rules, VALUES_HEADING) is None and (own := pathlib.Path(worktree) / "skills" / "comprehension-panel" / "seat-prompts.md").is_file():
|
||||
source, rules = own, read(own)
|
||||
if isinstance(rules, Failure):
|
||||
return rules
|
||||
skill = read(PANEL / "SKILL.md")
|
||||
if isinstance(skill, Failure):
|
||||
return skill
|
||||
|
||||
@@ -165,6 +165,28 @@ class PrepareScoring(unittest.TestCase):
|
||||
assert isinstance(ran, str), ran
|
||||
self.assertIn("every non-test tracked file: `bin/**` and `README.md`. Do NOT open any record of a past panel, nor any review output.", pathlib.Path(ran.splitlines()[2]).read_text())
|
||||
|
||||
def test_takes_the_values_from_the_checkouts_seat_prompts_where_the_working_rules_hold_none(self):
|
||||
own = self.checkout / "skills" / "comprehension-panel" / "seat-prompts.md"
|
||||
own.parent.mkdir(parents=True)
|
||||
own.write_text("# Seats\n\n## proj's values\n\n- Language: Go\n- Kind: a CLI\n- Domain: parsing\n- Domain docs: the spec\n- 3am question: the parse hangs\n")
|
||||
for rules in ("# Working rules, with no values\n", None):
|
||||
with self.subTest(rules=rules):
|
||||
(self.checkout / "AGENTS.md").unlink(missing_ok=True)
|
||||
self.commit(rules)
|
||||
ran = self.prepare()
|
||||
assert isinstance(ran, str), ran
|
||||
self.assertIn("Your background: ~2 years in Go, first codebase of this kind (a CLI)", pathlib.Path(ran.splitlines()[2]).read_text())
|
||||
self.assertIsNone(removed_setup(str(self.checkout), self.root, functools.partial(git, env=self.env)))
|
||||
|
||||
def test_keeps_the_working_rules_values_where_the_checkout_has_seat_prompts_too(self):
|
||||
own = self.checkout / "skills" / "comprehension-panel" / "seat-prompts.md"
|
||||
own.parent.mkdir(parents=True)
|
||||
own.write_text("## proj's values\n\n- Language: Go\n- Kind: a CLI\n- Domain: parsing\n- Domain docs: the spec\n- 3am question: the parse hangs\n")
|
||||
self.commit("## Scoring run\n\n- Language: Python\n- Kind: a CLI\n- Domain: parsing\n- Domain docs: the spec\n- 3am question: the parse hangs\n")
|
||||
ran = self.prepare()
|
||||
assert isinstance(ran, str), ran
|
||||
self.assertIn("Your background: ~2 years in Python,", pathlib.Path(ran.splitlines()[2]).read_text())
|
||||
|
||||
def test_refuses_writing_nothing_where_the_project_gives_no_values(self):
|
||||
self.commit()
|
||||
ran = self.run_tool("prepare-scoring")
|
||||
@@ -181,6 +203,14 @@ class PrepareScoring(unittest.TestCase):
|
||||
assert isinstance(unread, Failure), unread
|
||||
self.assertTrue(unread.reason.startswith(f"cannot read {self.checkout}/AGENTS.md: "), unread.reason)
|
||||
self.assertEqual(len(self.git("worktree", "list").splitlines()), 1)
|
||||
own = self.checkout / "skills" / "comprehension-panel" / "seat-prompts.md"
|
||||
own.parent.mkdir(parents=True)
|
||||
own.write_bytes(b"\xff")
|
||||
(self.checkout / "AGENTS.md").write_text("# Working rules, with no values\n")
|
||||
unread = self.prepare()
|
||||
assert isinstance(unread, Failure), unread
|
||||
self.assertTrue(unread.reason.startswith(f"cannot read {own}: "), unread.reason)
|
||||
self.assertEqual(len(self.git("worktree", "list").splitlines()), 1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -49,7 +49,7 @@ def fetched_plan(loop: Loop, announce: bool = True) -> DefaultPlan | Failure:
|
||||
if announce and config.tracked("plan") is None:
|
||||
say(UNSEEN_RELEASES, loop.effects)
|
||||
ref = default_ref(loop.root, ORIGIN_TIMEOUT, run=loop.effects.git)
|
||||
return ref if isinstance(ref, Failure) else project_plan(config, ref, loop.root, loop.effects.git)
|
||||
return ref if isinstance(ref, Failure) else project_plan(config, ref, loop.root, loop.effects.git, loop.effects.forge(loop.root))
|
||||
|
||||
|
||||
def plan_item(plan: DefaultPlan | Failure, window_item: int | None, effects: Effects) -> Item | None:
|
||||
|
||||
@@ -76,6 +76,12 @@ def room_of(windows: list[tmux.Listed], own: str | None, leaving: bool, limit: i
|
||||
return Room(running, stopped, restart, room - len(restart))
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class AwaitedMerges:
|
||||
"""Why no chunk starts and none runs: every item left awaits a person's merge of the pull requests that why names."""
|
||||
why: str
|
||||
|
||||
|
||||
def may_start(plan: NextChunk | NoItem, running: list[str], held: set[int], room: int) -> list[str]:
|
||||
"""The chunks to start now beside the running ones, whose chunks hold the items in held: the plan's next item and the items touch_predictions picks to run beside it, in the plan's order, up to room of them. Each leaves out an item in held, and one whose `Touches:` prediction overlaps a held item's, or where either has none. A plan without an item starts NO_ITEM, and only alone."""
|
||||
if isinstance(plan, NoItem):
|
||||
@@ -104,12 +110,12 @@ def next_plan(root: str, home: pathlib.Path, effects: Effects) -> NextChunk | No
|
||||
ref = default_ref(root, FETCH_TIMEOUT, run=effects.git)
|
||||
if isinstance(ref, Failure):
|
||||
return ref
|
||||
held = project_plan(config, ref, root, effects.git)
|
||||
held = project_plan(config, ref, root, effects.git, effects.forge(root))
|
||||
return planned(held.plan, held.cut, ref, config.branch, None if config.tracked("plan") else config.plan_label)
|
||||
|
||||
|
||||
def start_chunks(loop_run: LoopRun, leaving: bool, paths: Paths, env: typing.Mapping[str, str], launcher: pathlib.Path, effects: Effects) -> list[str] | Failure:
|
||||
"""Starts a loop-claude in a new window for each chunk of loop_run's project that may start now, and returns the chunks started. leaving says that loop_run's own chunk finished, so its window no longer counts as running; without it, the human started loop-claude. A Failure says why no chunk may start, or why one could not; those before it run."""
|
||||
def start_chunks(loop_run: LoopRun, leaving: bool, paths: Paths, env: typing.Mapping[str, str], launcher: pathlib.Path, effects: Effects) -> list[str] | AwaitedMerges | Failure:
|
||||
"""Starts a loop-claude in a new window for each chunk of loop_run's project that may start now, and returns the chunks started. leaving says that loop_run's own chunk finished, so its window no longer counts as running; without it, the human started loop-claude. AwaitedMerges where chunks_to_start returns it. A Failure says why no chunk may start, or why one could not; those before it run."""
|
||||
config = located(loop_run.root, paths.home)
|
||||
if isinstance(config, Failure):
|
||||
return config
|
||||
@@ -122,6 +128,8 @@ def start_chunks(loop_run: LoopRun, leaving: bool, paths: Paths, env: typing.Map
|
||||
if refused := refusal(session, windows, loop_run.root, effects.tmux):
|
||||
return refused
|
||||
chunks = chunks_to_start(windows, loop_run, leaving, config.parallel_chunks, paths, effects)
|
||||
if isinstance(chunks, AwaitedMerges):
|
||||
return chunks
|
||||
for chunk in chunks:
|
||||
started = tmux.start_chunk(tmux.Window(session, chunk, ""), loop_run.root, handed, [str(launcher), CHUNK_FLAG, chunk, loop_run.task], windows, True, effects.tmux)
|
||||
if isinstance(started, Failure):
|
||||
@@ -139,8 +147,8 @@ def refusal(session: str, windows: list[tmux.Listed], root: str, run: tmux.Tmux)
|
||||
return None
|
||||
|
||||
|
||||
def chunks_to_start(windows: list[tmux.Listed], loop_run: LoopRun, leaving: bool, limit: int, paths: Paths, effects: Effects) -> list[str]:
|
||||
"""The chunks to start beside windows, the session's: the stopped ones room_of restarts, then those of the plan that may_start picks. A plan that cannot be read starts NO_ITEM, as a plan without an item does."""
|
||||
def chunks_to_start(windows: list[tmux.Listed], loop_run: LoopRun, leaving: bool, limit: int, paths: Paths, effects: Effects) -> list[str] | AwaitedMerges:
|
||||
"""The chunks to start beside windows, the session's: the stopped ones room_of restarts, then those of the plan that may_start picks. A plan that cannot be read starts NO_ITEM, as a plan without an item does. AwaitedMerges where no chunk runs or restarts and every item left awaits a person's merge."""
|
||||
room = room_of(windows, loop_run.chunk, leaving, limit)
|
||||
if not room.left:
|
||||
return room.restart
|
||||
@@ -150,7 +158,10 @@ def chunks_to_start(windows: list[tmux.Listed], loop_run: LoopRun, leaving: bool
|
||||
say(f"starting a chunk without a plan item, since the plan cannot be read: {plan.reason}", effects)
|
||||
plan = NoItem(plan.reason)
|
||||
held = held_items(room.running + room.stopped, project_key(loop_run.root, paths.home), paths.claude_code_transcripts)
|
||||
return room.restart + [chunk for chunk in may_start(plan, room.running + room.restart, held, room.left) if chunk not in room.stopped]
|
||||
if isinstance(plan, NoItem) and plan.awaits_merge and not room.running + room.restart:
|
||||
return AwaitedMerges(plan.why)
|
||||
picked = may_start(plan, room.running + room.restart, held, room.left)
|
||||
return room.restart + [chunk for chunk in picked if chunk not in room.stopped]
|
||||
|
||||
|
||||
def held_beside(chunk: str, root: str, paths: Paths, effects: Effects) -> list[int]:
|
||||
|
||||
@@ -4,11 +4,11 @@ import typing
|
||||
|
||||
from chunk_driver.cycle_start import announced_route, cycle_of, project_routing
|
||||
from transcript_archive.location import archive_root, project_archive
|
||||
from loop_claude.loop.chunk_windows import AwaitedMerges, chunk_session, item_of, start_chunks
|
||||
from loop_claude.loop.routing_check import check_routing
|
||||
from loop_claude.loop.checkout import checkout_root
|
||||
from chunk_driver.claims import CHUNK_FLAG, loop_session
|
||||
from loop_claude.chunk import chunk_items, fresh_prompt
|
||||
from loop_claude.loop.chunk_windows import chunk_session, item_of, start_chunks
|
||||
from loop_claude.loop.chunk_start import chunk_start, plan_item, scored_plan
|
||||
from chunk_driver.chunk_run import closed_cycle
|
||||
from agent_cycle.run import Concluded, Cycle, run_cycle
|
||||
@@ -30,7 +30,7 @@ from agent_cycle import tmux
|
||||
|
||||
|
||||
# Starts the chunks that may start now, as chunk_windows.start_chunks does.
|
||||
StartChunks = typing.Callable[[LoopRun, bool, Paths, typing.Mapping[str, str], pathlib.Path, Effects], list[str] | Failure]
|
||||
StartChunks = typing.Callable[[LoopRun, bool, Paths, typing.Mapping[str, str], pathlib.Path, Effects], list[str] | AwaitedMerges | Failure]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -107,6 +107,8 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
|
||||
def windows_opened(loop_run: LoopRun, env: typing.Mapping[str, str], paths: Paths, launcher: pathlib.Path, effects: Effects, start: StartChunks) -> Stop:
|
||||
"""What the loop-claude the human runs does: starts, through start, each chunk that may start now in a window of the project's tmux session, then puts that session on the terminal until the human detaches."""
|
||||
started = start(loop_run, False, paths, env, launcher, effects)
|
||||
if isinstance(started, AwaitedMerges):
|
||||
return Stop(0, started.why)
|
||||
if isinstance(started, Failure):
|
||||
return Stop(1, started.reason)
|
||||
session = loop_session(loop_run.root, paths.home)
|
||||
@@ -121,6 +123,8 @@ def windows_opened(loop_run: LoopRun, env: typing.Mapping[str, str], paths: Path
|
||||
def handed_on(loop_run: LoopRun, loop: Loop, start: StartChunks) -> Stop:
|
||||
"""The stop of a loop whose chunk finished, once it has started, through start, each chunk that may start now. Its window closes as it exits."""
|
||||
started = start(loop_run, True, loop.paths, loop.env, loop.launcher, loop.effects)
|
||||
if isinstance(started, AwaitedMerges):
|
||||
return Stop(0, f"the chunk finished; {started.why}")
|
||||
if isinstance(started, Failure):
|
||||
return Stop(1, f"the chunk finished, but the next could not start: {started.reason}")
|
||||
say(f"the chunk finished; started {', '.join(started) or 'no other, since the chunks running fill what may run now'}", loop.effects, stdout=True)
|
||||
|
||||
@@ -9,7 +9,7 @@ import unittest
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
|
||||
from chunk_driver.doubles import a_loop
|
||||
from loop_claude.loop import chunk_start
|
||||
from loop_claude.loop import chunk_start, chunk_windows, reload
|
||||
from project_config.doubles import configured
|
||||
from release_plan.release_standing import DefaultPlan, LastCut, UNSEEN_RELEASES
|
||||
from failure import Failure
|
||||
@@ -79,6 +79,29 @@ class RouteSources(unittest.TestCase):
|
||||
held = chunk_start.fetched_plan(a_loop(effects, root=root, paths=paths.paths_from(folder.parents[1])))
|
||||
self.assertEqual(held.cut.changelog, "what origin/main:CHANGELOG.md holds\n")
|
||||
|
||||
def test_passes_over_an_item_whose_pull_request_awaits_a_persons_merge_as_the_loops_forge_lists_them(self):
|
||||
head = "a" * 40
|
||||
finished = TODO.replace("| 3 | 0.2.0 | | **Do the next thing.** | 4 | 2 | 3 | 7 | 3 | 1 by 9 | 25 |\n", "")
|
||||
|
||||
def git(*args, **options):
|
||||
if args[:2] == ("remote", "get-url"):
|
||||
return "https://github.com/o/r\n"
|
||||
answers = {"remote": "origin\n", "symbolic-ref": "origin/main\n", "merge-base": "base\n", "show": finished if args[-1] == f"{head}:todo.md" else TODO}
|
||||
return answers.get(args[0], "1\n")
|
||||
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = configured(self, pathlib.Path(root))
|
||||
(folder / "config.toml").write_text((folder / "config.toml").read_text() + 'merge = "human"\n')
|
||||
fake = FakeEffects(forge=[f"12\thttps://github.com/o/r/pull/12\t{head}\tfalse\tfalse\n"] * 3)
|
||||
held = chunk_start.fetched_plan(a_loop(dataclasses.replace(fake.effects(), git=git), root=root, paths=paths.paths_from(folder.parents[1])))
|
||||
self.assertEqual([(item.id, item.awaits_merge) for item in held.plan.items], [(7, ""), (3, "#12 https://github.com/o/r/pull/12"), (1, "")])
|
||||
self.assertEqual(fake.made("forge")[0][:4], [root, "gh", "pr", "list"])
|
||||
self.assertIsNone(chunk_start.plan_item(held, None, fake.effects()), "items 7 and 3 wait, so no item of the next release routes the chunk")
|
||||
window = chunk_windows.next_plan(root, folder.parents[1], dataclasses.replace(fake.effects(), git=git))
|
||||
self.assertEqual((window.awaits_merge, fake.made("forge")[1][:4]), (True, [root, "gh", "pr", "list"]), "a window starts by the same pick")
|
||||
stopped = chunk_windows.chunks_to_start([], reload.LoopRun(1, root, "do it", ""), False, 1, paths.paths_from(folder.parents[1]), dataclasses.replace(fake.effects(), git=git))
|
||||
self.assertEqual(stopped, chunk_windows.AwaitedMerges(window.why), "so the loop starts no chunk, and says which pull requests it waits on")
|
||||
|
||||
def test_reads_a_plan_outside_the_checkout_as_it_stands_and_stops_without_a_config(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
folder = configured(self, pathlib.Path(root))
|
||||
|
||||
@@ -11,10 +11,10 @@ import unittest.mock
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
|
||||
from chunk_driver.doubles import a_loop
|
||||
from loop_claude.loop import chunk_windows, main, reload, usage
|
||||
from loop_effects.doubles import CWD, FakeEffects, ran, STAMP
|
||||
from failure import Failure
|
||||
from agent_cycle.verdicts import Finished, Unfinished
|
||||
from loop_claude.loop import main, reload, usage
|
||||
from loop_claude.doubles import OPUS_PROJECT
|
||||
from loop_state import paths
|
||||
from model_routing.route import Route
|
||||
@@ -240,6 +240,7 @@ class WindowStarts(unittest.TestCase):
|
||||
|
||||
def test_stops_where_no_chunk_could_start(self):
|
||||
self.assertEqual(self.run_loop(["do it"], FakeEffects(git=["/r\n"]), started=Failure("no plan"))[0], Stop(1, "no plan"))
|
||||
self.assertEqual(self.run_loop(["do it"], FakeEffects(git=["/r\n"]), started=chunk_windows.AwaitedMerges("#7 awaits a merge."))[0], Stop(0, "#7 awaits a merge."), "nothing failed, so the stop exits 0")
|
||||
|
||||
def test_stops_where_tmux_cannot_show_the_session(self):
|
||||
fake = FakeEffects(git=["/r\n"])
|
||||
@@ -260,7 +261,8 @@ class WindowStarts(unittest.TestCase):
|
||||
def test_a_finished_chunk_starts_each_chunk_that_may_start_and_stops_without_a_reason(self):
|
||||
loop_run = main.LoopRun(4, "/r", "do it", "", chunk="item-7")
|
||||
for started, said, stop in ((["item-9", "item-12"], "the chunk finished; started item-9, item-12", Stop(0, "")), ([], "the chunk finished; started no other, since the chunks running fill what may run now", Stop(0, "")),
|
||||
(Failure("no plan"), "", Stop(1, "the chunk finished, but the next could not start: no plan"))):
|
||||
(Failure("no plan"), "", Stop(1, "the chunk finished, but the next could not start: no plan")),
|
||||
(chunk_windows.AwaitedMerges("#7 awaits a merge."), "", Stop(0, "the chunk finished; #7 awaits a merge."))):
|
||||
with self.subTest(started=started), contextlib.redirect_stdout(io.StringIO()) as printed:
|
||||
loop, asked = a_loop(FakeEffects().effects(), env={"LOOP_CLAUDE_X": "1"}), []
|
||||
self.assertEqual(main.handed_on(loop_run, loop, lambda *args: asked.append(args) or started), stop)
|
||||
|
||||
@@ -99,8 +99,9 @@ class JudgeFailures(unittest.TestCase):
|
||||
("verdict_from", "'the judge interrupted without a question'", unasked),
|
||||
("verdict_from", "'the judge quoted an answer without a question'", unasked),
|
||||
("run_judge", "verdict.reason", field),
|
||||
("run_judge", "checked.reason", "quotes a passage the transcript does not hold"),
|
||||
("misquoted_evidence", "f'the judge quoted {verdict.evidence!r}, which is not in the transcript", "quotes a passage the transcript does not hold"),
|
||||
("run_judge", "checked.reason", "quotes a passage that neither the task nor the transcript holds"),
|
||||
("misquoted_evidence", "f'the judge quoted {verdict.evidence!r}, which is not in the task or the transcript", "quotes a passage that neither the task nor the transcript holds"),
|
||||
("judge_prompt", "f\"the premises, the records, the task and the judge's rules leave", f"leave room for less than the last {judge.TRANSCRIPT_FLOOR:,} characters of the transcript, or all of a shorter one"),
|
||||
("claude_reply", "f'could not start claude:", started),
|
||||
("claude_reply", "proc.stderr.strip() or f'{who} exited", exited),
|
||||
("claude_reply", 'f"{who} printed no json reply', unparsed),
|
||||
|
||||
@@ -160,6 +160,10 @@ measurement.
|
||||
A change to bin/loop-claude or any bin/**/*.py takes effect at the next cycle boundary, once
|
||||
loop-claude --help succeeds: the loop reloads into the edited script.
|
||||
|
||||
Under merge = "human", where no chunk runs and every item left awaits a person's merge, loop-claude
|
||||
doesn't start a chunk: it names those pull requests, in a DM too, and exits 0. Its window closes,
|
||||
so the next loop-claude <task> reads the plan again.
|
||||
|
||||
Exit 1, saying why, when:
|
||||
- no task is given
|
||||
- git cannot start or finds no checkout
|
||||
@@ -182,9 +186,12 @@ Exit 1, saying why, when:
|
||||
handover
|
||||
- the worker or the judge fails three times running, retried a minute apart within the cycle. A
|
||||
worker fails when claude cannot start, exits non-zero, is killed, or ends without a result event;
|
||||
a judge when claude cannot start, exits non-zero or prints no json reply, or its reply misses or
|
||||
mistypes a field, interrupts or quotes an answer without a question, or quotes a passage the
|
||||
transcript does not hold; it holds an elided passage when each fragment appears in order.
|
||||
a judge when the premises, the records, the task and the judge's rules leave room for less than
|
||||
the last 50,000 characters of the transcript, or all of a shorter one, when claude cannot start,
|
||||
exits non-zero or prints no json reply, or when its reply misses or mistypes a field, interrupts
|
||||
or quotes an answer without a question, or quotes a passage that neither the task nor the
|
||||
transcript holds, where each fragment of an elided quote must appear in order, in the task then
|
||||
the transcript.
|
||||
A usage limit is not a failure, and restarts the count of three: the worker or the judge is
|
||||
retried 2 minutes after the limit resets, or every 10 minutes when the reset time is unknown or
|
||||
more than 2 minutes past. The judge's reply gives its reset time only as text, so the judge is
|
||||
|
||||
@@ -726,8 +726,8 @@ class Cycles(unittest.TestCase):
|
||||
self.assertEqual(run.code, 130)
|
||||
self.assertEqual(run.roles(), ["worker", "judge", "judge", "judge", "worker", "judge"])
|
||||
self.assertEqual(run.sleeps, [60, 60])
|
||||
self.assertIn("the judge quoted 'never said', which is not in the transcript, for the question: A or B?", run.stderr)
|
||||
self.assertIn("retrying the judge in a minute: the judge quoted '', which is not in the transcript\n", run.stderr)
|
||||
self.assertIn("the judge quoted 'never said', which is not in the task or the transcript, for the question: A or B?", run.stderr)
|
||||
self.assertIn("retrying the judge in a minute: the judge quoted '', which is not in the task or the transcript\n", run.stderr)
|
||||
|
||||
def test_retries_a_judge_claude_cannot_start(self):
|
||||
checkout = Checkout(self)
|
||||
|
||||
@@ -29,7 +29,7 @@ def human(content: typing.Any) -> dict[str, typing.Any]:
|
||||
class FakeEffects:
|
||||
"""Effects that record each call and answer from a script, one answer per call."""
|
||||
|
||||
def __init__(self, claude: typing.Iterable[typing.Any] = (), on_terminal_claude: typing.Iterable[typing.Any] = (), git: typing.Iterable[typing.Any] = (), inputs: typing.Iterable[typing.Any] = (), python: typing.Iterable[typing.Any] = (), streams: typing.Iterable[typing.Any] = (), on_terminal: bool = True, free_memory: typing.Iterable[memory.Memory | None] = (), dm_failures: typing.Iterable[Failure | None] = (), tmux_version: str = "tmux 3.2", windows: str | None = None, owner: str = "/r") -> None:
|
||||
def __init__(self, claude: typing.Iterable[typing.Any] = (), on_terminal_claude: typing.Iterable[typing.Any] = (), git: typing.Iterable[typing.Any] = (), forge: typing.Iterable[typing.Any] = (), inputs: typing.Iterable[typing.Any] = (), python: typing.Iterable[typing.Any] = (), streams: typing.Iterable[typing.Any] = (), on_terminal: bool = True, free_memory: typing.Iterable[memory.Memory | None] = (), dm_failures: typing.Iterable[Failure | None] = (), tmux_version: str = "tmux 3.2", windows: str | None = None, owner: str = "/r") -> None:
|
||||
self.calls: list[tuple[str, typing.Any]] = []
|
||||
# Each tmux command run. They stay out of self.calls, as the DMs do. tmux prints `windows` for list-windows, or without them finds no session.
|
||||
self.tmux_calls: list[list[str]] = []
|
||||
@@ -42,7 +42,7 @@ class FakeEffects:
|
||||
# The directory each DM named, in the order of self.dms; None where it named none.
|
||||
self.dm_directories: list[str | None] = []
|
||||
self.dm_failures = list(dm_failures)
|
||||
self.scripts: dict[str, list[typing.Any]] = {"claude": list(claude), "claude_on_terminal": list(on_terminal_claude), "git": list(git), "input": list(inputs), "python": list(python), "stream_claude": list(streams)}
|
||||
self.scripts: dict[str, list[typing.Any]] = {"claude": list(claude), "claude_on_terminal": list(on_terminal_claude), "forge": list(forge), "git": list(git), "input": list(inputs), "python": list(python), "stream_claude": list(streams)}
|
||||
# Without a script, every read finds all memory available.
|
||||
self.free_memory = list(free_memory)
|
||||
self.terminal = on_terminal
|
||||
@@ -62,6 +62,7 @@ class FakeEffects:
|
||||
discard_typed=lambda: self.calls.append(("discard_typed", None)),
|
||||
dm=self.dm,
|
||||
execv=self.execv,
|
||||
forge=lambda cwd: lambda command: self.answer("forge", [cwd, *command]),
|
||||
git=lambda *args, cwd=None, timeout=None, guarded=False, errors="strict": self.answer("git", list(args)),
|
||||
input=lambda prompt: self.answer("input", prompt),
|
||||
local_time=lambda seconds: f"<{seconds}>",
|
||||
|
||||
@@ -21,10 +21,13 @@ from git_cli import git_repo
|
||||
from machine_load.memory import Memory, read_memory
|
||||
from project_config.settings import Notifier
|
||||
from text_files.file_writes import replace_file
|
||||
from forge.commands import Run, runner
|
||||
from machine_load.slots import slot_folder
|
||||
|
||||
# Seconds before a Python script loop-claude runs is stopped, so a hung one, such as chunk-preflight, cannot hold the loop.
|
||||
PYTHON_TIMEOUT = 600
|
||||
# Seconds a command of the forge's CLI may take, so a stalled one cannot hold the loop.
|
||||
FORGE_TIMEOUT = 60
|
||||
|
||||
|
||||
class Streaming(typing.Protocol):
|
||||
@@ -54,6 +57,8 @@ class Effects:
|
||||
# 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]
|
||||
# Runs the CLI of a checkout's forge in that checkout, as forge.commands.runner does.
|
||||
forge: typing.Callable[[str], Run]
|
||||
git: git_repo.Git
|
||||
input: typing.Callable[[str], str]
|
||||
# A date and time in the machine's zone, as `2026-10-28 11:46:01`. lilleman chose this spelling and local time over UTC on 2026-10-28, since the human reads these on their own clock.
|
||||
@@ -109,10 +114,10 @@ class StreamingClaude:
|
||||
return self.proc.wait()
|
||||
|
||||
|
||||
def system_effects(home: pathlib.Path, env: typing.Mapping[str, str], backends: typing.Mapping[Notifier, Backend[typing.Any]] = BACKENDS) -> Effects:
|
||||
def system_effects(home: pathlib.Path, env: typing.Mapping[str, str], backends: typing.Mapping[Notifier, Backend[typing.Any]] = BACKENDS, forge_timeout: float = FORGE_TIMEOUT) -> Effects:
|
||||
"""The effects on this machine: the configs of its DM are under home, and tmux runs in env.
|
||||
|
||||
A test hands in `backends`, the notifiers loop-claude's DM can go through, that send nowhere.
|
||||
A test hands in `backends` that don't send anything, in place of the notifiers loop-claude's DM goes through. It hands in a short `forge_timeout`, so a command that outlasts it ends quickly.
|
||||
"""
|
||||
return Effects(
|
||||
claude=lambda args, cwd, stdin: subprocess.run(["claude", *args], capture_output=True, cwd=cwd, input=stdin, text=True),
|
||||
@@ -120,6 +125,7 @@ def system_effects(home: pathlib.Path, env: typing.Mapping[str, str], backends:
|
||||
discard_typed=lambda: termios.tcflush(sys.stdin, termios.TCIFLUSH),
|
||||
dm=lambda text, directory: notify(text, directory, home, backends),
|
||||
execv=os.execv,
|
||||
forge=lambda cwd: runner(cwd, forge_timeout),
|
||||
git=git_repo.git,
|
||||
input=input,
|
||||
local_time=lambda seconds: time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(seconds)),
|
||||
|
||||
@@ -14,6 +14,7 @@ import unittest
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from loop_effects import child_shells
|
||||
from failure import Failure
|
||||
from loop_effects.effects import run_python, say, start_timer, StreamingClaude, system_effects
|
||||
|
||||
NOW = 1790000000
|
||||
@@ -99,6 +100,16 @@ class ClaudeOnTerminal(unittest.TestCase):
|
||||
|
||||
|
||||
|
||||
class ForgeEffect(unittest.TestCase):
|
||||
def test_runs_the_forges_cli_in_the_checkout_it_is_given(self):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
self.assertEqual(system_effects(pathlib.Path.home(), os.environ).forge(folder)(["pwd", "-P"]), os.path.realpath(folder) + "\n")
|
||||
|
||||
def test_stops_a_command_of_the_forges_cli_that_outlasts_its_timeout(self):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
self.assertEqual(system_effects(pathlib.Path.home(), os.environ, forge_timeout=0.1).forge(folder)(["sleep", "5"]), Failure("sleep 5: stopped after 0.1 s"))
|
||||
|
||||
|
||||
class TmuxEffect(unittest.TestCase):
|
||||
"""Each test runs a fake tmux off its own PATH, without $TMUX, so the human's tmux server is never reached."""
|
||||
|
||||
|
||||
@@ -107,6 +107,8 @@ class Item:
|
||||
blocked_by: tuple[int, ...]
|
||||
# Empty where the item has none, and where a reader took only the table.
|
||||
detail: str = ""
|
||||
# The pull request, as `#<number> <URL>`, whose merge by a person the item awaits; empty where it awaits none, and where the reader asked no forge. release_plan.awaiting_merge sets it.
|
||||
awaits_merge: str = ""
|
||||
|
||||
@property
|
||||
def likelihood(self) -> int:
|
||||
@@ -181,9 +183,9 @@ def items_table(lines: list[str]) -> Table | None | Failure:
|
||||
|
||||
|
||||
def waiting(found: list[Item], done: set[int]) -> set[int]:
|
||||
"""The IDs of the items that wait: each marked question, or blocked by an item the table still holds and done does not name. Row order does not change the result."""
|
||||
"""The IDs of the items that wait: each marked question, each that awaits a person's merge of its pull request, and each blocked by an item the table still holds and done does not name. Row order does not change the result."""
|
||||
held = {item.id for item in found} - done
|
||||
return {item.id for item in found if item.exempt == "question" or held.intersection(item.blocked_by)}
|
||||
return {item.id for item in found if item.exempt == "question" or item.awaits_merge or held.intersection(item.blocked_by)}
|
||||
|
||||
|
||||
def next_item(found: list[Item]) -> Item | None:
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
"""The plan items whose chunk left its pull request ready for a person's merge, under `merge = "human"`. The chunk finished them on its branch only, so the default branch's plan holds each until that merge, and no chunk may start from one."""
|
||||
import dataclasses
|
||||
|
||||
from failure import Failure
|
||||
from forge.commands import Forge, Run
|
||||
from git_cli.git_repo import Git, git
|
||||
from plan_store.plans import Plan, PlanStore
|
||||
from forge.pulls import ready_pulls
|
||||
from plan_store import stores
|
||||
|
||||
|
||||
def awaiting(ref: str, plan: PlanStore, root: str, forge: Forge, forge_run: Run, run: Git = git) -> dict[int, str] | Failure:
|
||||
"""Each plan item, by ID, that awaits a person's merge, with its pull request as `#<number> <URL>`: an item that the plan held at the commit where the pull request's branch left ref, the default branch, and that the plan at the pull request's head no longer holds. A pull request whose head the checkout hasn't fetched, or whose plan can't be read, names none."""
|
||||
pulls = ready_pulls(forge, forge_run)
|
||||
if isinstance(pulls, Failure):
|
||||
return pulls
|
||||
found: dict[int, str] = {}
|
||||
for pull in pulls:
|
||||
base = run("merge-base", ref, pull.head, cwd=root)
|
||||
if isinstance(base, Failure):
|
||||
continue
|
||||
before, after = stores.held_at(base.strip(), plan, root, run), stores.held_at(pull.head, plan, root, run)
|
||||
if isinstance(before, Plan) and isinstance(after, Plan):
|
||||
found.update(dict.fromkeys({item.id for item in before.items} - {item.id for item in after.items}, f"#{pull.number} {pull.url}"))
|
||||
return found
|
||||
|
||||
|
||||
def marked(plan: Plan, awaited: dict[int, str]) -> Plan:
|
||||
"""plan, with each item whose ID awaited holds marked as awaiting that pull request's merge, so the item waits."""
|
||||
return dataclasses.replace(plan, items=[dataclasses.replace(item, awaits_merge=awaited.get(item.id, "")) for item in plan.items])
|
||||
@@ -4,6 +4,7 @@ import dataclasses
|
||||
from release_plan.release_standing import Cut, dated_cut, LastCut, picked, ReadyToCut, ReviewDue, standing_of, Unknown, Unplanned
|
||||
from failure import Failure
|
||||
from plan.todo_table import Item, NoItemsTable
|
||||
from text_files.markdown_text import listed
|
||||
from plan_store.plans import Plan
|
||||
from plan.release import Release, version
|
||||
from project_config import templates
|
||||
@@ -39,6 +40,8 @@ class NextChunk:
|
||||
class NoItem:
|
||||
"""Why the plan names no item for the next chunk, as a sentence the worker reads."""
|
||||
why: str
|
||||
# Whether why names pull requests that await a person's merge, so that no chunk starts until one is merged.
|
||||
awaits_merge: bool = False
|
||||
|
||||
|
||||
def cut_name(cut: LastCut) -> str | None:
|
||||
@@ -80,8 +83,11 @@ def planned(read: Plan | Failure, cut: LastCut, default: str, branch: str, outsi
|
||||
return NoItem(f"{where} holds no item for {upcoming}, and changes are unreleased, and its release review has landed, so that release is finished and ready to cut. The working loop stops here. If todo.md renamed that release instead, add `- <old release> renamed to <new release>` to todo.md's `## Renamed` section.")
|
||||
return NoItem(f"{where} holds no item for {upcoming}, and no change is unreleased, so that release is to be planned first.")
|
||||
first = pick.item
|
||||
if first is None and pick.release is not None:
|
||||
pulls = awaited_merges(weighed.carried, pick.release)
|
||||
return NoItem(f"every item of release {version(pick.release)} in {where} waits.{merge_stop(pulls)}", awaits_merge=bool(pulls))
|
||||
if first is None:
|
||||
return NoItem(f"every item of release {version(pick.release)} in {where} waits." if pick.release is not None else f"{where}'s items table holds no item.")
|
||||
return NoItem(f"{where}'s items table holds no item.")
|
||||
held = weighed.carried
|
||||
# Every carried item takes one release, the next.
|
||||
over = CarriedOver(next(item.release for item in held if item.id == weighed.moved[0]), weighed.moved) if weighed.moved else None
|
||||
@@ -89,4 +95,23 @@ def planned(read: Plan | Failure, cut: LastCut, default: str, branch: str, outsi
|
||||
first = next((item for item in held if item.id == item_id), None)
|
||||
if first is None:
|
||||
return NoItem(f"{where} holds no item {item_id}, the one --item names; it may have shipped.")
|
||||
if first.awaits_merge:
|
||||
return NoItem(f"item {item_id}, the one --item names, is finished on the branch of pull request {first.awaits_merge}, which awaits a person's merge.")
|
||||
return NextChunk(held, first, f"{first.tagline}\n\n{first.detail}".strip(), branch, over, item_id is not None)
|
||||
|
||||
|
||||
def awaited_merges(found: list[Item], release: Release) -> dict[str, list[int]]:
|
||||
"""Each pull request, as `#<number> <URL>`, that finishes items of release and awaits a person's merge, with those items' IDs."""
|
||||
pulls: dict[str, list[int]] = {}
|
||||
for item in found:
|
||||
if item.release == release and item.awaits_merge:
|
||||
pulls.setdefault(item.awaits_merge, []).append(item.id)
|
||||
return pulls
|
||||
|
||||
|
||||
def merge_stop(pulls: dict[str, list[int]]) -> str:
|
||||
"""The sentences that stop the working loop, naming each of pulls, the pull requests that await a person's merge, with the items it finishes; empty where pulls is empty."""
|
||||
if not pulls:
|
||||
return ""
|
||||
named = "; ".join(f"{pull}, which finishes item{'s' if len(ids) > 1 else ''} {listed([str(item_id) for item_id in ids], 'and')}" for pull, ids in pulls.items())
|
||||
return f" Under `merge = \"human\"`, these pull requests await a person's merge: {named}. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again."
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"""How the plan stands to the last release cut: the next release, whether work has landed towards it, and whether it is to be planned, reviewed or cut; and, from that standing, the item the next chunk takes first, with what the default branch holds for the pick."""
|
||||
"""How the plan stands to the last release cut: the next release, whether work has landed towards it, and whether it is to be planned, reviewed or cut; and, from that standing, the item the next chunk takes first, with what the default branch holds for the pick, and, under `merge = "human"`, what the forge says of the pull requests that await a person's merge."""
|
||||
import dataclasses
|
||||
|
||||
from release_plan.awaiting_merge import awaiting, marked
|
||||
from git_cli.git_repo import commits_since, file_at, git, Git
|
||||
from plan.release import dated, dated_heading_pattern, newest_tag, parsed, Release, tagged, UNRELEASED_TITLE
|
||||
from failure import Failure
|
||||
from forge.commands import forge_of, Run
|
||||
from plan.todo_table import Item, items, next_item, renames
|
||||
from plan_store.plans import Plan
|
||||
from plan_store import stores as plan_stores, plans
|
||||
@@ -95,11 +97,22 @@ class DefaultPlan:
|
||||
# The plan, a NoItemsTable where the branch holds none.
|
||||
plan: Plan | Failure
|
||||
cut: LastCut
|
||||
# Why the pull requests that await a person's merge could not be read, so the plan passes over none of their items; None where they were read or not asked for.
|
||||
merges_unread: Failure | None = None
|
||||
|
||||
|
||||
def project_plan(config: ProjectConfig, ref: str, root: str, run: Git = git) -> DefaultPlan:
|
||||
"""default_plan for the project config describes: its plan, its changelog and its title templates."""
|
||||
return default_plan(root, ref, plan_stores.store(config), stores.store(config, "changelog"), config.titles, run)
|
||||
def project_plan(config: ProjectConfig, ref: str, root: str, run: Git = git, forge_run: Run | None = None) -> DefaultPlan:
|
||||
"""default_plan for the project config describes: its plan, its changelog and its title templates. With forge_run, which runs the forge's CLI in the checkout, and under `merge = "human"`, the plan's items that await a person's merge are marked so, as awaiting_merge says, and so wait."""
|
||||
plan = plan_stores.store(config)
|
||||
held = default_plan(root, ref, plan, stores.store(config, "changelog"), config.titles, run)
|
||||
# A plan no commit holds is finished at once (chunk-pr merge --finish), so none of its items awaits a merge.
|
||||
if forge_run is None or config.merge != "human" or plan.tracked is None or not isinstance(held.plan, Plan):
|
||||
return held
|
||||
origin = run("remote", "get-url", "origin", cwd=root)
|
||||
awaited = origin if isinstance(origin, Failure) else awaiting(ref, plan, root, forge_of(origin), forge_run, run)
|
||||
if isinstance(awaited, Failure):
|
||||
return dataclasses.replace(held, merges_unread=awaited)
|
||||
return dataclasses.replace(held, plan=marked(held.plan, awaited))
|
||||
|
||||
|
||||
def default_plan(root: str, ref: str, plan: plans.PlanStore, changelog: stores.RecordStore, titles: templates.Titles, run: Git = git) -> DefaultPlan:
|
||||
|
||||
@@ -7,6 +7,7 @@ import unittest
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from release_plan import awaiting_merge
|
||||
from project_config.templates import BARE, Titles
|
||||
from project_config.settings import DEFAULT_FLOOR, ProjectConfig, SETTINGS
|
||||
from failure import Failure
|
||||
@@ -393,3 +394,87 @@ class NextChunk(unittest.TestCase):
|
||||
planned = next_chunk.planned(Plan([later, carried, next_one]), release_standing.LastCut("v0.2.0", "", 4, []), "origin/main", "item-{id}")
|
||||
assert isinstance(planned, next_chunk.NextChunk), planned
|
||||
self.assertEqual(planned.carried, next_chunk.CarriedOver((0, 3, 0), (5,)))
|
||||
|
||||
|
||||
class AwaitingMerge(unittest.TestCase):
|
||||
"""A repo whose branch item-1 finished item 1 of three, and whose default branch has since filed item 4."""
|
||||
|
||||
def setUp(self):
|
||||
self.repo = tempfile.mkdtemp()
|
||||
self.addCleanup(subprocess.run, ["rm", "-rf", self.repo])
|
||||
run = self.run = lambda *args: subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", *args], capture_output=True, check=True, cwd=self.repo, env=isolated_env(), text=True).stdout.strip()
|
||||
rows = lambda *ids: HEADER + "".join(ROW.format(id=id_, release="0.1.0") for id_ in ids)
|
||||
run("init", "-q", "-b", "main")
|
||||
run("remote", "add", "origin", "https://github.com/o/r")
|
||||
pathlib.Path(self.repo, "todo.md").write_text(rows(1, 2, 3))
|
||||
run("add", "todo.md")
|
||||
run("commit", "-q", "-m", "Plan")
|
||||
run("checkout", "-q", "-b", "item-1")
|
||||
pathlib.Path(self.repo, "todo.md").write_text(rows(2, 3))
|
||||
run("commit", "-q", "-a", "-m", "Finish item 1 in the plan")
|
||||
self.head = run("rev-parse", "HEAD")
|
||||
run("checkout", "-q", "main")
|
||||
pathlib.Path(self.repo, "todo.md").write_text(rows(1, 2, 3, 4))
|
||||
run("commit", "-q", "-a", "-m", "File item 4")
|
||||
self.listed = f"7\thttps://github.com/o/r/pull/7\t{self.head}\tfalse\tfalse\n"
|
||||
paths = {setting: pathlib.Path(self.repo, setting) for setting in SETTINGS} | {"plan": pathlib.Path(self.repo, "todo.md"), "changelog": pathlib.Path(self.repo, "CHANGELOG.md")}
|
||||
self.config = ProjectConfig("acme", pathlib.Path(self.repo, "folder"), pathlib.Path(self.repo), paths, merge="human")
|
||||
|
||||
def test_names_the_items_a_ready_pull_request_finished_on_its_branch(self):
|
||||
self.assertEqual(awaiting_merge.awaiting("main", plan_in(self.repo), self.repo, "gh", lambda command: self.listed), {1: "#7 https://github.com/o/r/pull/7"}, "item 4, filed after the branch left main, is not finished on it")
|
||||
|
||||
def test_names_none_for_a_pull_request_whose_head_the_checkout_lacks(self):
|
||||
unfetched = f"7\thttps://github.com/o/r/pull/7\t{'b' * 40}\tfalse\tfalse\n"
|
||||
self.assertEqual(awaiting_merge.awaiting("main", plan_in(self.repo), self.repo, "gh", lambda command: unfetched), {})
|
||||
self.assertEqual(awaiting_merge.awaiting("main", plan_in(self.repo), self.repo, "gh", lambda command: unfetched + self.listed), {1: "#7 https://github.com/o/r/pull/7"}, "the pull request listed after it still counts")
|
||||
|
||||
def test_names_none_for_a_pull_request_whose_head_holds_no_plan(self):
|
||||
self.run("checkout", "-q", "-b", "planless")
|
||||
self.run("rm", "-q", "todo.md")
|
||||
self.run("commit", "-q", "-m", "Drop the plan")
|
||||
planless = f"9\thttps://github.com/o/r/pull/9\t{self.run('rev-parse', 'HEAD')}\tfalse\tfalse\n"
|
||||
self.run("checkout", "-q", "main")
|
||||
self.assertEqual(awaiting_merge.awaiting("main", plan_in(self.repo), self.repo, "gh", lambda command: planless), {})
|
||||
self.assertEqual(awaiting_merge.awaiting("main", plan_in(self.repo), self.repo, "gh", lambda command: Failure("gh: no network")).reason, "gh: no network")
|
||||
|
||||
def test_the_projects_plan_passes_over_an_item_that_awaits_a_persons_merge(self):
|
||||
held = release_standing.project_plan(self.config, "main", self.repo, forge_run=lambda command: self.listed)
|
||||
self.assertEqual([(item.id, item.awaits_merge) for item in held.plan.items], [(1, "#7 https://github.com/o/r/pull/7"), (2, ""), (3, ""), (4, "")])
|
||||
self.assertIsNone(held.merges_unread)
|
||||
self.assertEqual(release_standing.chunk_item(held.plan.items, held.cut).item.id, 2)
|
||||
self.assertEqual(next_chunk.planned(held.plan, held.cut, "main", "item-{id}", item_id=1), next_chunk.NoItem("item 1, the one --item names, is finished on the branch of pull request #7 https://github.com/o/r/pull/7, which awaits a person's merge."))
|
||||
self.assertEqual(next_chunk.planned(held.plan, held.cut, "main", "item-{id}", item_id=2).first.id, 2)
|
||||
self.assertEqual([item.id for item in todo_table.bundle_candidates(held.plan.items, held.plan.items[1])], [3, 4])
|
||||
|
||||
def test_the_projects_plan_asks_no_forge_where_the_chunk_merges_or_no_forge_is_given(self):
|
||||
asked: list[list[str]] = []
|
||||
chunk = release_standing.project_plan(dataclasses.replace(self.config, merge="chunk"), "main", self.repo, forge_run=lambda command: asked.append(command) or self.listed)
|
||||
self.assertEqual((asked, [item.awaits_merge for item in chunk.plan.items]), ([], [""] * 4))
|
||||
self.assertEqual([item.awaits_merge for item in release_standing.project_plan(self.config, "main", self.repo).plan.items], [""] * 4)
|
||||
|
||||
def test_the_projects_plan_asks_no_forge_about_a_plan_kept_outside_the_checkout(self):
|
||||
outside = pathlib.Path(tempfile.mkdtemp())
|
||||
self.addCleanup(subprocess.run, ["rm", "-rf", str(outside)])
|
||||
(outside / "todo.md").write_text(pathlib.Path(self.repo, "todo.md").read_text())
|
||||
asked: list[list[str]] = []
|
||||
held = release_standing.project_plan(dataclasses.replace(self.config, paths=self.config.paths | {"plan": outside / "todo.md"}), "main", self.repo, forge_run=lambda command: asked.append(command) or self.listed)
|
||||
self.assertEqual((asked, [item.awaits_merge for item in held.plan.items]), ([], [""] * 4))
|
||||
|
||||
def test_the_projects_plan_says_why_where_the_forge_cannot_list_the_pull_requests(self):
|
||||
held = release_standing.project_plan(self.config, "main", self.repo, forge_run=lambda command: Failure("gh: no network"))
|
||||
self.assertEqual(([item.awaits_merge for item in held.plan.items], held.merges_unread.reason), ([""] * 4, "gh: no network"))
|
||||
self.run("remote", "remove", "origin")
|
||||
remoteless = release_standing.project_plan(self.config, "main", self.repo, forge_run=lambda command: self.listed)
|
||||
self.assertEqual([item.awaits_merge for item in remoteless.plan.items], [""] * 4)
|
||||
self.assertIsInstance(remoteless.merges_unread, Failure)
|
||||
|
||||
def test_says_which_pull_requests_await_a_merge_where_every_item_left_waits(self):
|
||||
held = release_standing.project_plan(self.config, "main", self.repo, forge_run=lambda command: self.listed)
|
||||
items = [dataclasses.replace(item, awaits_merge="#8 https://github.com/o/r/pull/8" if item.id in (2, 3) else item.awaits_merge) for item in held.plan.items]
|
||||
items[3] = dataclasses.replace(items[3], exempt="question")
|
||||
none = next_chunk.planned(Plan(items), held.cut, "main", "item-{id}")
|
||||
self.assertEqual(none.why, "every item of release 0.1.0 in main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #7 https://github.com/o/r/pull/7, which finishes item 1; #8 https://github.com/o/r/pull/8, which finishes items 2 and 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again.")
|
||||
self.assertTrue(none.awaits_merge)
|
||||
later = dataclasses.replace(items[0], id=9, release=(0, 2, 0), awaits_merge="#10 https://github.com/o/r/pull/10")
|
||||
self.assertEqual(next_chunk.awaited_merges([*items, later], (0, 1, 0)), {"#7 https://github.com/o/r/pull/7": [1], "#8 https://github.com/o/r/pull/8": [2, 3]}, "a pull request that finishes only a later release's items doesn't count")
|
||||
self.assertFalse(next_chunk.planned(Plan([dataclasses.replace(item, awaits_merge="", exempt="question") for item in items]), held.cut, "main", "item-{id}").awaits_merge)
|
||||
|
||||
@@ -269,7 +269,7 @@ class Main(unittest.TestCase):
|
||||
result = result if "api_error_status" in result else {"type": "result", "structured_output": {"found": [n + 1 for n in result["found"]]}}
|
||||
return subprocess.CompletedProcess(args, 0, json.dumps(result), "")
|
||||
|
||||
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, git=system_effects(pathlib.Path.home(), os.environ).git, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, replace_file=unused, sleep=unused, stream_claude=unused, timer=unused, tmux=unused, tmux_on_terminal=unused)
|
||||
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, forge=unused, git=system_effects(pathlib.Path.home(), os.environ).git, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, replace_file=unused, sleep=unused, stream_claude=unused, timer=unused, tmux=unused, tmux_on_terminal=unused)
|
||||
out, err = io.StringIO(), io.StringIO()
|
||||
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
|
||||
code = main.main(argv, env, self.home, effects, **self.limits)
|
||||
|
||||
@@ -4146,3 +4146,85 @@ Inherited architect, decided by:
|
||||
- Navigation, Shape: `bin/chunk_driver/claims.py:1` module docstring: the lock and the chunk flags sit in one module named for that job, and `starting` yields a `Failure` instead of raising
|
||||
- Locality, Navigation: `bin/forge/reviews.py:23` `review_decision`: all review-state reading in `forge/`, each field shape-checked; three similar names cost a docstring read each
|
||||
- Locality: `bin/chunk_driver/project/model_choice.py:28` `overridden`: the model override is one function, where it was spelled out twice
|
||||
|
||||
## 2026-11-19T22:33:15Z, PR #646 at a357cc7b
|
||||
|
||||
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||
|---|---|---|---|---|---|
|
||||
| Junior A | 7 | 5.5 | 6 | 6 | 6 |
|
||||
| Mid A | 7 | 6 | 6.5 | 6 | 6.5 |
|
||||
| Maintainability senior | 7 | 6 | 6 | 6 | 6.5 |
|
||||
| Inherited architect | 7 | 6.5 | 6 | 6 | 6.5 |
|
||||
| Mean | 7.00 | 6.00 | 6.13 | 6.00 | 6.38 |
|
||||
|
||||
Junior A, hardest first:
|
||||
|
||||
- Locality, Shape: `bin/do_epic/main.py:287` `parked_through`: the three-step park and resume order, the `told` and `finished` flags and a raw string compare held at once; the docstring gives the order but not why the flags exist
|
||||
- Locality, Self-sufficiency: `bin/agent_cycle/routing.py:115` `unfinished_route`: floor rung, escalation mark, cap and the count of unfinished verdicts meet in a dozen lines, and the reasons sit in the decision log
|
||||
- Shape: `bin/agent_cycle/judge.py:237` `quotes_checked`: six checks each quietly turn one verdict type into another, and the call site doesn't show the result type
|
||||
- Locality: `bin/do_epic/scheduler.py:144` `start_chunks`: four overlapping sets, a five-branch chain, a counter and nested locks shared with loop-claude
|
||||
- Shape: `bin/agent_cycle/run.py:150` `rule`: runs the judge, stamps, annotates, steps up and orders the archive writes, beside four near-identical archive helpers
|
||||
- Locality: `bin/agent_cycle/stuck_workers.py:52` `Watch.check`: mutates `self.cpu` and `self.judged` out of sight, and one condition mixes `and` and `or` without parentheses
|
||||
- Shape: `bin/do_epic/gates.py:42` `gate`: a long ordered chain where a missing value means something different on each line
|
||||
- Locality: `bin/loop_claude/loop/reload.py:36` `decode_handed`: pops legacy fields from a handover the old process wrote before it replaced itself; nothing enforces the coupling
|
||||
- Self-sufficiency: `skills/larv-review/SKILL.md:89` "Round cap": three sections must be open at once to tell whether a fix reruns a pass
|
||||
- Self-sufficiency: `bin/agent_cycle/verdicts.py:41` the comment: points to `cycle.judge.re_ask_checked`, a module path that doesn't exist
|
||||
|
||||
Mid A, hardest first:
|
||||
|
||||
- Locality: `bin/do_epic/main.py:354` `resumed_news`: a `while True` poll that carries `said` and `shown` across turns, with a nested-quote f-string; no comment says what holds when the loop exits
|
||||
- Locality, Self-sufficiency: `bin/do_epic/main.py:287` `parked_through`: three steps whose correctness depends on each other; the reason for the order sits in the decision log
|
||||
- Locality: `bin/do_epic/main.py:241` `chunk_run`: `news`, `told`, `finished` and the reopened-epic exit held across iterations
|
||||
- Locality: `bin/do_epic/scheduler.py:144` `start_chunks`: a five-branch chain over four sets, counted under nested locks
|
||||
- Shape: `bin/project_config/settings.py:187` `load`: about twenty comprehension clauses build one `faults` list, so finding what one setting requires means scanning all of them
|
||||
- Locality: `bin/agent_cycle/routing.py:115` `unfinished_route`: five rung concepts at once, readable only with `bin/model_routing/ladder.py` open beside it
|
||||
- Shape: `bin/chunk_pr/main.py:447` `levelled_and_finished`: checks whether a scoring run is owed, which its name doesn't suggest
|
||||
- Locality: `bin/plan/ranking.py:239` `score`: the formula forks on the old and the new table shape, both live
|
||||
- Self-sufficiency: `bin/larv_review/main.py:1` the module docstring: about 165 lines that restate what `COMMANDS` and the modules it calls enforce
|
||||
|
||||
Maintainability senior, hardest first:
|
||||
|
||||
- Locality, Shape: `bin/do_epic/main.py:287` `parked_through`: the told, finished and news interplay, the human-merge cases and the three-step order held at once, and no code enforces the order
|
||||
- Locality, Shape: `bin/do_epic/main.py:354` `resumed_news`: a loop that mutates five locals and builds its message in a nested f-string, with no stated invariant
|
||||
- Locality: `bin/agent_cycle/routing.py:115` `unfinished_route`: five rungs, an unfinished count, the escalation mark and the cap held together; each threshold's reason sits in the decision log
|
||||
- Shape, Self-sufficiency: `bin/project_config/settings.py:187` `load`: about 20 comprehension expressions each encode a rule linking two settings; named predicates would make each rule findable
|
||||
- Shape, Locality: `bin/chunk_pr/main.py:314` `merged`: the merge-queue loop with its flags, where a variable carries either a string or a Failure and each read must work out which
|
||||
- Locality: `bin/plan/ranking.py:239` `score`: the old and new table shapes run through the whole module, so each change is checked against both
|
||||
- Locality: `bin/larv_review/plan.py:21` `Emptied`: a `str` subclass whose type carries meaning, lost without warning by any code that rebuilds the string
|
||||
- Locality: `bin/agent_cycle/judge.py:76` `TASK_HEADING`: an archive key, so rewording it breaks replays in another module, and only a comment warns
|
||||
- Self-sufficiency: `skills/larv-review/SKILL.md:89` "Round cap": the review rules exist three times, here, in the help at `bin/larv_review/main.py:1` and in rule-hook's code
|
||||
|
||||
Inherited architect, would restructure first:
|
||||
|
||||
- Locality, Shape: `bin/rule_hook/round_cap.py:10` `round_cap_breaches`: the round cap lives in four places across three packages, and none owns the whole invariant; rounds are counted from commit titles, never from launches
|
||||
- Navigation, Shape: `README.md:225` "Packages under bin/": 84 entries listed alphabetically in dense prose, with no grouping by layer
|
||||
- Shape: `bin/loop_claude/loop/reload.py:18` `LoopRun`: loop-claude's core run state defined in a module named for self-reloading
|
||||
- Shape: `bin/agent_cycle/judge.py:116` `Rejected`: says loop-claude rejected the reply, in a module do-epic shares
|
||||
- Self-sufficiency: `bin/agent_cycle/run.py:103` the comment: cites `close.py`, which doesn't exist
|
||||
- Self-sufficiency: `bin/agent_cycle/verdicts.py:41` the comment: cites `cycle.judge.re_ask_checked`, a stale module path
|
||||
- Navigation: `bin/chunk_driver/drivers.py:1` the module: "entry point" and "driver" name one concept, and `Run`, `ChunkRun` and `LoopRun` are one concept in three types
|
||||
- Navigation: `bin/do_epic/status.py:1` the module: in no map, and the package's `__init__.py` is empty like 40 others
|
||||
- Locality: `reviewer-merge-trials/driver.py:4` the imports: a frozen trial imports live code under `bin/`, so a refactor there breaks a record
|
||||
- Self-sufficiency: `bin/agent_cycle/routing.py:92` the comment: one of 109 citations of the decision log that carry a unit's reason
|
||||
|
||||
## 2026-11-19T23:28:20Z, PR #645 at 2797e110, against a9bdef6
|
||||
|
||||
Ruling: same
|
||||
|
||||
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||
|---|---|---|---|---|---|
|
||||
| Mid A | same | worse | same | same | same |
|
||||
| Inherited architect | same | worse | same | same | same |
|
||||
|
||||
Mid A, decided by:
|
||||
|
||||
- Locality: `bin/plan/todo_table.py:110` `Item.awaits_merge`: the plan core's item carries a mark that release_plan.awaiting_merge sets from forge state, so whether an item waits depends on whether project_plan's caller passed a forge_run.
|
||||
- Locality: `bin/release_plan/next_chunk.py:88` `planned`: the loop's stop is the truthiness of a sentence, and travels through chunks_to_start, AwaitedMerges, start_chunks, windows_opened and handed_on.
|
||||
- Locality: `bin/do_epic/main.py:431` `handed_on`: one straight path became two booleans that three call sites set, branching three ways against config.automation_moves.
|
||||
|
||||
Inherited architect, decided by:
|
||||
|
||||
- Locality: `bin/release_plan/release_standing.py:104` `project_plan`: a one-line delegate that read git now calls the forge behind a four-part guard, while the module docstring speaks only of the default branch.
|
||||
- Locality: `bin/plan/todo_table.py:110` `Item.awaits_merge`: a field nothing in its own package sets; waiting reads it, so it depends on a caller three packages out having run the marking.
|
||||
- Locality: `bin/loop_claude/loop/chunk_windows.py:161` `chunks_to_start`: the stop condition is split across two packages, and one half is a string's truthiness.
|
||||
- Locality: `bin/do_epic/scheduler.py:96` `open_blockers`: four functions gained a defaulted `unblocking`, so a caller that forgets it silently gets the old behaviour.
|
||||
|
||||
+2
-2
@@ -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/<EPIC-KEY>/`. do-epic archives its cycles under `~/.claude/do-epic-transcripts/`, not in loop-claude's archive, whose readers parse loop-claude's prompts. An open issue runs once a label records its repo; until do-epic picks repos itself, an issue without one waits, and `do-epic <EPIC-KEY>` says so.
|
||||
- **Long gates.** A chunk whose PR waits on a gate, such as a human approval, parks. It keeps its worktree, PR and session, and its state is in a file that survives a reboot. A parked chunk takes no running slot, and the items it blocks wait. do-epic polls the forge and resumes the chunk's session when the gate passes or a reviewer comments. It fixes reasonable feedback, replies to the rest, and changes the setup so review would have caught it. `do-epic <key> --status` and the tmux window names show what each chunk waits on. A gate is a pull request's pending checks or, on GitHub, the approval its branch protection requires; a draft waits on neither, since its worker has yet to mark it ready. On Gitea a draft is a pull request whose title opens with `WIP:` or `[WIP]`, Gitea's default `WORK_IN_PROGRESS_PREFIXES`. Changes a reviewer requested resume the chunk only while that review was made on the pull request's head commit and the pull request's author has not commented or replied after it; once the worker pushed or replied, the chunk parks on a new review, since GitHub keeps the decision until the reviewer reviews again. The chunk's window reads the forge once a minute, which no forge's rate limit notices. A chunk resumes only into a free slot, under the limits a starting chunk meets, and stays parked until then. `do-epic <key>` starts a parked chunk's window again whatever the limits, since the chunk stays parked. do-epic sets `CHUNK_PR_PARKS=1` for each worker, so `chunk-pr merge` fails at once where the pull request awaits an approval, and the worker's run doesn't hold a slot while the pull request waits. In a repo whose config sets `merge = "human"`, the merge itself is a gate: `chunk-pr merge` leaves the pull request ready, the chunk parks on `your merge` once nothing else holds the pull request, and it resumes when the forge no longer reports the pull request open, to clean up and finish. The judge may rule such a chunk finished while its pull request is open, since its worker ends each run there. So do-epic reads a gate it could not read again before it hands the chunk on, and tells the worker once to remove a worktree whose pull request is no longer open.
|
||||
- **Long gates.** A chunk whose PR waits on a gate, such as a human approval, parks. It keeps its worktree, PR and session, and its state is in a file that survives a reboot. A parked chunk takes no running slot, and the items it blocks wait. do-epic polls the forge and resumes the chunk's session when the gate passes or a reviewer comments. It fixes reasonable feedback, replies to the rest, and changes the setup so review would have caught it. `do-epic <key> --status` and the tmux window names show what each chunk waits on. A gate is a pull request's pending checks or, on GitHub, the approval its branch protection requires; a draft waits on neither, since its worker has yet to mark it ready. On Gitea a draft is a pull request whose title opens with `WIP:` or `[WIP]`, Gitea's default `WORK_IN_PROGRESS_PREFIXES`. Changes a reviewer requested resume the chunk only while that review was made on the pull request's head commit and the pull request's author has not commented or replied after it; once the worker pushed or replied, the chunk parks on a new review, since GitHub keeps the decision until the reviewer reviews again. The chunk's window reads the forge once a minute, which no forge's rate limit notices. A chunk resumes only into a free slot, under the limits a starting chunk meets, and stays parked until then. `do-epic <key>` starts a parked chunk's window again whatever the limits, since the chunk stays parked. do-epic sets `CHUNK_PR_PARKS=1` for each worker, so `chunk-pr merge` fails at once where the pull request awaits an approval, and the worker's run doesn't hold a slot while the pull request waits. In a repo whose config sets `merge = "human"`, the merge itself is a gate: `chunk-pr merge` leaves the pull request ready, the chunk parks on `your merge` once nothing else holds the pull request, and it 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.
|
||||
@@ -386,7 +386,7 @@ Valid while the later fixes per finished chunk, which `score-outcomes` and the r
|
||||
- A file outside the checkout is read as it stands, never as the default branch held it: release standing, chunk-preflight and loop-claude's routing read such a plan or changelog from disk.
|
||||
- chunk-preflight and loop-claude's routing learn that a release's items are all done from the plan's commits. A plan outside the checkout no longer names such a release, so the release after it reads as next, and only the last release of all gets a release review called due and is called ready to cut. Both tools say so on every run, and that the release reviews and the cuts are the human's to call (`bin/release_plan/release_standing.py`, `UNSEEN_RELEASES`).
|
||||
|
||||
Messages keep each file's usual name, such as `todo.md`, as its label, since the config keeps the names. Revisit at 0.15.0, which plans the support for `score-outcomes`, the routing figures, the release standing and the owed scoring run.
|
||||
Messages keep each file's usual name, such as `todo.md`, as its label, since the config keeps the names. Revisit at 0.16.0, which plans the support for `score-outcomes`, the routing figures, the release standing and the owed scoring run.
|
||||
|
||||
## project config: `language` names the prose's language by its English name, and `commit-title`, `pull-request-title` and `branch` are brace templates over `{id}` and `{summary}`
|
||||
|
||||
|
||||
@@ -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 <verb> anything` or `anyone`, never `<verb> 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 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`.
|
||||
|
||||
@@ -6,114 +6,76 @@
|
||||
|
||||
`Bar = 0.1`
|
||||
|
||||
`Next ID = 461`
|
||||
`Next ID = 467`
|
||||
|
||||
## Items
|
||||
|
||||
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 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 <EPIC-KEY> --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 |
|
||||
| 196 | 0.15.0 | | decision | **Replay the architecture, principles, overrides and product-owner passes with `review-replay` on Opus 5.5 projects, record each run in the review-replay routing decision, and, where a run qualifies a rung, add back the code that lowers a pass to it.** | 2 | 2 | 3 | 5 | 2 | 1.4 by 3 | 1.2 |
|
||||
| 321 | 0.15.0 | 196 | decision | **Evaluate the review passes that run on a rung `review-replay` qualified, against the chunks before them, and revert any pass whose findings or later fixes worsened.** | 1 | 2 | 1 | 2 | 2 | 1.1 by 3, 1.4 by 2 | 2.0 |
|
||||
| 273 | 0.15.0 | | decision | **Re-tune the E + I steps of `REVIEW_STEPS` for 6 to 8 once 10 finished chunks have scored an E + I of 6 or more, from how well E + I orders their review rounds and 🔴 findings.** | 1 | 2 | 2 | 3 | 2 | 1.1 by 2, 1.4 by 3 | 2.0 |
|
||||
| 268 | 0.15.0 | | | **End a run whose release is ready to cut with a notice on loop-claude's terminal, in place of an interrupt that waits for an answer.** | 2 | 2 | 3 | 5 | 3 | 1 by 5 | 1.9 |
|
||||
| 445 | 0.15.0 | | | **Refuse a plan that holds an item a `Finish item <ID>` commit already removed, so a merge resolution cannot bring a finished item back.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 3, 1.1 by 2 | 1.8 |
|
||||
| 171 | 0.15.0 | | decision | **Group the routing figures' review rounds by the reviewers' rung as well as the worker's, so a call blames a rung only for rounds its own reviews raised.** | 3 | 2 | 2 | 5 | 4 | 1.2 by 3, 1.4 by 3 | 1.8 |
|
||||
| 300 | 0.15.0 | | owner | **Reach the comprehension floor: restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Self-sufficiency first; today the scoring runs at 81e8d8a1 scored Navigation 7.13 and 6.75, Locality 6.38 and 5.63, Shape 6.25 and 5.88, Self-sufficiency 5.88 and 5.25, and Overall 6.50 and 5.88.** | 4 | 2 | 3 | 7 | 8 | code health by 8 | 1.7 |
|
||||
| 264 | 0.15.0 | | | **Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 5 | 1.7 |
|
||||
| 323 | 0.15.0 | | | **Count a release review as landed once its pull request has merged, whatever its commits are titled.** | 3 | 2 | 3 | 6 | 3 | 1.4 by 3, 1.5 by 2 | 1.7 |
|
||||
| 342 | 0.15.0 | | | **Research the tooling agents read, search and run commands with once more, and file an item for each tool that cuts tokens a replay shows keep quality.** | 1 | 2 | 1 | 2 | 3 | 1.4 by 3, 1.5 by 2 | 1.7 |
|
||||
| 149 | 0.15.0 | | decision | **Fill each release by priority up to a capacity it states, in place of the bar, and move what does not fit to a later release.** | 4 | 2 | 3 | 7 | 5 | 1.1 by 7 | 1.6 |
|
||||
| 165 | 0.15.0 | | | **Make this repo's tests assert the facts a prompt or help text carries in place of its sentences, and drop the tests that scan source or assert a constant.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 4, 1.4 by 3 | 1.6 |
|
||||
| 392 | 0.15.0 | | owner | **Group bin/'s packages by concern into seven folders (plan, records, integrations, loop, review, forge and host), so a newcomer finds a tool's neighbours in one place.** | 3 | 1 | 3 | 5 | 7 | code health by 4 | 1.6 |
|
||||
| 456 | 0.15.0 | | | **Make the child-shell stop test pass under load, so a full test run doesn't fail on a race.** | 2 | 2 | 2 | 4 | 2 | 1.1 by 2, 1.5 by 2 | 1.6 |
|
||||
| 151 | 0.15.0 | | decision | **Keep 10 to 20 settled decisions per project as its goals' test set, and rerun them after a goal changes.** | 3 | 2 | 2 | 5 | 5 | 1.2 by 7 | 1.6 |
|
||||
| 68 | 0.15.0 | | principle | **Test `workflow-bench/compare.py`'s blinding and `bench.py`'s run plan.** | 2 | 1 | 1 | 2 | 4 | 1.1 by 5 | 1.5 |
|
||||
| 102 | 0.15.0 | | | **Give loop-claude's retry delay, and the file it reads the machine's memory from, environment overrides, so the black-box test stops replacing `time.sleep` and `machine_load.memory.MEMINFO` through `sitecustomize`.** | 1 | 1 | 2 | 2 | 3 | 1.1 by 4 | 1.5 |
|
||||
| 135 | 0.15.0 | | | **Fingerprint only the modules loop-claude imports, so editing another tool's code no longer reloads a running loop.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 4 | 1.5 |
|
||||
| 443 | 0.15.0 | | | **Measure whether compacting a waiting worker's session cut the cost of 20 chunks with an interrupt, with quality holding.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 4 | 1.4 |
|
||||
| 5 | 0.15.0 | | decision | **Key a project on its checkout's full path, and refuse to start while another session uses that key.** | 4 | 2 | 3 | 7 | 5 | 1.1 by 6 | 1.4 |
|
||||
| 291 | 0.15.0 | | owner | **Let `principles/technical-principles.md` → "Sane defaults" allow a library whose README goals ask that it work with no config to default the clock and randomness in its public constructor, where a documented option overrides each.** | 1 | 2 | 3 | 4 | 1 | 1.2 by 3 | 1.3 |
|
||||
| 156 | 0.15.0 | | decision | **Drop `rank_todo.py`'s ranking of an old-shape table once no project under `~/code` holds one.** | 2 | 1 | 3 | 4 | 4 | 1.1 by 4 | 1.2 |
|
||||
| 388 | 0.15.0 | | | **Refuse an agent's Write or Edit of a routing ladder file in rule-hook, since a change to the ladder is the human's.** | 1 | 1 | 3 | 3 | 2 | 1.2 by 3 | 1.2 |
|
||||
| 365 | 0.15.0 | | | **Have `score-outcomes` read the finished and dropped items of a plan outside the checkout, from the project repo's history or from Jira's issue changelogs.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 |
|
||||
| 368 | 0.15.0 | | | **Call a release review due, call a release ready to cut, and tell whether a chunk owes a scoring run, for a plan outside the checkout, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 |
|
||||
| 260 | 0.15.0 | | decision | **Compare the first 20 chunks whose worker got the reading rule with the 20 before them, on review rounds past each pass's first, unfinished verdicts, 🔴, 🟡 and misread findings, dollars and hours per chunk, and drop the rule where any rose.** | 1 | 2 | 1 | 2 | 2 | 1.4 by 3 | 1.2 |
|
||||
| 309 | 0.15.0 | | | **Run a scoring run's second pass on one head with two seats in place of four, once `larv-review agreement` shows the seats agree with each other more than a run agrees with its rerun.** | 2 | 2 | 2 | 4 | 2 | 1.4 by 3 | 1.2 |
|
||||
| 51 | 0.15.0 | | principle | **Hand loop-claude's terminal output to an injected effect, so no storage or retry function prints.** | 2 | 1 | 3 | 4 | 5 | 1.1 by 5 | 1.1 |
|
||||
| 419 | 0.15.0 | | | **Run the external auto-reviewer until its review of the PR's head has no findings, and answer each of its threads on the PR.** | 3 | 2 | 3 | 6 | 5 | 1.1 by 5 | 1.1 |
|
||||
| 444 | 0.15.0 | | | **Rank an epic item that is split by repo, by the goals of each repo its sub-tasks name.** | 2 | 2 | 2 | 4 | 3 | 1 by 3 | 1.1 |
|
||||
| 366 | 0.15.0 | | | **Count the chunks of a project whose plan sits outside the checkout in the routing figures, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.4 by 2 | 1.1 |
|
||||
| 201 | 0.15.0 | | owner | **Save the human's tmux setups and restore them after a reboot, so work is up and running again quickly.** | 3 | 2 | 1 | 4 | 4 | 1.5 by 4 | 1.1 |
|
||||
| 267 | 0.15.0 | | | **Keep waiting when an interrupt gets an empty answer, at the terminal or in the claude opened for it, in place of stopping the loop.** | 2 | 1 | 3 | 4 | 2 | 1.5 by 3 | 1.1 |
|
||||
| 4 | 0.15.0 | | | **Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.** | 3 | 2 | 3 | 6 | 3 | 1.1 by 3 | 1.1 |
|
||||
| 324 | 0.15.0 | | | **Count in the routing figures the finished chunks whose worker wrote no `Chunk items:` line.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 2, 1.4 by 1 | 1.1 |
|
||||
| 187 | 0.15.0 | | | **Count the tokens a worker spends reading reviewers' reports, so goal 1.4's signal shows whether report files lowered what a review costs the worker's context.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 3 | 1.0 |
|
||||
| 266 | 0.15.0 | | | **Move the chunks archived under the key `home/lilleman/.claude` to the key `claude-config`, so the routing figures and `score-outcomes` count this repo's chunks as one project.** | 3 | 2 | 2 | 5 | 3 | 1.4 by 3 | 1.0 |
|
||||
| 339 | 0.15.0 | | | **Lower the reading cost of the files a chunk reads most before its first commit.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 3 | 1.0 |
|
||||
| 341 | 0.15.0 | | | **Hand each worker's claude a lower Read limit through `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`, kept only where replays of the archived review rounds find what two unchanged replays find.** | 2 | 2 | 3 | 5 | 3 | 1.4 by 3 | 1.0 |
|
||||
| 181 | 0.15.0 | | principle | **Have the test of a quoted answer's step-up assert the stepped rung's facts as literals, not through `prompts.rungs_held`.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 0.9 |
|
||||
| 193 | 0.15.0 | | | **Narrow `numbered`'s mark to `Mark` by a typed lookup in place of `typing.cast`, so a mark added to the regex but not the lookup fails at run time, and one added to the lookup but not `Mark` fails mypy.** | 1 | 1 | 3 | 3 | 1 | 1.1 by 2 | 0.9 |
|
||||
| 194 | 0.15.0 | | | **Make `test_waits_out_a_usage_limit_which_ends_a_run_of_failures` expect a usage-limit wait independent of the wall-clock time that passes during the run.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 0.9 |
|
||||
| 298 | 0.15.0 | | | **Send the judge only the decision entries and the transcript tail a verdict needs, and keep the cut only where `judge-replay` changes no verdict kind.** | 3 | 3 | 3 | 7 | 4 | 1.4 by 2, 1.5 by 1 | 0.9 |
|
||||
| 265 | 0.15.0 | | | **Archive each wait that costs a chunk wall time, for a usage limit, low memory, a failed worker start or a heavy slot, with its start and end stamps, so goal 1.5's hours split waiting from work.** | 3 | 2 | 2 | 5 | 4 | 1.5 by 3 | 0.8 |
|
||||
| 395 | 0.15.0 | | decision | **Keep each block a save didn't change, with its localId, and the spacing paragraphs beside it as Jira or Confluence holds them.** | 3 | 2 | 2 | 5 | 5 | 1.6 by 4 | 0.8 |
|
||||
| 425 | 0.15.0 | | | **Show on loop-claude's terminal why it doesn't start a chunk beside the next item, as chunk-preflight prints it.** | 1 | 1 | 2 | 2 | 2 | 1.5 by 2 | 0.7 |
|
||||
| 169 | 0.15.0 | | | **Have rule-hook's `todo-rank-check` catch a `todo.md` that the same Bash call edits and then commits.** | 3 | 1 | 3 | 5 | 3 | 1.1 by 2 | 0.7 |
|
||||
| 447 | 0.15.0 | | | **Stop a headless claude call that runs past a time limit, and report it as a failure, so a hung judge or stuck check can't hold the loop.** | 2 | 2 | 2 | 4 | 3 | 1.5 by 2 | 0.7 |
|
||||
| 367 | 0.15.0 | | | **Check that every write to a Jira plan leaves it ranked, as rule-hook's `todo-rank-check` checks `todo.md` today.** | 2 | 2 | 3 | 5 | 3 | 1.6 by 2 | 0.7 |
|
||||
| 423 | 0.15.0 | | | **Skip the judge's model call on a worker's final message that the offline classifier decides is finished.** | 3 | 3 | 3 | 7 | 5 | 1.4 by 2 | 0.4 |
|
||||
| 197 | 0.15.0 | | | **Let the human edit what they type at loop-claude's terminal questions with the arrow keys, so Left moves the cursor in place of printing `^[[D`.** | 2 | 2 | 3 | 5 | 2 | 1.5 by 1 | 0.4 |
|
||||
| 1 | 0.16.0 | | question | **Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.** | 1 | 2 | 1 | 2 | 1 | | 0.0 |
|
||||
| 397 | 0.16.0 | | owner | **Script each step that the chunks of releases 0.10.0 to 0.15.0 repeated by hand and a program can compute, filing one item per step, and file this audit again for the next release.** | 1 | 2 | 1 | 2 | 2 | 1.4 by 3, 1.5 by 3 | 2.3 |
|
||||
| 449 | 0.15.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 |
|
||||
| 453 | 0.15.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 |
|
||||
| 450 | 0.15.0 | | | **Add `do-epic <EPIC-KEY> --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 |
|
||||
| 466 | 0.15.0 | | | **Have stability-reviewer check each parser that splits a field on a separator against a value that holds the separator.** | 1 | 2 | 2 | 3 | 2 | 1.1 by 3 | 1.2 |
|
||||
| 454 | 0.15.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.16.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 |
|
||||
| 462 | 0.16.0 | | | **Run under `mutate-changes` the tests that today fail in mutmut's copy of the tree, so a mutant of a line only they cover is killed.** | 2 | 1 | 2 | 3 | 3 | code health by 3 | 4.7 |
|
||||
| 77 | 0.16.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 |
|
||||
| 196 | 0.16.0 | | decision | **Replay the architecture, principles, overrides and product-owner passes with `review-replay` on Opus 5.5 projects, record each run in the review-replay routing decision, and, where a run qualifies a rung, add back the code that lowers a pass to it.** | 2 | 2 | 3 | 5 | 2 | 1.4 by 3 | 1.2 |
|
||||
| 321 | 0.16.0 | 196 | decision | **Evaluate the review passes that run on a rung `review-replay` qualified, against the chunks before them, and revert any pass whose findings or later fixes worsened.** | 1 | 2 | 1 | 2 | 2 | 1.1 by 3, 1.4 by 2 | 2.0 |
|
||||
| 273 | 0.16.0 | | decision | **Re-tune the E + I steps of `REVIEW_STEPS` for 6 to 8 once 10 finished chunks have scored an E + I of 6 or more, from how well E + I orders their review rounds and 🔴 findings.** | 1 | 2 | 2 | 3 | 2 | 1.1 by 2, 1.4 by 3 | 2.0 |
|
||||
| 268 | 0.16.0 | | | **End a run whose release is ready to cut with a notice on loop-claude's terminal, in place of an interrupt that waits for an answer.** | 2 | 2 | 3 | 5 | 3 | 1 by 5 | 1.9 |
|
||||
| 445 | 0.16.0 | | | **Refuse a plan that holds an item a `Finish item <ID>` commit already removed, so a merge resolution cannot bring a finished item back.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 3, 1.1 by 2 | 1.8 |
|
||||
| 171 | 0.16.0 | | decision | **Group the routing figures' review rounds by the reviewers' rung as well as the worker's, so a call blames a rung only for rounds its own reviews raised.** | 3 | 2 | 2 | 5 | 4 | 1.2 by 3, 1.4 by 3 | 1.8 |
|
||||
| 300 | 0.16.0 | | owner | **Reach the comprehension floor: restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Locality and Self-sufficiency first; today the scoring run at a357cc7b scored Navigation 7.00, Locality 6.00, Shape 6.13, Self-sufficiency 6.00 and Overall 6.38.** | 4 | 2 | 3 | 7 | 8 | code health by 8 | 1.7 |
|
||||
| 264 | 0.16.0 | | | **Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 5 | 1.7 |
|
||||
| 323 | 0.16.0 | | | **Count a release review as landed once its pull request has merged, whatever its commits are titled.** | 3 | 2 | 3 | 6 | 3 | 1.4 by 3, 1.5 by 2 | 1.7 |
|
||||
| 342 | 0.16.0 | | | **Research the tooling agents read, search and run commands with once more, and file an item for each tool that cuts tokens a replay shows keep quality.** | 1 | 2 | 1 | 2 | 3 | 1.4 by 3, 1.5 by 2 | 1.7 |
|
||||
| 149 | 0.16.0 | | decision | **Fill each release by priority up to a capacity it states, in place of the bar, and move what does not fit to a later release.** | 4 | 2 | 3 | 7 | 5 | 1.1 by 7 | 1.6 |
|
||||
| 165 | 0.16.0 | | | **Make this repo's tests assert the facts a prompt or help text carries in place of its sentences, and drop the tests that scan source or assert a constant.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 4, 1.4 by 3 | 1.6 |
|
||||
| 392 | 0.16.0 | | owner | **Group bin/'s packages by concern into seven folders (plan, records, integrations, loop, review, forge and host), so a newcomer finds a tool's neighbours in one place.** | 3 | 1 | 3 | 5 | 7 | code health by 4 | 1.6 |
|
||||
| 456 | 0.16.0 | | | **Make the child-shell stop test pass under load, so a full test run doesn't fail on a race.** | 2 | 2 | 2 | 4 | 2 | 1.1 by 2, 1.5 by 2 | 1.6 |
|
||||
| 151 | 0.16.0 | | decision | **Keep 10 to 20 settled decisions per project as its goals' test set, and rerun them after a goal changes.** | 3 | 2 | 2 | 5 | 5 | 1.2 by 7 | 1.6 |
|
||||
| 68 | 0.16.0 | | principle | **Test `workflow-bench/compare.py`'s blinding and `bench.py`'s run plan.** | 2 | 1 | 1 | 2 | 4 | 1.1 by 5 | 1.5 |
|
||||
| 102 | 0.16.0 | | | **Give loop-claude's retry delay, and the file it reads the machine's memory from, environment overrides, so the black-box test stops replacing `time.sleep` and `machine_load.memory.MEMINFO` through `sitecustomize`.** | 1 | 1 | 2 | 2 | 3 | 1.1 by 4 | 1.5 |
|
||||
| 135 | 0.16.0 | | | **Fingerprint only the modules loop-claude imports, so editing another tool's code no longer reloads a running loop.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 4 | 1.5 |
|
||||
| 443 | 0.16.0 | | | **Measure whether compacting a waiting worker's session cut the cost of 20 chunks with an interrupt, with quality holding.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 4 | 1.4 |
|
||||
| 5 | 0.16.0 | | decision | **Key a project on its checkout's full path, and refuse to start while another session uses that key.** | 4 | 2 | 3 | 7 | 5 | 1.1 by 6 | 1.4 |
|
||||
| 291 | 0.16.0 | | owner | **Let `principles/technical-principles.md` → "Sane defaults" allow a library whose README goals ask that it work with no config to default the clock and randomness in its public constructor, where a documented option overrides each.** | 1 | 2 | 3 | 4 | 1 | 1.2 by 3 | 1.3 |
|
||||
| 156 | 0.16.0 | | decision | **Drop `rank_todo.py`'s ranking of an old-shape table once no project under `~/code` holds one.** | 2 | 1 | 3 | 4 | 4 | 1.1 by 4 | 1.2 |
|
||||
| 388 | 0.16.0 | | | **Refuse an agent's Write or Edit of a routing ladder file in rule-hook, since a change to the ladder is the human's.** | 1 | 1 | 3 | 3 | 2 | 1.2 by 3 | 1.2 |
|
||||
| 365 | 0.16.0 | | | **Have `score-outcomes` read the finished and dropped items of a plan outside the checkout, from the project repo's history or from Jira's issue changelogs.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 |
|
||||
| 368 | 0.16.0 | | | **Call a release review due, call a release ready to cut, and tell whether a chunk owes a scoring run, for a plan outside the checkout, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 |
|
||||
| 260 | 0.16.0 | | decision | **Compare the first 20 chunks whose worker got the reading rule with the 20 before them, on review rounds past each pass's first, unfinished verdicts, 🔴, 🟡 and misread findings, dollars and hours per chunk, and drop the rule where any rose.** | 1 | 2 | 1 | 2 | 2 | 1.4 by 3 | 1.2 |
|
||||
| 309 | 0.16.0 | | | **Run a scoring run's second pass on one head with two seats in place of four, once `larv-review agreement` shows the seats agree with each other more than a run agrees with its rerun.** | 2 | 2 | 2 | 4 | 2 | 1.4 by 3 | 1.2 |
|
||||
| 51 | 0.16.0 | | principle | **Hand loop-claude's terminal output to an injected effect, so no storage or retry function prints.** | 2 | 1 | 3 | 4 | 5 | 1.1 by 5 | 1.1 |
|
||||
| 419 | 0.16.0 | | | **Run the external auto-reviewer until its review of the PR's head has no findings, and answer each of its threads on the PR.** | 3 | 2 | 3 | 6 | 5 | 1.1 by 5 | 1.1 |
|
||||
| 444 | 0.16.0 | | | **Rank an epic item that is split by repo, by the goals of each repo its sub-tasks name.** | 2 | 2 | 2 | 4 | 3 | 1 by 3 | 1.1 |
|
||||
| 366 | 0.16.0 | | | **Count the chunks of a project whose plan sits outside the checkout in the routing figures, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.4 by 2 | 1.1 |
|
||||
| 201 | 0.16.0 | | owner | **Save the human's tmux setups and restore them after a reboot, so work is up and running again quickly.** | 3 | 2 | 1 | 4 | 4 | 1.5 by 4 | 1.1 |
|
||||
| 267 | 0.16.0 | | | **Keep waiting when an interrupt gets an empty answer, at the terminal or in the claude opened for it, in place of stopping the loop.** | 2 | 1 | 3 | 4 | 2 | 1.5 by 3 | 1.1 |
|
||||
| 4 | 0.16.0 | | | **Name each chunk's archive folder by the chunk's start time, so `<key>/` lists chunks in the order they ran.** | 3 | 2 | 3 | 6 | 3 | 1.1 by 3 | 1.1 |
|
||||
| 324 | 0.16.0 | | | **Count in the routing figures the finished chunks whose worker wrote no `Chunk items:` line.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 2, 1.4 by 1 | 1.1 |
|
||||
| 187 | 0.16.0 | | | **Count the tokens a worker spends reading reviewers' reports, so goal 1.4's signal shows whether report files lowered what a review costs the worker's context.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 3 | 1.0 |
|
||||
| 266 | 0.16.0 | | | **Move the chunks archived under the key `home/lilleman/.claude` to the key `claude-config`, so the routing figures and `score-outcomes` count this repo's chunks as one project.** | 3 | 2 | 2 | 5 | 3 | 1.4 by 3 | 1.0 |
|
||||
| 339 | 0.16.0 | | | **Lower the reading cost of the files a chunk reads most before its first commit.** | 2 | 2 | 1 | 3 | 3 | 1.4 by 3 | 1.0 |
|
||||
| 341 | 0.16.0 | | | **Hand each worker's claude a lower Read limit through `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`, kept only where replays of the archived review rounds find what two unchanged replays find.** | 2 | 2 | 3 | 5 | 3 | 1.4 by 3 | 1.0 |
|
||||
| 181 | 0.16.0 | | principle | **Have the test of a quoted answer's step-up assert the stepped rung's facts as literals, not through `prompts.rungs_held`.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 0.9 |
|
||||
| 193 | 0.16.0 | | | **Narrow `numbered`'s mark to `Mark` by a typed lookup in place of `typing.cast`, so a mark added to the regex but not the lookup fails at run time, and one added to the lookup but not `Mark` fails mypy.** | 1 | 1 | 3 | 3 | 1 | 1.1 by 2 | 0.9 |
|
||||
| 194 | 0.16.0 | | | **Make `test_waits_out_a_usage_limit_which_ends_a_run_of_failures` expect a usage-limit wait independent of the wall-clock time that passes during the run.** | 1 | 1 | 1 | 1 | 1 | 1.1 by 2 | 0.9 |
|
||||
| 298 | 0.16.0 | | | **Send the judge only the decision entries and the transcript tail a verdict needs, and keep the cut only where `judge-replay` changes no verdict kind.** | 3 | 3 | 3 | 7 | 4 | 1.4 by 2, 1.5 by 1 | 0.9 |
|
||||
| 265 | 0.16.0 | | | **Archive each wait that costs a chunk wall time, for a usage limit, low memory, a failed worker start or a heavy slot, with its start and end stamps, so goal 1.5's hours split waiting from work.** | 3 | 2 | 2 | 5 | 4 | 1.5 by 3 | 0.8 |
|
||||
| 395 | 0.16.0 | | decision | **Keep each block a save didn't change, with its localId, and the spacing paragraphs beside it as Jira or Confluence holds them.** | 3 | 2 | 2 | 5 | 5 | 1.6 by 4 | 0.8 |
|
||||
| 425 | 0.16.0 | | | **Show on loop-claude's terminal why it doesn't start a chunk beside the next item, as chunk-preflight prints it.** | 1 | 1 | 2 | 2 | 2 | 1.5 by 2 | 0.7 |
|
||||
| 169 | 0.16.0 | | | **Have rule-hook's `todo-rank-check` catch a `todo.md` that the same Bash call edits and then commits.** | 3 | 1 | 3 | 5 | 3 | 1.1 by 2 | 0.7 |
|
||||
| 447 | 0.16.0 | | | **Stop a headless claude call that runs past a time limit, and report it as a failure, so a hung judge or stuck check can't hold the loop.** | 2 | 2 | 2 | 4 | 3 | 1.5 by 2 | 0.7 |
|
||||
| 367 | 0.16.0 | | | **Check that every write to a Jira plan leaves it ranked, as rule-hook's `todo-rank-check` checks `todo.md` today.** | 2 | 2 | 3 | 5 | 3 | 1.6 by 2 | 0.7 |
|
||||
| 423 | 0.16.0 | | | **Skip the judge's model call on a worker's final message that the offline classifier decides is finished.** | 3 | 3 | 3 | 7 | 5 | 1.4 by 2 | 0.4 |
|
||||
| 197 | 0.16.0 | | | **Let the human edit what they type at loop-claude's terminal questions with the arrow keys, so Left moves the cursor in place of printing `^[[D`.** | 2 | 2 | 3 | 5 | 2 | 1.5 by 1 | 0.4 |
|
||||
| 1 | 0.17.0 | | question | **Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.** | 1 | 2 | 1 | 2 | 1 | | 0.0 |
|
||||
| 397 | 0.17.0 | | owner | **Script each step that the chunks of releases 0.10.0 to 0.16.0 repeated by hand and a program can compute, filing one item per step, and file this audit again for the next release.** | 1 | 2 | 1 | 2 | 2 | 1.4 by 3, 1.5 by 3 | 2.3 |
|
||||
|
||||
## Details
|
||||
|
||||
### 460. 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.
|
||||
|
||||
The fix shipped without any larv-review pass, reviewer or comprehension check, at lilleman's request on 2026-11-19, so loop-claude could run unattended again: PR #641, commit "Let the judge quote the worker's task as evidence". Before it, the judge read the task above the transcript's tail but `quotes_checked` checked the evidence only against that tail. Once a session outgrew the tail, a verdict quoting the task, such as `Do the next chunk in 0.13.0`, was rejected three times running, and the loop exited after each merged chunk (items 448, 455 and 451). `Grounds` now carries the task, and the evidence must appear in the task, then the tail.
|
||||
|
||||
Run the passes the change fires: security, stability (with `~/.claude/rules/this-machine/cross-repo-review.md` where it applies), prose for the comments and docstrings it changed, and overrides if `rule-hook overrides` prints a line. Run the comprehension check where `larv-review` says one is due. Also weigh whether the evidence schema's description ("a verbatim quote of the one transcript passage") should name the task too, and whether `misquoted_evidence`'s message should say "the task or the transcript".
|
||||
|
||||
Touches:
|
||||
- `bin/agent_cycle/judge.py`: `Grounds` (small), `quotes_checked` (small), `judge_prompt` (small)
|
||||
- `bin/judge_replay/archived_prompt.py`: `grounds_of` (small)
|
||||
- `bin/agent_cycle/test_judge.py`
|
||||
- `bin/judge_replay/test_judge_replay.py`
|
||||
|
||||
### 452. 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.
|
||||
|
||||
do-epic counts an issue as done only where Jira's status category is done, and moves a finished chunk's issue to done itself, by `jira-finish-transition`. On a team whose CI moves issues through the workflow, both are wrong. On TW, CI moves an issue to Code Review when its pull request opens, to Release Ready when it merges, and to Done when it is deployed. So do-epic would move an issue to Done before it is deployed, and would hold every blocked issue until the blocker is deployed, though the team wants blocked work to start once the blocker's pull request merges.
|
||||
|
||||
- Settings in do-epic's config.toml name the statuses at which an issue unblocks the issues it blocks, such as `jira-unblock-statuses = ["Release Ready", "Done"]`; without them, Jira's done category counts, as today.
|
||||
- A setting says which moves the team's workflow makes on its own, so do-epic makes none of them. With the setting, a finished chunk moves no status and stops with no reason; `jira-finish-transition` then only closes the epic.
|
||||
- The epic's finishing waits until every issue is in Jira's done category, so release reviews follow the deploy.
|
||||
- `--status` names the status an issue waits to reach.
|
||||
|
||||
Touches:
|
||||
|
||||
- `bin/do_epic/config.py`: `DoEpicConfig`, `load`
|
||||
- `bin/do_epic/backend/protocol.py`: `EpicIssue` (small)
|
||||
- `bin/do_epic/backend/jira.py`: `found_of` (small), `finish_issue`
|
||||
- `bin/do_epic/scheduler.py`: `open_blockers`
|
||||
- `bin/do_epic/main.py`: `handed_on`, `split_items_closed`
|
||||
- `bin/do_epic/finish.py`: `due` (small), `still_open` (small)
|
||||
- `bin/do_epic/status.py`: `lines` (small)
|
||||
- `bin/do_epic/test_scheduler.py`
|
||||
- `bin/do_epic/test_main.py`
|
||||
- `bin/do_epic/backend/test_jira.py`
|
||||
- `README.md`: `### Set up a project` (small)
|
||||
|
||||
### 449. 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.
|
||||
|
||||
do-epic writes its own spelling into a team's Jira: a pick as `repo:core-4` and a sub-task's summary as `[core-4] <the item's summary>`. A team with its own convention, such as TW's label `core-4` and summary `core-4: Bygg …` with a capital after the colon, then finds two labels on each issue and summaries in a shape its board doesn't use. Goal 1.6 asks the loop to fit the tracker's conventions, not change them.
|
||||
@@ -132,22 +94,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.
|
||||
@@ -166,25 +112,6 @@ Touches:
|
||||
- `bin/do_epic/backend/test_jira.py`
|
||||
- `README.md`: `### Set up a project` (small)
|
||||
|
||||
### 457. Keep loop-claude from starting a chunk for an item whose pull request is ready and awaits a person's merge under `merge = "human"`.
|
||||
|
||||
Under `merge = "human"`, `chunk-pr merge` leaves a chunk's pull request ready, with its item finished only on the branch. Until a person merges it, the default branch's plan still holds the item, so `chunk-preflight` names it as the next item again. loop-claude then starts a cycle that can only run `chunk-pr merge` once more and end, and it does so every cycle until the merge.
|
||||
|
||||
- `chunk-preflight` passes over an item whose branch has an open pull request that isn't a draft, where the project's config sets `merge = "human"`, and says so in its facts.
|
||||
- Where every remaining item of the release waits like that, loop-claude stops and says which pull requests await a merge.
|
||||
- Once the pull request is merged, the next chunk's preflight runs `chunk-pr clean` for the worktree it left, or tells the worker to.
|
||||
- Under `merge = "human"`, `chunk-pr merge --finish` finishes a plan kept in Jira, or a plan or changelog kept in the config's folder, at once, before the person merges; where the pull request is closed unmerged, the item stays finished. Settle whether loop-claude finishes such an item only after the merge.
|
||||
- Under loop-claude nobody answers a reviewer's comment on a pull request that awaits a person's merge, since the chunk's run has ended. Settle who does, or say in README that the person asks for it.
|
||||
|
||||
Touches:
|
||||
|
||||
- `bin/chunk_preflight/main.py`
|
||||
- `bin/chunk_preflight/facts.py`: `item_lines`, `pulls_text`
|
||||
- `bin/chunk_preflight/test_chunk_preflight.py`
|
||||
- `bin/chunk_pr/main.py`: `levelled_and_finished`, `finished` (small)
|
||||
- `bin/chunk_pr/test_chunk_pr.py`
|
||||
- `README.md`: `### Set up a project` (small)
|
||||
|
||||
### 450. Add `do-epic <EPIC-KEY> --dry-run`, which prints every Jira write planning would make and each chunk that would start, and makes none of them.
|
||||
|
||||
`do-epic <EPIC-KEY>` writes to Jira before it starts any chunk: labels, sub-tasks, comments on a team's issues and a new backlog order. A person has no way to see those writes before they happen, so the first run on a team's epic is a gamble, and the writes can't be taken back in one step. On TW-13503 the first run would have filed duplicate sub-tasks and posted comments to the team.
|
||||
@@ -203,12 +130,12 @@ 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.
|
||||
### 466. Have stability-reviewer check each parser that splits a field on a separator against a value that holds the separator.
|
||||
|
||||
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.
|
||||
An outside reviewer found that an importer split a full address on its separator and took the last part as the leaf, though the leaf itself may hold the separator; the importer's own test fixture held such a value, and each such row was dropped with only a log line. Our stability pass read the function and its tests and didn't raise it, and no deterministic tool covers it: the mutation tool does not mutate that language, and a mutant would not show a wrong split. Add one line to the stability reviewer's checks: where the change splits text on a separator or strips a suffix, look in the fixtures and a sample of the source data for a field that holds the separator, and report a row the parse then misplaces or drops.
|
||||
|
||||
Touches:
|
||||
- `skills/larv-review/standards/prose.md`
|
||||
- `agents/stability-reviewer.md`: `### 5. Edge Cases & Input Validation` (small)
|
||||
|
||||
### 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.
|
||||
|
||||
@@ -239,6 +166,12 @@ Touches:
|
||||
- `bin/loop_effects/child_shells.py`: `stop` (small)
|
||||
- `bin/loop_claude/loop/usage.py`: `HELP` (small)
|
||||
|
||||
### 462. Run under `mutate-changes` the tests that today fail in mutmut's copy of the tree, so a mutant of a line only they cover is killed.
|
||||
|
||||
Found while shipping item 461: `mutate-changes` printed `23 mutants on changed lines, 18 not killed. Left out the tests that fail without a mutant, in do_epic/test_main.py, larv_review/test_larv_review.py, larv_review/test_scoring_setup.py, plan/test_ranking.py, repo_checks/…, review_rules/test_review_passes.py, review_rules/test_reviewer_context.py, rule_hook/test_rule_hook.py, test_settings_filter.py`. All 18 survivors were in `bin/larv_review/scoring_setup.py`: `prepare_scoring`, whose tests are among those left out, so the chunk checked four of them by hand and left 14 unchecked. Find why each left-out test fails in mutmut's copy, such as a path to `skills/` or a git checkout it expects, and make it pass there, or report under the count which changed lines no remaining test covers.
|
||||
|
||||
Touches `bin/mutate_changes/`, and the tests named above.
|
||||
|
||||
### 77. 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.
|
||||
|
||||
2026-10-08, lilleman: no metric enters review until a rerun on more data shows it tracking the panel.
|
||||
@@ -297,26 +230,30 @@ Have the gate, or `rank_todo.py --check` where it runs in a checkout, refuse a p
|
||||
|
||||
Raised by the goals audit of PR #296. `bin/routing_figures/calls.py` groups a chunk's review rounds by the rung its worker started on, and calls for a routing change when a lower rung took more of them. Since PR #296 the reviewers may run above the worker's rung, on the one their item's E + I picks, and no figure groups rounds by it, though the archived worker line names the E + I it follows from. A cheap worker on an item of high E + I gets stronger reviewers, who may raise more rounds, and a call could then blame the worker's rung for them: an interrupt of lilleman that settles nothing (goal 1.2).
|
||||
|
||||
### 300. Reach the comprehension floor: restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Self-sufficiency first; today the scoring runs at 81e8d8a1 scored Navigation 7.13 and 6.75, Locality 6.38 and 5.63, Shape 6.25 and 5.88, Self-sufficiency 5.88 and 5.25, and Overall 6.50 and 5.88.
|
||||
### 300. Reach the comprehension floor: restructure the places the comprehension seats found hardest to follow, so the project reads at 7.0 or above on every dimension, Locality and Self-sufficiency first; today the scoring run at a357cc7b scored Navigation 7.00, Locality 6.00, Shape 6.13, Self-sufficiency 6.00 and Overall 6.38.
|
||||
|
||||
Filed by the comprehension check of PR #473 at 13d1550 (`larv-review record-scoring`), which printed `Floor:` and `Next:`, and refreshed from the two runs of PR #633 at 81e8d8a1. The lowest mean is Self-sufficiency: 5.88 in the first run and 5.25 in the second. Every seat says the same thing: the vocabulary lives only in `CLAUDE.md` → "Vocabulary", the why of thresholds and orderings sits behind `docs/decisions.md → …` pointers, and behaviour lives in prose that no code ties to its check. Locality follows, at 6.38 and 5.63: scheduling state lives in tmux window names, state files and flocks across three packages. Refresh this item's places and aim from the newest run before the chunk starts; do not file a second floor item.
|
||||
Filed by the comprehension check of PR #473 at 13d1550 (`larv-review record-scoring`), which printed `Floor:` and `Next:`, and refreshed from the run of PR #646 at a357cc7b. The lowest means are Locality and Self-sufficiency, both 6.00. Locality: do-epic's parking and scheduling carry order-dependent state across loop turns, state files and flocks, and no code enforces the order. Self-sufficiency: the why of thresholds and orderings sits behind `docs/decisions.md → …` pointers, 109 of them in 79 modules, and the review rules live in prose that several code sites repeat. Refresh this item's places and aim from the newest run before the chunk starts; do not file a second floor item.
|
||||
|
||||
Aim: one ambitious refactor of the areas below, sized so every mean reaches 7.0 on the chunk's own scoring run. Where a place is already easier to read when the chunk starts, drop it.
|
||||
|
||||
Places the seats named, hardest first (`larv-review places`), Self-sufficiency first:
|
||||
Places the seats named, hardest first (`larv-review places`), Locality and Self-sufficiency first:
|
||||
|
||||
- Self-sufficiency, Locality: `bin/agent_cycle/routing.py:115` `unfinished_route`, with `:131` `escalated_route`: five rungs, a count and the escalation mark held at once. The module table resolves the what, but the why of the caps is only in the decision log. Every seat in both runs named it.
|
||||
- Self-sufficiency: `bin/agent_cycle/judge.py:235` `quotes_checked`, with `:23` `INTERRUPT_RULES` and `:76` `TASK_HEADING`: six quote kinds fail differently, the prompt is behaviour no code checks, and `TASK_HEADING` is silently an archive format. Seven seats named it.
|
||||
- Self-sufficiency: `bin/rule_hook/rules.py:27` `RULES`: each rule's only specification is one long English sentence, such as `env-file-read`, and its check lives in a sibling module that nothing ties it to. Five seats named it.
|
||||
- Self-sufficiency, Locality: `skills/larv-review/SKILL.md:89` "Round cap" and `:97` "Re-entry", with `bin/review_rules/review_passes.py:8` `PASS_AGENTS`: rules with exceptions to exceptions, a cap spread over three packages and this prose, and code constants that must match sentences here.
|
||||
- Locality: `bin/do_epic/main.py:283` `parked_through`: a polling loop with four mutable locals across three result types, and a crash-ordering invariant across a state file, a window name and Jira. Five seats named it; two would least want to change it.
|
||||
- Locality: `bin/do_epic/scheduler.py:136` `start_chunks`, with `bin/loop_claude/loop/chunk_windows.py:107` `may_start`: overlapping window sets from two stores feed an elif chain under nested flocks, with the tmux state's schema in `agent_cycle/tmux.py:92` `as_listed`.
|
||||
- Locality: `bin/chunk_pr/main.py:429` `levelled_and_finished`: a load-bearing order held together by one-liners where a Failure's truthiness carries the control flow.
|
||||
- Locality, Shape: `bin/agent_cycle/run.py:150` `rule`, with `:32` `Cycle` and `:240` `close`: a 16-field value, very long single-line expressions, and an archive-before-step-up order that only reading order tells.
|
||||
- Locality: `bin/do_epic/main.py:11` imports, with `bin/loop_claude/loop/reload.py:18` `LoopRun`: do_epic reaches into eight loop_claude modules over a wire format a renamed field breaks.
|
||||
- Shape, Navigation: `bin/agent_cycle/verdicts.py:1`, `bin/loop_claude/cycle/` and `bin/loop_state/paths.py:6`: stale `cycle.` names, and folders whose names mislead.
|
||||
- Locality: `bin/project_config/settings.py:182` `load`: one list encodes the whole validation matrix.
|
||||
- Shape: `bin/agent_cycle/stuck_workers.py:52` `Watch.check`: the condition at line 59 mixes `or` and `and` without parentheses over dicts mutated across ticks.
|
||||
- Locality, Shape: `bin/do_epic/main.py:287` `parked_through`, with `:354` `resumed_news` and `:241` `chunk_run`: a three-step park and resume order, the `told`, `finished` and `news` flags and a poll that carries five locals across turns. The docstring gives the order, but no code enforces it and no comment states the loop's invariant. Three seats named it hardest; all three would least want to change it.
|
||||
- Locality, Self-sufficiency: `bin/agent_cycle/routing.py:115` `unfinished_route`, with `:131` `escalated_route`: five rungs, a count, the escalation mark and the cap held at once. The module table resolves the what, but the why of each threshold is only in the decision log. Three seats named it.
|
||||
- Locality: `bin/do_epic/scheduler.py:144` `start_chunks`: four overlapping sets feed a five-branch chain, counted under nested locks shared with loop-claude. Two seats named it.
|
||||
- Locality, Shape: `bin/rule_hook/round_cap.py:10` `round_cap_breaches`, with `bin/review_rules/round_titles.py:33` `round_counts`, `bin/larv_review/reviewer_header.py:75` `unanswered_round` and `skills/larv-review/SKILL.md:89` "Round cap": the cap lives in four places across three packages, none owns the whole invariant, and the rules exist a third time in the help at `bin/larv_review/main.py:1`. Three seats named it.
|
||||
- Shape, Self-sufficiency: `bin/project_config/settings.py:187` `load`: about twenty comprehension clauses in one `faults` list encode the rules that link settings; named predicates would make each findable. Two seats named it.
|
||||
- Locality, Shape: `bin/chunk_pr/main.py:314` `merged`, with `:447` `levelled_and_finished`: a queue loop whose variables carry a string or a Failure, and a scoring-run check the name doesn't suggest. Two seats named it.
|
||||
- Locality: `bin/plan/ranking.py:239` `score`, with `:144` `weigh`: the old and new table shapes run through the whole module. Two seats named it.
|
||||
- Locality: `bin/agent_cycle/judge.py:76` `TASK_HEADING`, with `bin/model_routing/route.py:47` and `bin/loop_claude/loop/reload.py:36` `decode_handed`: archive and handover formats that a reworded heading or a renamed field breaks, guarded only by comments. Three seats named one of them.
|
||||
- Shape: `bin/agent_cycle/judge.py:237` `quotes_checked`, with `bin/agent_cycle/run.py:150` `rule`: checks that quietly turn one verdict type into another, and one function that runs the judge, steps up and orders the archive writes.
|
||||
- Locality: `bin/larv_review/plan.py:21` `Emptied`: a `str` subclass whose type carries meaning, lost by any code that rebuilds the string.
|
||||
- Shape: `bin/do_epic/gates.py:42` `gate`: a long ordered chain where a missing value means something different on each line.
|
||||
- Shape: `bin/agent_cycle/stuck_workers.py:52` `Watch.check`: the condition at line 59 mixes `or` and `and` without parentheses over state mutated out of sight.
|
||||
- Self-sufficiency: `bin/agent_cycle/verdicts.py:41` and `bin/agent_cycle/run.py:103`: comments that cite `cycle.judge.re_ask_checked` and `close.py`, neither of which exists; `bin/agent_cycle/judge.py:116` `Rejected` names loop-claude in a module do-epic shares.
|
||||
- Navigation, Shape: `README.md:225` "Packages under bin/": 84 entries in alphabetical prose with no grouping by layer, two bullets run together at `:239`, and 40 packages whose `__init__.py` is empty.
|
||||
- Shape: `bin/loop_claude/loop/reload.py:18` `LoopRun`: loop-claude's core run state in a module named for self-reloading; `Run`, `ChunkRun` and `LoopRun` are one concept in three types.
|
||||
- Locality: `reviewer-merge-trials/driver.py:4`: a frozen trial imports live code under `bin/`, so a refactor there breaks a record.
|
||||
|
||||
### 264. Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars.
|
||||
|
||||
@@ -569,6 +506,8 @@ Found by review of PR #317. The black-box test, `bin/loop_claude/test_black_box.
|
||||
|
||||
153 `Judge cost:` entries total $109.76, a median of about $0.76 a verdict at every rung, and the cost follows the size of the records, not the transcript: about 76k characters in log and 188k in claude-config. In 224 of 251 recent verdicts (89%) the evidence sits in the worker's final message. A missed interrupt is the costly error, so the bar is zero changed interrupts and zero new rejections across the replay. The judge is about 4.5% of dollars, so the saving is small; each cycle also gets faster.
|
||||
|
||||
On 2026-11-20, with docs/decisions.md read once, claude-config's records take 285,754 characters. With a short task they leave the transcript about 107,500 of the judge's 400,000 characters, some 57,500 above the 50,000 it must read. The decision log grows about 4,000 characters a day, so the judge stops on claude-config, naming the shortfall, in about two weeks unless this item ships first.
|
||||
|
||||
Touches:
|
||||
- `bin/agent_cycle/judge.py`: `Brief`, `judge_prompt`, `JUDGE_PROMPT_CHARS`
|
||||
- `bin/chunk_driver/project/records.py`: `read_records`
|
||||
@@ -636,7 +575,7 @@ It lives under `~/.claude`, which `.gitignore` keeps from the remote, so a lost
|
||||
|
||||
The README line covers the bench's transcripts in `workflow-bench/logs/` too (goal 3).
|
||||
|
||||
### 397. Script each step that the chunks of releases 0.10.0 to 0.15.0 repeated by hand and a program can compute, filing one item per step, and file this audit again for the next release.
|
||||
### 397. Script each step that the chunks of releases 0.10.0 to 0.16.0 repeated by hand and a program can compute, filing one item per step, and file this audit again for the next release.
|
||||
|
||||
lilleman asked, on 2026-10-16, for a standing audit each release, so the loop keeps moving work a program does as well from the model to scripts (goals 1.4 and 1.5). This audit reads the archived transcripts of the chunks that shipped releases 0.10.0 to 0.14.0 for every step that chunks repeated by hand, before, during or after review. It keeps the steps whose answer a program computes the same way each time, such as a lookup, a check, a prompt assembled for a reviewer, a cleanup. File one item per such step, with the time and tokens it cost, into the next release with items left. Leave a step that needs judgement with the model. Run `command-patterns <version>` first for each of 0.10.0 to 0.14.0; each run's table is the audit's starting point. `read_threads` and `calls` in `bin/command_patterns/tally.py` open the calls of one pattern, or `command-patterns <version> --calls <file>` dumps them all as JSON lines. The 0.7.0 audit found that most steps its chunks repeated were already scripted by that release's own tools, so a step a shipped item already covers is not filed.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user