Compare commits
42 Commits
v0.15.0
...
5c433ecc9f
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c433ecc9f | |||
| 9879d8ee67 | |||
| 56a82245ad | |||
| fa2ead69c9 | |||
| 4dd8b73054 | |||
| 83194a11a5 | |||
| ba50eacafe | |||
| cc23e80fb8 | |||
| b7993aaf93 | |||
| cfe537b3fd | |||
| 9fe060575b | |||
| 0bf87b736e | |||
| 21200cb698 | |||
| b490545439 | |||
| 4e97930528 | |||
| 5b61b47603 | |||
| 6322c6e18e | |||
| 8830dc6cdf | |||
| 005bcacbb2 | |||
| bd9d9f508b | |||
| a40eafa336 | |||
| e25b4fc401 | |||
| 98754352e5 | |||
| e47e71167b | |||
| ab08c3c238 | |||
| a95dd360c8 | |||
| b65710dca7 | |||
| 4612f71592 | |||
| f5a691ff07 | |||
| f9f96f69ae | |||
| 0b6cc71520 | |||
| 72c481696d | |||
| 5b792514a4 | |||
| e38b6c344b | |||
| 993295b486 | |||
| e687860824 | |||
| 82511b3d0f | |||
| f45e06fe9d | |||
| e8c123ced0 | |||
| 16d9b3a059 | |||
| 5c3ac81ed7 | |||
| 378dafeef3 |
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
- `task-bench`'s table prints the mean of the bugs' own head/base changes as its All change, in place of the change of the two All rows' medians, which swung up to three times as far in tokens. The All rows per side stay, so the change row is no longer their difference, and a change from before 0.15.1 can't be compared with one from after it.
|
||||||
|
- `task-bench` now stops with a Failure on a run whose final result says `terminal_reason: "api_error"`, even where it holds no `api_error_status`, so a token the API refuses no longer lets the bench run on for hours with empty runs.
|
||||||
|
- `task-bench`'s `--help` now says how far a bench of a commit against itself swings, in 19 cases of 20, with the default 5 bugs and 5 runs, and that a Gremlins run on a large project needs 16 GB of memory.
|
||||||
|
- When `task-bench` can't copy, read or write a file in the middle of a bench, it now names that file and still prints the table of the runs that finished, where 0.15.0 lost them all behind `could not write under <folder>`.
|
||||||
|
|
||||||
## 0.15.0
|
## 0.15.0
|
||||||
|
|
||||||
- `task-bench` writes `digest.md`, with each bug's decoys and up to two traces of its runs, and `task-bench gather` starts a claude on the project's rung that files a plan item for each place the digest shows to be hard, then removes the bench's folder. Each bench removes the folders earlier benches left, and `compress-archives` leaves lock files alone.
|
- `task-bench` writes `digest.md`, with each bug's decoys and up to two traces of its runs, and `task-bench gather` starts a claude on the project's rung that files a plan item for each place the digest shows to be hard, then removes the bench's folder. Each bench removes the folders earlier benches left, and `compress-archives` leaves lock files alone.
|
||||||
|
|||||||
@@ -243,10 +243,10 @@ 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`.
|
- `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`.
|
- `deploy_release` imports `release_plan`'s `release_standing`.
|
||||||
- `do_epic/` holds `do-epic`, the tool that drives one Jira epic:
|
- `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`.
|
- `main.py` starts the epic's chunks and runs one chunk's cycles in its window, through `agent_cycle`. `epic_run.py` holds what stays the same through one run of do-epic, such as its config, its Jira store and its paths, and starts the chunks that may start now.
|
||||||
- `planning.py` settles, before the chunks start, where each open issue is worked, its scores and the order the issues start in, through `split.py`, `repo_pick.py`, `issue_scores.py` and `ranking.py`.
|
- `planning.py` settles, before the chunks start, where each open issue is worked, its scores and the order the issues start in, through `split.py`, `repo_pick.py`, `issue_scores.py` and `ranking.py`.
|
||||||
- `scheduler.py` says which issues run now: as many as the epic's cap and each repo's `parallel-chunks` allow, and none in a repo where loop-claude runs chunks.
|
- `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.
|
- `gates.py` reads once whether a chunk's pull request waits on its checks, an approval or a new review, and `parked.py` keeps each chunk that does in a state file, so it takes no running slot while it waits and goes on waiting after a reboot. `parking.py` parks such a chunk after a cycle and polls the gate until its worker has something to do.
|
||||||
- `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`.
|
- `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.
|
- `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`.
|
- `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`.
|
||||||
@@ -261,7 +261,8 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
|
|||||||
- `git_cli/` runs git for every tool (`git_repo.py`), reads the git calls in a shell command (`git_command.py`), and keeps an epic's working branch level with the default branch (`epic_branch.py`).
|
- `git_cli/` runs git for every tool (`git_repo.py`), reads the git calls in a shell command (`git_command.py`), and keeps an epic's working branch level with the default branch (`epic_branch.py`).
|
||||||
- `judge_replay` imports `agent_cycle`'s judge and verdicts, and `chunk_driver`'s premises, records and `ANSWER_DESTINATIONS`.
|
- `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.
|
- `loop_claude` runs `chunk-preflight` as a process of its own.
|
||||||
- `loop_effects/` holds `Effects`: the processes, terminal, clock and git a tool reaches, injected so its tests can script them. loop-claude, do-epic, both replay tools and `reviewer-merge-trials`' driver use it.- `loop_state/` holds where loop-claude and do-epic keep their files (`paths.py`), which `rung_replay` reads too.
|
- `loop_effects/` holds `Effects`: the processes, terminal, clock and git a tool reaches, injected so its tests can script them. loop-claude, do-epic, both replay tools and `reviewer-merge-trials`' driver use it.
|
||||||
|
- `loop_state/` holds where loop-claude and do-epic keep their files (`paths.py`), which `rung_replay` reads too.
|
||||||
- `machine_load/` takes the machine's heavy slots, its shared lock files, for `run_heavy` and `adf_codec`, and reads the memory share that loop-claude waits for. It also gives `mutate_changes` a slot's CPU count.
|
- `machine_load/` takes the machine's heavy slots, its shared lock files, for `run_heavy` and `adf_codec`, and reads the memory share that loop-claude waits for. It also gives `mutate_changes` a slot's CPU count.
|
||||||
- `model_routing/` holds the shipped routing ladder (`routing-ladder.json`) and its steps (`ladder.py`), and reads a ladder from that file or a project's own (`ladder_file.py`), for loop-claude, `rule_hook`, `do_epic`, both replay tools and `subagent-rung`. It finds a project's config folder through `project_config`. It also holds the list prices, which `routing_figures` and `transcript_archive` read.
|
- `model_routing/` holds the shipped routing ladder (`routing-ladder.json`) and its steps (`ladder.py`), and reads a ladder from that file or a project's own (`ladder_file.py`), for loop-claude, `rule_hook`, `do_epic`, both replay tools and `subagent-rung`. It finds a project's config folder through `project_config`. It also holds the list prices, which `routing_figures` and `transcript_archive` read.
|
||||||
- `notifier/` sends the human a DM through the notifier a project's config names, for `notify` and for loop-claude through `loop_effects`. Its backends are `mattermost.py` and `slack.py`.
|
- `notifier/` sends the human a DM through the notifier a project's config names, for `notify` and for loop-claude through `loop_effects`. Its backends are `mattermost.py` and `slack.py`.
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ def archived_stop(project_archive: pathlib.Path, session: Session, task: str, ro
|
|||||||
|
|
||||||
|
|
||||||
def archived(project_archive: pathlib.Path, transcript_path: str, task: str, outcome: str, effects: Effects, judge_run: JudgeRun | None = None) -> Failure | None:
|
def archived(project_archive: pathlib.Path, transcript_path: str, task: str, outcome: str, effects: Effects, judge_run: JudgeRun | None = None) -> Failure | None:
|
||||||
"""transcript_archive.write.archive, stamped now and saying its notes through effects. A cycle and close.py, which has no Cycle, both archive through it."""
|
"""transcript_archive.write.archive, stamped now and saying its notes through effects. A cycle and chunk_driver.chunk_run.closed_cycle, which has no Cycle, both archive through it."""
|
||||||
return archive(project_archive, transcript_path, task, outcome, effects.now(), lambda text: say(text, effects), judge_run, replace=effects.replace_file)
|
return archive(project_archive, transcript_path, task, outcome, effects.now(), lambda text: say(text, effects), judge_run, replace=effects.replace_file)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Interrupt:
|
|||||||
# How many transcript entries the judge read, which escalation_mark.stamped stamps. An escalation the verdict carries moves the route's mark there. None means it was never stamped, and then its escalation doesn't step the worker.
|
# How many transcript entries the judge read, which escalation_mark.stamped stamps. An escalation the verdict carries moves the route's mark there. None means it was never stamped, and then its escalation doesn't step the worker.
|
||||||
entries_read: int | None = None
|
entries_read: int | None = None
|
||||||
judged: Judged = Judged()
|
judged: Judged = Judged()
|
||||||
# The [human] line from earlier in the chunk that answered the same question, and the words of it that leave the question open; empty for none. cycle.judge.re_ask_checked turns the Interrupt into an Unfinished where the question doesn't quote them.
|
# The [human] line from earlier in the chunk that answered the same question, and the words of it that leave the question open; empty for none. agent_cycle.judge.re_ask_checked turns the Interrupt into an Unfinished where the question doesn't quote them.
|
||||||
answered_before: str = ""
|
answered_before: str = ""
|
||||||
left_open: str = ""
|
left_open: str = ""
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,16 @@ def parse_entry(raw: str | bytes) -> Entry | None:
|
|||||||
return None if found is None else entry_from(found)
|
return None if found is None else entry_from(found)
|
||||||
|
|
||||||
|
|
||||||
|
def json_objects(raw: bytes) -> list[dict]:
|
||||||
|
"""The lines of a transcript or a stream-json stream that are JSON objects, parsed."""
|
||||||
|
return [found for line in raw.splitlines() if (found := json_object(line)) is not None]
|
||||||
|
|
||||||
|
|
||||||
|
def entries_of(raw: bytes) -> list[Entry]:
|
||||||
|
"""The entries of a transcript or a stream-json stream, one per line that is a JSON object."""
|
||||||
|
return [entry_from(found) for found in json_objects(raw)]
|
||||||
|
|
||||||
|
|
||||||
def entry_from(found: dict) -> Entry:
|
def entry_from(found: dict) -> Entry:
|
||||||
"""A transcript entry, or a stream-json event, as its kind."""
|
"""A transcript entry, or a stream-json event, as its kind."""
|
||||||
carried = Carried(uuid=field(found, "uuid"), parent_uuid=field(found, "parentUuid"), timestamp=field(found, "timestamp"), cwd=field(found, "cwd"), git_branch=field(found, "gitBranch"))
|
carried = Carried(uuid=field(found, "uuid"), parent_uuid=field(found, "parentUuid"), timestamp=field(found, "timestamp"), cwd=field(found, "cwd"), git_branch=field(found, "gitBranch"))
|
||||||
|
|||||||
@@ -99,6 +99,11 @@ class Parse(unittest.TestCase):
|
|||||||
self.assertEqual(entries.parse_entry('{"type": "user", "message": {"content": "do it"}}'), entries.HumanTurn(text="do it"))
|
self.assertEqual(entries.parse_entry('{"type": "user", "message": {"content": "do it"}}'), entries.HumanTurn(text="do it"))
|
||||||
self.assertIsNone(entries.parse_entry("[1, 2]"))
|
self.assertIsNone(entries.parse_entry("[1, 2]"))
|
||||||
|
|
||||||
|
def test_a_stream_parses_into_an_entry_per_line_that_is_a_json_object(self):
|
||||||
|
raw = b'{"type": "user", "message": {"content": "do it"}}\nnot json\n\n{"type": "summary"}\n{}\n'
|
||||||
|
self.assertEqual(entries.entries_of(raw), [entries.HumanTurn(text="do it"), entries.Entry(), entries.Entry()])
|
||||||
|
self.assertEqual(entries.entries_of(b""), [])
|
||||||
|
|
||||||
|
|
||||||
class EntryKinds(unittest.TestCase):
|
class EntryKinds(unittest.TestCase):
|
||||||
def test_names_who_wrote_each_user_entry_and_queued_prompt(self):
|
def test_names_who_wrote_each_user_entry_and_queued_prompt(self):
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
"""One run of do-epic on an epic (`EpicRun`), and how it starts the epic's chunks that may start now (`chunks_started`)."""
|
||||||
|
import dataclasses
|
||||||
|
import pathlib
|
||||||
|
import typing
|
||||||
|
|
||||||
|
from do_epic.config import DoEpicConfig
|
||||||
|
from loop_effects.effects import Effects, say
|
||||||
|
from do_epic.backend.protocol import EpicIssue, EpicStore
|
||||||
|
from do_epic.epic_record import EpicRecord
|
||||||
|
from failure import Failure
|
||||||
|
from do_epic import finish, planning, scheduler
|
||||||
|
from do_epic.repos import locate
|
||||||
|
from loop_state.paths import Paths
|
||||||
|
from forge.commands import Run, runner
|
||||||
|
from agent_cycle import tmux
|
||||||
|
|
||||||
|
# How often a parked chunk reads its pull request's gate, and a human task's window reads the epic: a person answers in hours, and each read is a few calls.
|
||||||
|
POLL_SECONDS = 60
|
||||||
|
|
||||||
|
|
||||||
|
@dataclasses.dataclass(frozen=True)
|
||||||
|
class EpicRun:
|
||||||
|
"""What stays the same through one run of do-epic on an epic."""
|
||||||
|
key: str
|
||||||
|
config: DoEpicConfig
|
||||||
|
store: EpicStore
|
||||||
|
record: EpicRecord
|
||||||
|
paths: Paths
|
||||||
|
env: typing.Mapping[str, str]
|
||||||
|
launcher: pathlib.Path
|
||||||
|
effects: Effects
|
||||||
|
# The runner of git's and the forge's commands in a folder.
|
||||||
|
forge_at: typing.Callable[[str], Run] = runner
|
||||||
|
|
||||||
|
@property
|
||||||
|
def session(self) -> str:
|
||||||
|
return tmux.session_name(tmux.EPIC, self.key)
|
||||||
|
|
||||||
|
|
||||||
|
def chunks_started(epic: EpicRun, issues: list[EpicIssue], own: str | None, told: str = "") -> scheduler.Started | Failure:
|
||||||
|
"""scheduler.start_chunks on the epic's issues, as read, in order of score, and its cap, read afresh; own is the issue of the chunk that asks, and told is the reason the planning just gave for stopping, which isn't said twice. Where no issue is open, the chunk to start is the epic's finishing, unless the epic is closed."""
|
||||||
|
due = finish.due(finish.landed(issues, epic.config.pull_merged_status))
|
||||||
|
closed = due and epic.store.closed()
|
||||||
|
if isinstance(closed, Failure):
|
||||||
|
return closed
|
||||||
|
order = planning.start_order(planned_epic(epic), issues)
|
||||||
|
if isinstance(order, Failure):
|
||||||
|
say(f"the issues of {epic.key} start in Jira's backlog order, since they cannot be put in order of score" + ("" if order.reason == told else f": {order.reason}"), epic.effects, stdout=True)
|
||||||
|
elif len(order) > 1:
|
||||||
|
say(f"by score, the issues of {epic.key} start in the order {', '.join(order)}", epic.effects, stdout=True)
|
||||||
|
scheduled = scheduled_epic(epic, () if isinstance(order, Failure) else tuple(order))
|
||||||
|
if isinstance(scheduled, Failure):
|
||||||
|
return scheduled
|
||||||
|
started = scheduler.start_chunks(scheduled, issues, due and not closed, own, epic.effects.tmux)
|
||||||
|
return started if isinstance(started, Failure) else dataclasses.replace(started, closed=closed)
|
||||||
|
|
||||||
|
|
||||||
|
def planned_epic(epic: EpicRun) -> planning.Planned:
|
||||||
|
"""The epic as planning reads and writes it."""
|
||||||
|
return planning.Planned(epic.key, epic.config, epic.store, epic.record, epic.paths.home, epic.effects)
|
||||||
|
|
||||||
|
|
||||||
|
def scheduled_epic(epic: EpicRun, order: tuple[str, ...]) -> scheduler.Epic | Failure:
|
||||||
|
"""The epic as scheduler limits its chunks: with its cap, read afresh, each repo's checkout, and the order its scored issues start in."""
|
||||||
|
cap = epic.record.parallel_chunks()
|
||||||
|
if isinstance(cap, Failure):
|
||||||
|
return cap
|
||||||
|
# The checkouts located so far, from whose remotes repos.locate tells where to clone a repo that is missing.
|
||||||
|
seen: list[pathlib.Path] = []
|
||||||
|
|
||||||
|
def located(name: str) -> tuple[pathlib.Path, int] | Failure:
|
||||||
|
found = locate(name, [checkout for checkout in seen], epic.config, epic.paths.home, epic.effects.git)
|
||||||
|
if isinstance(found, Failure):
|
||||||
|
return found
|
||||||
|
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, order, epic.config.unblocking)
|
||||||
|
|
||||||
|
|
||||||
|
def real(checkout: pathlib.Path) -> pathlib.Path:
|
||||||
|
"""The checkout as loop-claude names it, which is as git does: through no symlink or `..`. Each keys the checkout's lock and its chunks by that path, so a project config that spells it another way hides neither from the other."""
|
||||||
|
return checkout.resolve()
|
||||||
+75
-211
@@ -11,8 +11,9 @@ import typing
|
|||||||
|
|
||||||
from chunk_driver.cycle_start import announced_route, cycle_of, project_routing, routing_on
|
from chunk_driver.cycle_start import announced_route, cycle_of, project_routing, routing_on
|
||||||
from chunk_driver.claims import CHUNK_FLAG
|
from chunk_driver.claims import CHUNK_FLAG
|
||||||
from do_epic import chunk_prompt, dry_run, findings, finish, gates, human_tasks, parent_moves, parked, planning, scheduler, split, status
|
from do_epic import chunk_prompt, dry_run, findings, finish, human_tasks, parent_moves, planning, scheduler, split, status
|
||||||
from chunk_driver.chunk_run import ChunkRun, closed_cycle
|
from chunk_driver.chunk_run import ChunkRun, closed_cycle
|
||||||
|
from do_epic.epic_run import chunks_started, EpicRun, planned_epic, POLL_SECONDS, real
|
||||||
from do_epic.repo_pick import ClaudeWork, HumanTask, recorded, Repo
|
from do_epic.repo_pick import ClaudeWork, HumanTask, recorded, Repo
|
||||||
from project_config.main import located as config_located
|
from project_config.main import located as config_located
|
||||||
from chunk_driver.project.records import CONSEQUENCE, read_records
|
from chunk_driver.project.records import CONSEQUENCE, read_records
|
||||||
@@ -33,6 +34,7 @@ from text_files.markdown_text import listed
|
|||||||
from do_epic.repos import locate
|
from do_epic.repos import locate
|
||||||
from chunk_driver.this_loop import Loop
|
from chunk_driver.this_loop import Loop
|
||||||
from chunk_driver.project.model_choice import Models, overridden
|
from chunk_driver.project.model_choice import Models, overridden
|
||||||
|
from do_epic.parking import parked_through
|
||||||
from loop_state.paths import Paths
|
from loop_state.paths import Paths
|
||||||
from chunk_driver.project.premises import read_premises
|
from chunk_driver.project.premises import read_premises
|
||||||
from git_cli.git_repo import record_chunk_base
|
from git_cli.git_repo import record_chunk_base
|
||||||
@@ -78,8 +80,6 @@ ARCHIVE = ".claude/do-epic-transcripts"
|
|||||||
STATUS_FLAG = "--status"
|
STATUS_FLAG = "--status"
|
||||||
# The flag that prints what planning and the scheduler would do, without doing it.
|
# The flag that prints what planning and the scheduler would do, without doing it.
|
||||||
DRY_RUN_FLAG = "--dry-run"
|
DRY_RUN_FLAG = "--dry-run"
|
||||||
# How often a parked chunk reads its pull request's gate, and a human task's window reads the epic: a person answers in hours, and each read is a few calls.
|
|
||||||
POLL_SECONDS = 60
|
|
||||||
# A call to origin that levels an epic's working branch is stopped after this long, chunk-preflight's limit for the same calls: one that hangs would hold the chunk's running slot before any cycle, with nothing said.
|
# A call to origin that levels an epic's working branch is stopped after this long, chunk-preflight's limit for the same calls: one that hangs would hold the chunk's running slot before any cycle, with nothing said.
|
||||||
LEVEL_SECONDS = 60
|
LEVEL_SECONDS = 60
|
||||||
|
|
||||||
@@ -92,25 +92,6 @@ def jira_backend(config: DoEpicConfig, key: str) -> tuple[EpicStore, EpicRecord]
|
|||||||
return JiraEpic(epic, config.env_file, finish=config.finish, finding_type=config.finding_type, review_type=config.review_type, start=config.start), EpicRecord(EpicDescription(epic, config.env_file))
|
return JiraEpic(epic, config.env_file, finish=config.finish, finding_type=config.finding_type, review_type=config.review_type, start=config.start), EpicRecord(EpicDescription(epic, config.env_file))
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
|
||||||
class EpicRun:
|
|
||||||
"""What stays the same through one run of do-epic on an epic."""
|
|
||||||
key: str
|
|
||||||
config: DoEpicConfig
|
|
||||||
store: EpicStore
|
|
||||||
record: EpicRecord
|
|
||||||
paths: Paths
|
|
||||||
env: typing.Mapping[str, str]
|
|
||||||
launcher: pathlib.Path
|
|
||||||
effects: Effects
|
|
||||||
# The runner of git's and the forge's commands in a folder.
|
|
||||||
forge_at: typing.Callable[[str], Run] = runner
|
|
||||||
|
|
||||||
@property
|
|
||||||
def session(self) -> str:
|
|
||||||
return tmux.session_name(tmux.EPIC, self.key)
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launcher: pathlib.Path, effects: Effects, backend: Backend = jira_backend, stdin: typing.TextIO = sys.stdin, forge_at: typing.Callable[[str], Run] = runner) -> int:
|
def main(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launcher: pathlib.Path, effects: Effects, backend: Backend = jira_backend, stdin: typing.TextIO = sys.stdin, forge_at: typing.Callable[[str], Run] = runner) -> int:
|
||||||
try:
|
try:
|
||||||
stop = run(argv, env, paths, launcher, effects, backend, stdin, forge_at)
|
stop = run(argv, env, paths, launcher, effects, backend, stdin, forge_at)
|
||||||
@@ -233,47 +214,6 @@ def dry_run_printed(epic: EpicRun) -> Stop:
|
|||||||
return Stop(0, "")
|
return Stop(0, "")
|
||||||
|
|
||||||
|
|
||||||
def chunks_started(epic: EpicRun, issues: list[EpicIssue], own: str | None, told: str = "") -> scheduler.Started | Failure:
|
|
||||||
"""scheduler.start_chunks on the epic's issues, as read, in order of score, and its cap, read afresh; own is the issue of the chunk that asks, and told is the reason the planning just gave for stopping, which isn't said twice. Where no issue is open, the chunk to start is the epic's finishing, unless the epic is closed."""
|
|
||||||
due = finish.due(finish.landed(issues, epic.config.pull_merged_status))
|
|
||||||
closed = due and epic.store.closed()
|
|
||||||
if isinstance(closed, Failure):
|
|
||||||
return closed
|
|
||||||
order = planning.start_order(planned_epic(epic), issues)
|
|
||||||
if isinstance(order, Failure):
|
|
||||||
say(f"the issues of {epic.key} start in Jira's backlog order, since they cannot be put in order of score" + ("" if order.reason == told else f": {order.reason}"), epic.effects, stdout=True)
|
|
||||||
elif len(order) > 1:
|
|
||||||
say(f"by score, the issues of {epic.key} start in the order {', '.join(order)}", epic.effects, stdout=True)
|
|
||||||
scheduled = scheduled_epic(epic, () if isinstance(order, Failure) else tuple(order))
|
|
||||||
if isinstance(scheduled, Failure):
|
|
||||||
return scheduled
|
|
||||||
started = scheduler.start_chunks(scheduled, issues, due and not closed, own, epic.effects.tmux)
|
|
||||||
return started if isinstance(started, Failure) else dataclasses.replace(started, closed=closed)
|
|
||||||
|
|
||||||
|
|
||||||
def planned_epic(epic: EpicRun) -> planning.Planned:
|
|
||||||
"""The epic as planning reads and writes it."""
|
|
||||||
return planning.Planned(epic.key, epic.config, epic.store, epic.record, epic.paths.home, epic.effects)
|
|
||||||
|
|
||||||
|
|
||||||
def scheduled_epic(epic: EpicRun, order: tuple[str, ...]) -> scheduler.Epic | Failure:
|
|
||||||
"""The epic as scheduler limits its chunks: with its cap, read afresh, each repo's checkout, and the order its scored issues start in."""
|
|
||||||
cap = epic.record.parallel_chunks()
|
|
||||||
if isinstance(cap, Failure):
|
|
||||||
return cap
|
|
||||||
# The checkouts located so far, from whose remotes repos.locate tells where to clone a repo that is missing.
|
|
||||||
seen: list[pathlib.Path] = []
|
|
||||||
|
|
||||||
def located(name: str) -> tuple[pathlib.Path, int] | Failure:
|
|
||||||
found = locate(name, [checkout for checkout in seen], epic.config, epic.paths.home, epic.effects.git)
|
|
||||||
if isinstance(found, Failure):
|
|
||||||
return found
|
|
||||||
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, order, epic.config.unblocking)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(frozen=True)
|
||||||
class RoutingIssue:
|
class RoutingIssue:
|
||||||
"""An issue as what routes its chunk (agent_cycle.routing.Scored)."""
|
"""An issue as what routes its chunk (agent_cycle.routing.Scored)."""
|
||||||
@@ -293,11 +233,6 @@ class RoutingIssue:
|
|||||||
return self.issue.scores.get("E", 0) + self.issue.scores.get("I", 0)
|
return self.issue.scores.get("E", 0) + self.issue.scores.get("I", 0)
|
||||||
|
|
||||||
|
|
||||||
def real(checkout: pathlib.Path) -> pathlib.Path:
|
|
||||||
"""The checkout as loop-claude names it, which is as git does: through no symlink or `..`. Each keys the checkout's lock and its chunks by that path, so a project config that spells it another way hides neither from the other."""
|
|
||||||
return checkout.resolve()
|
|
||||||
|
|
||||||
|
|
||||||
def chunk_run(key: str, epic: EpicRun) -> Stop:
|
def chunk_run(key: str, epic: EpicRun) -> Stop:
|
||||||
"""Runs the cycles of the chunk of the issue called key until one stops the loop, or the judge rules the chunk finished. For a human's task it runs no cycle: it waits until the task no longer holds up an issue (`human_tasks.awaited`), then starts the next chunks. A chunk in a repo parks after each cycle that leaves its pull request waiting on a gate, and before its first where it was parked when its window last ended, as at a reboot."""
|
"""Runs the cycles of the chunk of the issue called key until one stops the loop, or the judge rules the chunk finished. For a human's task it runs no cycle: it waits until the task no longer holds up an issue (`human_tasks.awaited`), then starts the next chunks. A chunk in a repo parks after each cycle that leaves its pull request waiting on a gate, and before its first where it was parked when its window last ended, as at a reboot."""
|
||||||
pane = epic.env.get("TMUX_PANE")
|
pane = epic.env.get("TMUX_PANE")
|
||||||
@@ -376,124 +311,6 @@ def issue_started(key: str, epic: EpicRun) -> None:
|
|||||||
say(f"{key} stays assigned to {other}", epic.effects, stdout=True)
|
say(f"{key} stays assigned to {other}", epic.effects, stdout=True)
|
||||||
|
|
||||||
|
|
||||||
def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finished: bool, based: str | None) -> str | Stop:
|
|
||||||
"""Keeps the chunk in loop's window parked. Its work is in the repo called repo. It stays parked for as long as its pull request waits on a gate, and returns once its worker has something to do: what to tell that worker, or empty where the chunk was never parked. told is the news its last cycle's worker got, None where the window just started, and finished says the judge ruled the chunk finished. based is the epic's working branch that `epic_based` recorded as the chunk's base when the window started, None where it recorded none. A window that just started parks the chunk only if its file says so: the forge isn't read for a chunk that starts afresh.
|
|
||||||
|
|
||||||
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.
|
|
||||||
"""
|
|
||||||
key, folder = loop.window.name, epic.paths.home / scheduler.STATE / epic.key
|
|
||||||
recorded_as = parked.parked_chunks(folder)
|
|
||||||
if isinstance(recorded_as, Failure):
|
|
||||||
return Stop(1, recorded_as.reason)
|
|
||||||
config = config_located(loop.root, epic.paths.home)
|
|
||||||
if isinstance(config, Failure):
|
|
||||||
return Stop(1, config.reason)
|
|
||||||
# A pull request into an epic's working branch merges without a person, whatever `merge` says. The base recorded says so, not the config: the gate fails where the forge merges the pull request elsewhere.
|
|
||||||
poll = Poll(key, repo, config.merge == "human" and based is None, folder, loop, epic)
|
|
||||||
if key in recorded_as:
|
|
||||||
return resumed_news(poll, recorded_as[key].on, shown=None)
|
|
||||||
entered = None if told is None else poll.first_gate(again=finished)
|
|
||||||
if 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)
|
|
||||||
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)
|
|
||||||
if based is not None and (status := epic.config.pull_open_status):
|
|
||||||
# The team's automation moves an issue only from a pull request into the default branch.
|
|
||||||
if isinstance(moved := epic.store.move_issue(key, status), Failure):
|
|
||||||
say(f"{key} did not move to {status!r} though its pull request is open: {moved.reason}", epic.effects, stdout=True)
|
|
||||||
tmux.park(loop.window, entered.on, epic.effects.tmux)
|
|
||||||
# Once the window shows as parked, so the chunks that start count it as running nowhere.
|
|
||||||
issues = epic.store.read()
|
|
||||||
started = issues if isinstance(issues, Failure) else chunks_started(epic, issues, key)
|
|
||||||
say(f"could not start the next chunk: {started.reason}" if isinstance(started, Failure) else f"started {', '.join(started.started) or 'no other'}", epic.effects, stdout=True)
|
|
||||||
epic.effects.sleep(POLL_SECONDS)
|
|
||||||
return resumed_news(poll, entered.on, shown=entered.on)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
|
||||||
class Poll:
|
|
||||||
"""What each read of a parked chunk's gate needs: the chunk's key, the repo its work is in, whether a person merges its pull request, the folder of the epic's parked chunks, and the chunk's loop and epic."""
|
|
||||||
key: str
|
|
||||||
repo: str
|
|
||||||
by_human: bool
|
|
||||||
folder: pathlib.Path
|
|
||||||
loop: Loop
|
|
||||||
epic: EpicRun
|
|
||||||
|
|
||||||
def gate(self) -> gates.Gate | gates.Open | Failure:
|
|
||||||
return gates.gate(self.key, self.loop.root, self.epic.forge_at, self.by_human)
|
|
||||||
|
|
||||||
def first_gate(self, again: bool) -> gates.Gate | gates.Open | Failure:
|
|
||||||
"""The gate as a cycle ends. Where again holds and a person merges, one that cannot be read is read again every POLL_SECONDS until it can."""
|
|
||||||
now = self.gate()
|
|
||||||
if not again:
|
|
||||||
return now
|
|
||||||
if self.by_human and isinstance(now, Failure):
|
|
||||||
say(f"cannot read the gate of a pull request a person merges: {now.reason}; trying again every {POLL_SECONDS} seconds", self.epic.effects, stdout=True)
|
|
||||||
while self.by_human and isinstance(now, Failure):
|
|
||||||
self.epic.effects.sleep(POLL_SECONDS)
|
|
||||||
now = self.gate()
|
|
||||||
return now
|
|
||||||
|
|
||||||
def record(self, gate: gates.Gate) -> Failure | None:
|
|
||||||
"""Writes the chunk's file as parked on gate, and says so."""
|
|
||||||
failed = parked.park(self.folder, parked.Parked(self.key, gate.worktree, gate.pull, str(self.loop.session.id), gate.on))
|
|
||||||
if failed is None:
|
|
||||||
say(f"parked: pull request #{gate.pull} awaits {gate.on}", self.epic.effects, stdout=True)
|
|
||||||
return failed
|
|
||||||
|
|
||||||
|
|
||||||
def resumed_news(poll: Poll, on: str, shown: str | None) -> str | Stop:
|
|
||||||
"""Reads the gate of the parked chunk every POLL_SECONDS until its worker has something to do and a running slot is free, then removes its file: what to tell that worker. on is the gate the chunk's file says it is parked on, and shown what its window's name says it awaits, None where nothing yet. A gate that cannot be read leaves the chunk parked as it was."""
|
|
||||||
# The last reason said for staying parked.
|
|
||||||
said = None
|
|
||||||
while True:
|
|
||||||
now = poll.gate()
|
|
||||||
if isinstance(now, gates.Gate):
|
|
||||||
awaits, stays = now.on, None
|
|
||||||
if now.on != on:
|
|
||||||
if failed := poll.record(now):
|
|
||||||
return Stop(1, failed.reason)
|
|
||||||
on = now.on
|
|
||||||
elif isinstance(now, Failure):
|
|
||||||
awaits, stays = shown or on, f"cannot read the gate: {now.reason}"
|
|
||||||
else:
|
|
||||||
full = resumed(poll.repo, poll.loop, poll.epic)
|
|
||||||
if full is None:
|
|
||||||
failed = parked.unpark(poll.folder, poll.key)
|
|
||||||
return Stop(1, failed.reason) if failed is not None else f"{DRIVER_PARKED} its pull request awaited {"a person's merge" if on == gates.MERGE else on}. It resumes now: {now.news}."
|
|
||||||
awaits, stays = parked.SLOT, f"{now.news}, but the chunk stays parked: {full}"
|
|
||||||
if awaits != shown:
|
|
||||||
tmux.park(poll.loop.window, awaits, poll.epic.effects.tmux)
|
|
||||||
shown = awaits
|
|
||||||
if stays is not None and stays != said:
|
|
||||||
say(f"{stays}; trying again every {POLL_SECONDS} seconds", poll.epic.effects, stdout=True)
|
|
||||||
said = stays
|
|
||||||
poll.epic.effects.sleep(POLL_SECONDS)
|
|
||||||
|
|
||||||
|
|
||||||
# How the news for a chunk that was parked opens.
|
|
||||||
DRIVER_PARKED = f"{chunk_prompt.DRIVER} parked the chunk while"
|
|
||||||
|
|
||||||
|
|
||||||
def resumed(repo: str, loop: Loop, epic: EpicRun) -> str | None:
|
|
||||||
"""scheduler.resume for the parked chunk in loop's window, whose work is in the repo called repo, on the epic's cap and repos read afresh: None once it holds a running slot, else why it stays parked."""
|
|
||||||
# A chunk that resumes starts no other, so it needs no start order.
|
|
||||||
scheduled = scheduled_epic(epic, ())
|
|
||||||
if isinstance(scheduled, Failure):
|
|
||||||
return scheduled.reason
|
|
||||||
return scheduler.resume(scheduled, repo, loop.window, epic.effects.tmux)
|
|
||||||
|
|
||||||
|
|
||||||
def issue_read(key: str, epic: EpicRun) -> EpicIssue | Stop:
|
def issue_read(key: str, epic: EpicRun) -> EpicIssue | Stop:
|
||||||
"""The epic's issue called key, read afresh."""
|
"""The epic's issue called key, read afresh."""
|
||||||
issues = epic.store.read()
|
issues = epic.store.read()
|
||||||
@@ -535,33 +352,80 @@ class Landed(enum.Enum):
|
|||||||
ON_EPIC_BRANCH = enum.auto()
|
ON_EPIC_BRANCH = enum.auto()
|
||||||
|
|
||||||
|
|
||||||
|
class How(enum.Enum):
|
||||||
|
"""How a finished chunk's issue moves when it doesn't move to a status the config names."""
|
||||||
|
# do-epic neither moves nor awaits it.
|
||||||
|
LEFT = enum.auto()
|
||||||
|
# Nobody would move it, so the loop stops.
|
||||||
|
STUCK = enum.auto()
|
||||||
|
# The team's automation moves it, and do-epic waits for that.
|
||||||
|
AWAITED = enum.auto()
|
||||||
|
# do-epic moves it to done.
|
||||||
|
TO_DONE = enum.auto()
|
||||||
|
|
||||||
|
|
||||||
|
@dataclasses.dataclass(frozen=True)
|
||||||
|
class ToStatus:
|
||||||
|
"""do-epic moves a finished chunk's issue to status. Where that move fails, it moves the issue to through first and tries again; through is None where the config names no open status."""
|
||||||
|
status: str
|
||||||
|
through: str | None
|
||||||
|
|
||||||
|
|
||||||
|
# The move of a finished chunk's issue.
|
||||||
|
Move = How | ToStatus
|
||||||
|
|
||||||
|
|
||||||
|
def issue_move(landed: Landed, automated: bool, merged: str | None, opened: str | None, finishing: bool) -> Move:
|
||||||
|
"""The move of a finished chunk's issue. landed says where the chunk's work landed, automated says the team's automation moves issues, merged and opened are the statuses `jira-pull-request-merged-status` and `jira-pull-request-open-status` name, each None where the config names none, and finishing says the chunk is the epic's finishing. The first row that fits:
|
||||||
|
|
||||||
|
| The chunk | The automation moves issues | A merged status is named | Move |
|
||||||
|
|---|---|---|---|
|
||||||
|
| the epic's finishing, which has no issue | either | either | LEFT |
|
||||||
|
| a human's task | yes | either | LEFT: the human moves it |
|
||||||
|
| landed on the epic's working branch | either | yes | ToStatus merged, through opened |
|
||||||
|
| landed on the epic's working branch | yes | no | STUCK: the automation doesn't see that merge |
|
||||||
|
| landed on the default branch | yes | either | AWAITED |
|
||||||
|
| any other | either | either | TO_DONE |
|
||||||
|
|
||||||
|
A chunk that never parked left its issue before the open status, from which a workflow may offer no way to the merged one: hence through."""
|
||||||
|
if finishing or (landed is Landed.WITH_A_HUMAN and automated):
|
||||||
|
return How.LEFT
|
||||||
|
if landed is Landed.ON_EPIC_BRANCH and merged:
|
||||||
|
return ToStatus(merged, opened or None)
|
||||||
|
if landed is Landed.ON_EPIC_BRANCH and automated:
|
||||||
|
return How.STUCK
|
||||||
|
if landed is Landed.ON_DEFAULT_BRANCH and automated:
|
||||||
|
return How.AWAITED
|
||||||
|
return How.TO_DONE
|
||||||
|
|
||||||
|
|
||||||
def handed_on(key: str, epic: EpicRun, landed: Landed = Landed.NOWHERE) -> Stop:
|
def handed_on(key: str, epic: EpicRun, landed: Landed = Landed.NOWHERE) -> 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 parent too where the parent's sub-tasks now let it move (`parents_settled`), 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 whose work landed on the default branch, from its pull request: the stop waits for that move (`moved_by_automation`). The human moves their own task: the stop doesn't move or await anything. 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. The automation doesn't see a pull request that merged into an epic's working branch: the stop moves that chunk's issue to the status `jira-pull-request-merged-status` names. Where none is named, it moves the issue to done, or stops where the automation moves issues, since then nobody would move it. do-epic's window closes as it exits."""
|
"""The stop of a do-epic whose chunk finished. It first moves the chunk's issue as `issue_move` says, and the issue's parent too where the parent's sub-tasks now let it move (`parents_settled`), so that no finished chunk starts again and what they block may start. Then it starts each chunk that may start now. Where the team's automation moves the issue, the stop waits for that move (`moved_by_automation`). do-epic's window closes as it exits."""
|
||||||
automated = epic.config.automation_moves
|
move = issue_move(landed, epic.config.automation_moves, epic.config.pull_merged_status, epic.config.pull_open_status, finishing=key == epic.key)
|
||||||
# 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.
|
issues: list[EpicIssue] | Failure
|
||||||
if key == epic.key or (landed is Landed.WITH_A_HUMAN and automated):
|
match move:
|
||||||
issues: list[EpicIssue] | Failure = epic.store.read()
|
case How.LEFT:
|
||||||
elif landed is Landed.ON_EPIC_BRANCH and (status := epic.config.pull_merged_status):
|
issues = epic.store.read()
|
||||||
moved = epic.store.move_issue(key, status)
|
case ToStatus(status, through):
|
||||||
# A chunk that never parked left its issue before the open status, from which a workflow may offer no way to the merged one.
|
|
||||||
if isinstance(moved, Failure) and (opened := epic.config.pull_open_status) and not isinstance(epic.store.move_issue(key, opened), Failure):
|
|
||||||
moved = epic.store.move_issue(key, status)
|
moved = epic.store.move_issue(key, status)
|
||||||
if isinstance(moved, Failure):
|
if isinstance(moved, Failure) and through and not isinstance(epic.store.move_issue(key, through), Failure):
|
||||||
return Stop(1, f"the chunk finished, but its issue could not move to {status!r}: {moved.reason}; once it has that status in Jira, run `do-epic {epic.key}` to start the chunks it blocks")
|
moved = epic.store.move_issue(key, status)
|
||||||
issues = epic.store.read()
|
if isinstance(moved, Failure):
|
||||||
# A search may not show the move yet, so the issue counts as moved here whatever the read says.
|
return Stop(1, f"the chunk finished, but its issue could not move to {status!r}: {moved.reason}; once it has that status in Jira, run `do-epic {epic.key}` to start the chunks it blocks")
|
||||||
issues = issues if isinstance(issues, Failure) else [dataclasses.replace(each, status=status) if each.key == key else each for each in issues]
|
issues = epic.store.read()
|
||||||
elif landed is Landed.ON_EPIC_BRANCH and automated:
|
# A search may not show the move yet, so the issue counts as moved here whatever the read says.
|
||||||
return Stop(1, f"the chunk finished, but its issue stays as it is: its pull request merged into the epic's working branch, where the team's automation moves no issue, and do-epic's config names no `{PULL_MERGED_STATUS}` to move it to. Move {key} in Jira, then run `do-epic {epic.key}` to start the chunks it blocks")
|
issues = issues if isinstance(issues, Failure) else [dataclasses.replace(each, status=status) if each.key == key else each for each in issues]
|
||||||
elif landed is Landed.ON_DEFAULT_BRANCH and automated:
|
case How.STUCK:
|
||||||
issues = moved_by_automation(key, epic)
|
return Stop(1, f"the chunk finished, but its issue stays as it is: its pull request merged into the epic's working branch, where the team's automation moves no issue, and do-epic's config names no `{PULL_MERGED_STATUS}` to move it to. Move {key} in Jira, then run `do-epic {epic.key}` to start the chunks it blocks")
|
||||||
else:
|
case How.AWAITED:
|
||||||
moved = epic.store.finish_issue(key)
|
issues = moved_by_automation(key, epic)
|
||||||
if isinstance(moved, Failure):
|
case How.TO_DONE:
|
||||||
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")
|
moved = epic.store.finish_issue(key)
|
||||||
issues = epic.store.read()
|
if isinstance(moved, Failure):
|
||||||
# A search may not show the move yet, so the issue counts as done here whatever the read says.
|
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 = issues if isinstance(issues, Failure) else [dataclasses.replace(each, done=True) if each.key == key else each for each in issues]
|
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):
|
if isinstance(issues, Failure):
|
||||||
return Stop(1, f"the chunk finished, but the next could not start: {issues.reason}")
|
return Stop(1, f"the chunk finished, but the next could not start: {issues.reason}")
|
||||||
closed = parents_settled(epic, issues)
|
closed = parents_settled(epic, issues)
|
||||||
|
|||||||
@@ -0,0 +1,140 @@
|
|||||||
|
"""A chunk parked while its pull request waits on a gate (docs/decisions.md → `do-epic: drives one Jira epic …`): `parked_through` keeps it parked from the end of a cycle until its worker has something to do, and `news_after` says what a chunk that isn't parked tells its worker."""
|
||||||
|
import dataclasses
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
from do_epic import chunk_prompt, gates, parked, scheduler
|
||||||
|
from do_epic.epic_run import chunks_started, EpicRun, POLL_SECONDS, scheduled_epic
|
||||||
|
from project_config.main import located as config_located
|
||||||
|
from failure import Failure
|
||||||
|
from chunk_driver.this_loop import Loop
|
||||||
|
from loop_effects.effects import say
|
||||||
|
from agent_cycle.stop import Stop
|
||||||
|
from agent_cycle import tmux
|
||||||
|
|
||||||
|
# How the news for a chunk that was parked opens.
|
||||||
|
DRIVER_PARKED = f"{chunk_prompt.DRIVER} parked the chunk while"
|
||||||
|
|
||||||
|
|
||||||
|
def parked_through(repo: str, loop: Loop, epic: EpicRun, told: str | None, finished: bool, based: str | None) -> str | Stop:
|
||||||
|
"""Keeps the chunk in loop's window parked. Its work is in the repo called repo. It stays parked for as long as its pull request waits on a gate, and returns once its worker has something to do: what to tell that worker, or empty where the chunk was never parked. told is the news its last cycle's worker got, None where the window just started, and finished says the judge ruled the chunk finished. based is the epic's working branch that `epic_based` recorded as the chunk's base when the window started, None where it recorded none. A window that just started parks the chunk only if its file says so: the forge isn't read for a chunk that starts afresh.
|
||||||
|
|
||||||
|
Where a person merges, a worker ends its run with the pull request open, so the judge may rule the chunk finished before it is. For such a finished chunk, a gate that cannot be read is read again until it can (`Poll.first_gate`), and what the worker must still do is news (`news_after`).
|
||||||
|
|
||||||
|
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.
|
||||||
|
"""
|
||||||
|
key, folder = loop.window.name, epic.paths.home / scheduler.STATE / epic.key
|
||||||
|
recorded_as = parked.parked_chunks(folder)
|
||||||
|
if isinstance(recorded_as, Failure):
|
||||||
|
return Stop(1, recorded_as.reason)
|
||||||
|
config = config_located(loop.root, epic.paths.home)
|
||||||
|
if isinstance(config, Failure):
|
||||||
|
return Stop(1, config.reason)
|
||||||
|
# A pull request into an epic's working branch merges without a person, whatever `merge` says. The base recorded says so, not the config: the gate fails where the forge merges the pull request elsewhere.
|
||||||
|
poll = Poll(key, repo, config.merge == "human" and based is None, folder, loop, epic)
|
||||||
|
if key in recorded_as:
|
||||||
|
return resumed_news(poll, recorded_as[key].on, shown=None)
|
||||||
|
entered = None if told is None else poll.first_gate(again=finished)
|
||||||
|
if 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)
|
||||||
|
return news_after(entered, finished, poll.by_human, told)
|
||||||
|
if failed := poll.record(entered):
|
||||||
|
return Stop(1, failed.reason)
|
||||||
|
if based is not None and (status := epic.config.pull_open_status):
|
||||||
|
# The team's automation moves an issue only from a pull request into the default branch.
|
||||||
|
if isinstance(moved := epic.store.move_issue(key, status), Failure):
|
||||||
|
say(f"{key} did not move to {status!r} though its pull request is open: {moved.reason}", epic.effects, stdout=True)
|
||||||
|
tmux.park(loop.window, entered.on, epic.effects.tmux)
|
||||||
|
# Once the window shows as parked, so the chunks that start count it as running nowhere.
|
||||||
|
issues = epic.store.read()
|
||||||
|
started = issues if isinstance(issues, Failure) else chunks_started(epic, issues, key)
|
||||||
|
say(f"could not start the next chunk: {started.reason}" if isinstance(started, Failure) else f"started {', '.join(started.started) or 'no other'}", epic.effects, stdout=True)
|
||||||
|
epic.effects.sleep(POLL_SECONDS)
|
||||||
|
return resumed_news(poll, entered.on, shown=entered.on)
|
||||||
|
|
||||||
|
|
||||||
|
def news_after(entered: gates.Open | Failure | None, finished: bool, by_human: bool, told: str | None) -> str:
|
||||||
|
"""What to tell the worker of a chunk that isn't parked as its cycle ends, empty where there isn't anything. entered is what was read instead of a gate, None where the window just started, and told is the news the last worker got.
|
||||||
|
|
||||||
|
Only a chunk the judge ruled finished, whose pull request a person merges, has news, of one of two kinds:
|
||||||
|
- its pull request doesn't merge into its base: news after every cycle that leaves it so, and the worker levels the branch;
|
||||||
|
- its worktree stands though no pull request is open: news once, unless told says so already, and the worker removes the worktree."""
|
||||||
|
if not (finished and by_human):
|
||||||
|
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}."
|
||||||
|
if isinstance(entered, gates.Unopened):
|
||||||
|
uncleaned = f"{chunk_prompt.DRIVER} keeps the chunk open while its worktree stands: {entered.news}."
|
||||||
|
return "" if uncleaned in (told or "") else uncleaned
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
@dataclasses.dataclass(frozen=True)
|
||||||
|
class Poll:
|
||||||
|
"""What each read of a parked chunk's gate needs: the chunk's key, the repo its work is in, whether a person merges its pull request, the folder of the epic's parked chunks, and the chunk's loop and epic."""
|
||||||
|
key: str
|
||||||
|
repo: str
|
||||||
|
by_human: bool
|
||||||
|
folder: pathlib.Path
|
||||||
|
loop: Loop
|
||||||
|
epic: EpicRun
|
||||||
|
|
||||||
|
def gate(self) -> gates.Gate | gates.Open | Failure:
|
||||||
|
return gates.gate(self.key, self.loop.root, self.epic.forge_at, self.by_human)
|
||||||
|
|
||||||
|
def first_gate(self, again: bool) -> gates.Gate | gates.Open | Failure:
|
||||||
|
"""The gate as a cycle ends. Where again holds and a person merges, one that cannot be read is read again every POLL_SECONDS until it can."""
|
||||||
|
now = self.gate()
|
||||||
|
if not again:
|
||||||
|
return now
|
||||||
|
if self.by_human and isinstance(now, Failure):
|
||||||
|
say(f"cannot read the gate of a pull request a person merges: {now.reason}; trying again every {POLL_SECONDS} seconds", self.epic.effects, stdout=True)
|
||||||
|
while self.by_human and isinstance(now, Failure):
|
||||||
|
self.epic.effects.sleep(POLL_SECONDS)
|
||||||
|
now = self.gate()
|
||||||
|
return now
|
||||||
|
|
||||||
|
def record(self, gate: gates.Gate) -> Failure | None:
|
||||||
|
"""Writes the chunk's file as parked on gate, and says so."""
|
||||||
|
failed = parked.park(self.folder, parked.Parked(self.key, gate.worktree, gate.pull, str(self.loop.session.id), gate.on))
|
||||||
|
if failed is None:
|
||||||
|
say(f"parked: pull request #{gate.pull} awaits {gate.on}", self.epic.effects, stdout=True)
|
||||||
|
return failed
|
||||||
|
|
||||||
|
|
||||||
|
def resumed_news(poll: Poll, on: str, shown: str | None) -> str | Stop:
|
||||||
|
"""Reads the gate of the parked chunk every POLL_SECONDS until its worker has something to do and a running slot is free, then removes its file: what to tell that worker. on is the gate the chunk's file says it is parked on, and shown what its window's name says it awaits, None where nothing yet. A gate that cannot be read leaves the chunk parked as it was."""
|
||||||
|
# The last reason said for staying parked.
|
||||||
|
said = None
|
||||||
|
while True:
|
||||||
|
now = poll.gate()
|
||||||
|
if isinstance(now, gates.Gate):
|
||||||
|
awaits, stays = now.on, None
|
||||||
|
if now.on != on:
|
||||||
|
if failed := poll.record(now):
|
||||||
|
return Stop(1, failed.reason)
|
||||||
|
on = now.on
|
||||||
|
elif isinstance(now, Failure):
|
||||||
|
awaits, stays = shown or on, f"cannot read the gate: {now.reason}"
|
||||||
|
else:
|
||||||
|
full = resumed(poll.repo, poll.loop, poll.epic)
|
||||||
|
if full is None:
|
||||||
|
failed = parked.unpark(poll.folder, poll.key)
|
||||||
|
return Stop(1, failed.reason) if failed is not None else f"{DRIVER_PARKED} its pull request awaited {"a person's merge" if on == gates.MERGE else on}. It resumes now: {now.news}."
|
||||||
|
awaits, stays = parked.SLOT, f"{now.news}, but the chunk stays parked: {full}"
|
||||||
|
if awaits != shown:
|
||||||
|
tmux.park(poll.loop.window, awaits, poll.epic.effects.tmux)
|
||||||
|
shown = awaits
|
||||||
|
if stays is not None and stays != said:
|
||||||
|
say(f"{stays}; trying again every {POLL_SECONDS} seconds", poll.epic.effects, stdout=True)
|
||||||
|
said = stays
|
||||||
|
poll.epic.effects.sleep(POLL_SECONDS)
|
||||||
|
|
||||||
|
|
||||||
|
def resumed(repo: str, loop: Loop, epic: EpicRun) -> str | None:
|
||||||
|
"""scheduler.resume for the parked chunk in loop's window, whose work is in the repo called repo, on the epic's cap and repos read afresh: None once it holds a running slot, else why it stays parked."""
|
||||||
|
# A chunk that resumes starts no other, so it needs no start order.
|
||||||
|
scheduled = scheduled_epic(epic, ())
|
||||||
|
if isinstance(scheduled, Failure):
|
||||||
|
return scheduled.reason
|
||||||
|
return scheduler.resume(scheduled, repo, loop.window, epic.effects.tmux)
|
||||||
@@ -12,7 +12,7 @@ import unittest
|
|||||||
|
|
||||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
from do_epic import chunk_prompt, main, planning
|
from do_epic import chunk_prompt, epic_run, main, planning
|
||||||
from chunk_driver.chunk_run import ChunkRun
|
from chunk_driver.chunk_run import ChunkRun
|
||||||
from project_config.doubles import configured
|
from project_config.doubles import configured
|
||||||
from do_epic.config import DoEpicConfig
|
from do_epic.config import DoEpicConfig
|
||||||
@@ -86,11 +86,11 @@ class DoEpicTest(unittest.TestCase):
|
|||||||
self.issues = [issue("ABC-20", "repo:api")]
|
self.issues = [issue("ABC-20", "repo:api")]
|
||||||
return folder
|
return folder
|
||||||
|
|
||||||
def epic_run(self, fake: FakeEffects, env: dict[str, str] | None = None) -> main.EpicRun:
|
def epic_run(self, fake: FakeEffects, env: dict[str, str] | None = None) -> epic_run.EpicRun:
|
||||||
config = main.load(self.home)
|
config = main.load(self.home)
|
||||||
assert not isinstance(config, Failure)
|
assert not isinstance(config, Failure)
|
||||||
store, record = self.backend(config, "ABC-12")
|
store, record = self.backend(config, "ABC-12")
|
||||||
return main.EpicRun("ABC-12", config, store, record, paths_from(self.home), env or {}, pathlib.Path("/b/do-epic"), fake.effects())
|
return epic_run.EpicRun("ABC-12", config, store, record, paths_from(self.home), env or {}, pathlib.Path("/b/do-epic"), fake.effects())
|
||||||
|
|
||||||
def run_main(self, argv: list[str], fake: FakeEffects, env: dict[str, str] | None = None) -> tuple[int, str, str]:
|
def run_main(self, argv: list[str], fake: FakeEffects, env: dict[str, str] | None = None) -> tuple[int, str, str]:
|
||||||
out, err = io.StringIO(), io.StringIO()
|
out, err = io.StringIO(), io.StringIO()
|
||||||
@@ -1237,6 +1237,40 @@ class AnEpicsWorkingBranch(DoEpicTest):
|
|||||||
self.assertTrue(stop.reason.endswith("once it has that status in Jira, run `do-epic ABC-12` to start the chunks it blocks"), stop.reason)
|
self.assertTrue(stop.reason.endswith("once it has that status in Jira, run `do-epic ABC-12` to start the chunks it blocks"), stop.reason)
|
||||||
|
|
||||||
|
|
||||||
|
class TheMoveOfAFinishedChunksIssue(unittest.TestCase):
|
||||||
|
def move(self, landed: main.Landed, automated: bool, merged: str | None = None, opened: str | None = None, finishing: bool = False) -> main.Move:
|
||||||
|
return main.issue_move(landed, automated, merged, opened, finishing)
|
||||||
|
|
||||||
|
def test_the_epics_finishing_has_no_issue_to_move(self) -> None:
|
||||||
|
for automated in (False, True):
|
||||||
|
with self.subTest(automated=automated):
|
||||||
|
self.assertEqual(self.move(main.Landed.NOWHERE, automated, "Release Ready", "In Review", finishing=True), main.How.LEFT)
|
||||||
|
|
||||||
|
def test_a_humans_task_is_left_where_the_automation_moves_issues_and_done_otherwise(self) -> None:
|
||||||
|
self.assertEqual(self.move(main.Landed.WITH_A_HUMAN, True, "Release Ready"), main.How.LEFT)
|
||||||
|
self.assertEqual(self.move(main.Landed.WITH_A_HUMAN, False, "Release Ready"), main.How.TO_DONE)
|
||||||
|
|
||||||
|
def test_a_chunk_without_a_repo_moves_to_done(self) -> None:
|
||||||
|
for automated in (False, True):
|
||||||
|
with self.subTest(automated=automated):
|
||||||
|
self.assertEqual(self.move(main.Landed.NOWHERE, automated, "Release Ready", "In Review"), main.How.TO_DONE)
|
||||||
|
|
||||||
|
def test_work_on_the_default_branch_awaits_the_automation_or_moves_to_done(self) -> None:
|
||||||
|
self.assertEqual(self.move(main.Landed.ON_DEFAULT_BRANCH, True, "Release Ready", "In Review"), main.How.AWAITED)
|
||||||
|
self.assertEqual(self.move(main.Landed.ON_DEFAULT_BRANCH, False, "Release Ready", "In Review"), main.How.TO_DONE)
|
||||||
|
|
||||||
|
def test_work_on_the_epics_branch_moves_to_the_merged_status_through_the_open_one_where_named(self) -> None:
|
||||||
|
for automated in (False, True):
|
||||||
|
with self.subTest(automated=automated):
|
||||||
|
self.assertEqual(self.move(main.Landed.ON_EPIC_BRANCH, automated, "Release Ready", "In Review"), main.ToStatus("Release Ready", "In Review"))
|
||||||
|
self.assertEqual(self.move(main.Landed.ON_EPIC_BRANCH, automated, "Release Ready"), main.ToStatus("Release Ready", None))
|
||||||
|
|
||||||
|
def test_work_on_the_epics_branch_with_no_merged_status_is_stuck_under_automation_and_done_otherwise(self) -> None:
|
||||||
|
self.assertEqual(self.move(main.Landed.ON_EPIC_BRANCH, True, None, "In Review"), main.How.STUCK)
|
||||||
|
self.assertEqual(self.move(main.Landed.ON_EPIC_BRANCH, True, "", "In Review"), main.How.STUCK)
|
||||||
|
self.assertEqual(self.move(main.Landed.ON_EPIC_BRANCH, False, None, "In Review"), main.How.TO_DONE)
|
||||||
|
|
||||||
|
|
||||||
class TheStatus(DoEpicTest):
|
class TheStatus(DoEpicTest):
|
||||||
def test_prints_what_each_open_issue_does_and_starts_nothing(self) -> None:
|
def test_prints_what_each_open_issue_does_and_starts_nothing(self) -> None:
|
||||||
self.issues = [issue("ABC-21", "repo:api"), issue("ABC-24", "repo:api"), issue("ABC-27")]
|
self.issues = [issue("ABC-21", "repo:api"), issue("ABC-24", "repo:api"), issue("ABC-27")]
|
||||||
@@ -1369,7 +1403,7 @@ class TheDryRun(DoEpicTest):
|
|||||||
self.issues = [dataclasses.replace(issue(key, "do-epic-claude"), scores={"L": 1, "E": 1, "I": 1, "S": 1}) for key in ("ABC-20", "ABC-21")]
|
self.issues = [dataclasses.replace(issue(key, "do-epic-claude"), scores={"L": 1, "E": 1, "I": 1, "S": 1}) for key in ("ABC-20", "ABC-21")]
|
||||||
out = io.StringIO()
|
out = io.StringIO()
|
||||||
with contextlib.redirect_stdout(out):
|
with contextlib.redirect_stdout(out):
|
||||||
main.chunks_started(self.epic_run(FakeEffects(on_terminal=False)), self.issues, None)
|
epic_run.chunks_started(self.epic_run(FakeEffects(on_terminal=False)), self.issues, None)
|
||||||
self.assertIn("the issues of ABC-12 start in Jira's backlog order, since they cannot be put in order of score: the epic ABC-12's description states `Score = ...` 0 times under ## Scoring", out.getvalue())
|
self.assertIn("the issues of ABC-12 start in Jira's backlog order, since they cannot be put in order of score: the epic ABC-12's description states `Score = ...` 0 times under ## Scoring", out.getvalue())
|
||||||
self.description = DESCRIPTION.replace("Ship the import.", "1. **Achieve:** Ship the import.") + "\n## Scoring\n`Score = V`\n"
|
self.description = DESCRIPTION.replace("Ship the import.", "1. **Achieve:** Ship the import.") + "\n## Scoring\n`Score = V`\n"
|
||||||
self.issues = self.issues[:1]
|
self.issues = self.issues[:1]
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import pathlib
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
|
from do_epic import chunk_prompt
|
||||||
|
from failure import Failure
|
||||||
|
from do_epic.parking import news_after
|
||||||
|
from do_epic.gates import Open, Unmergeable, Unopened
|
||||||
|
|
||||||
|
UNOPENED = Unopened("no pull request is open")
|
||||||
|
UNCLEANED = f"{chunk_prompt.DRIVER} keeps the chunk open while its worktree stands: no pull request is open."
|
||||||
|
UNMERGEABLE = Unmergeable("pull request #7 conflicts with its base branch")
|
||||||
|
UNLEVELLED = f"{chunk_prompt.DRIVER} keeps the chunk open while its pull request doesn't merge into its base: pull request #7 conflicts with its base branch."
|
||||||
|
|
||||||
|
|
||||||
|
class TheNewsOfAChunkThatIsNotParked(unittest.TestCase):
|
||||||
|
def test_a_window_that_just_started_has_no_news(self) -> None:
|
||||||
|
self.assertEqual(news_after(None, finished=True, by_human=True, told=None), "")
|
||||||
|
|
||||||
|
def test_a_gate_that_cannot_be_read_or_one_that_lets_the_chunk_go_on_does_not_add_any_news(self) -> None:
|
||||||
|
for entered in (Failure("no network"), Open("a reviewer requested changes")):
|
||||||
|
with self.subTest(entered):
|
||||||
|
self.assertEqual(news_after(entered, finished=True, by_human=True, told=""), "")
|
||||||
|
|
||||||
|
def test_an_unfinished_chunk_or_one_that_merges_without_a_person_has_no_news(self) -> None:
|
||||||
|
for entered in (UNOPENED, UNMERGEABLE):
|
||||||
|
for finished, by_human in ((False, True), (True, False), (False, False)):
|
||||||
|
with self.subTest(entered=entered, finished=finished, by_human=by_human):
|
||||||
|
self.assertEqual(news_after(entered, finished, by_human, told=""), "")
|
||||||
|
|
||||||
|
def test_a_finished_chunk_a_person_merges_is_told_its_worktree_stands_once(self) -> None:
|
||||||
|
self.assertEqual(news_after(UNOPENED, finished=True, by_human=True, told=""), UNCLEANED)
|
||||||
|
self.assertEqual(news_after(UNOPENED, finished=True, by_human=True, told=UNLEVELLED), UNCLEANED)
|
||||||
|
self.assertEqual(news_after(UNOPENED, finished=True, by_human=True, told=f"Before. {UNCLEANED}"), "")
|
||||||
|
|
||||||
|
def test_a_finished_chunk_a_person_merges_is_told_after_every_cycle_that_its_pull_request_doesnt_merge(self) -> None:
|
||||||
|
self.assertEqual(news_after(UNMERGEABLE, finished=True, by_human=True, told=""), UNLEVELLED)
|
||||||
|
self.assertEqual(news_after(UNMERGEABLE, finished=True, by_human=True, told=UNLEVELLED), UNLEVELLED)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
@@ -3,7 +3,7 @@ import typing
|
|||||||
|
|
||||||
from larv_review.agreement import agreement_report
|
from larv_review.agreement import agreement_report
|
||||||
from review_rules.comprehension_history import appended, DIMENSIONS, heading, Heading, latest_places, recorded, ruling_entry, scoring_entry, ScoringRun, vote_text
|
from review_rules.comprehension_history import appended, DIMENSIONS, heading, Heading, latest_places, recorded, ruling_entry, scoring_entry, ScoringRun, vote_text
|
||||||
from larv_review.plan import checkout_plan, plan_reasons
|
from larv_review.scoring_due import checkout_plan, plan_reasons
|
||||||
from git_cli.git_repo import commit_exists
|
from git_cli.git_repo import commit_exists
|
||||||
from larv_review.ruling import counted, overall, ruling, split, surplus, votes
|
from larv_review.ruling import counted, overall, ruling, split, surplus, votes
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
|
|||||||
+8
-12
@@ -34,7 +34,7 @@ needs-scoring-run takes the IDs of the todo.md items the chunk ships, none when
|
|||||||
prints why the chunk is due a scoring run, or `No scoring run due.` It is due when the chunk ships
|
prints why the chunk is due a scoring run, or `No scoring run due.` It is due when the chunk ships
|
||||||
a floor item, one whose tagline opens with `Reach the comprehension floor:`. It is also due when the
|
a floor item, one whose tagline opens with `Reach the comprehension floor:`. It is also due when the
|
||||||
chunk leaves a release with no item in the project's todo.md, once the shipped items are set aside, and work has landed
|
chunk leaves a release with no item in the project's todo.md, once the shipped items are set aside, and work has landed
|
||||||
towards that release; bin/larv_review/plan.py's `work_landed` and `landed_towards` say when. A release the checkout's
|
towards that release; bin/larv_review/scoring_due.py's `work_landed` and `landed_towards` say when. A release the checkout's
|
||||||
todo.md marks renamed in its ## Renamed section, as `- 0.2.1 renamed to 0.3.0`, is due none.
|
todo.md marks renamed in its ## Renamed section, as `- 0.2.1 renamed to 0.3.0`, is due none.
|
||||||
A chunk is also due one while no scoring run in the default branch's history is newer than the
|
A chunk is also due one while no scoring run in the default branch's history is newer than the
|
||||||
commit of its second-newest v* tag, so a release cut unmeasured is caught up by the next chunk. A project whose
|
commit of its second-newest v* tag, so a release cut unmeasured is caught up by the next chunk. A project whose
|
||||||
@@ -171,8 +171,9 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from git_cli.git_repo import branch_titles, default_branch, git, top
|
from larv_review.reviewer_header import branch_summaries, reviewer_header
|
||||||
from review_rules.round_titles import cap, CAP, RELEASE_REVIEW_CAP, round_counts
|
from review_rules.round_titles import cap, CAP, RELEASE_REVIEW_CAP, round_counts
|
||||||
|
from git_cli.git_repo import default_branch, git, top
|
||||||
from project_config.settings import DEFAULT_FLOOR
|
from project_config.settings import DEFAULT_FLOOR
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from larv_review.history_changes import history_changes
|
from larv_review.history_changes import history_changes
|
||||||
@@ -182,12 +183,10 @@ from larv_review.ruling_base import measured_commit
|
|||||||
from larv_review.agreement import MIN_PAIRS
|
from larv_review.agreement import MIN_PAIRS
|
||||||
from larv_review.owed import owed_scoring_run
|
from larv_review.owed import owed_scoring_run
|
||||||
from review_rules.review_passes import PASSES, REVIEWERS
|
from review_rules.review_passes import PASSES, REVIEWERS
|
||||||
from larv_review.plan import plan_reasons
|
from larv_review.scoring_due import plan_reasons
|
||||||
from larv_review.scoring_setup import prepare_scoring
|
from larv_review.scoring_setup import prepare_scoring
|
||||||
from larv_review.history_commands import read_agreement, read_places, record_ruling, record_scoring
|
from larv_review.history_commands import read_agreement, read_places, record_ruling, record_scoring
|
||||||
from larv_review.reviewer_header import reviewer_header
|
|
||||||
from larv_review.round_title import round_title
|
from larv_review.round_title import round_title
|
||||||
from project_config.main import title_templates
|
|
||||||
|
|
||||||
|
|
||||||
class Command(typing.NamedTuple):
|
class Command(typing.NamedTuple):
|
||||||
@@ -321,13 +320,10 @@ def show_ruling_base(default: str, home: pathlib.Path) -> Failure | None:
|
|||||||
|
|
||||||
|
|
||||||
def round_count(default: str) -> Failure | None:
|
def round_count(default: str) -> Failure | None:
|
||||||
titles = branch_titles(default)
|
summaries = branch_summaries(default, pathlib.Path.home())
|
||||||
if isinstance(titles, Failure):
|
if isinstance(summaries, Failure):
|
||||||
return titles
|
return summaries
|
||||||
templates = title_templates(None, pathlib.Path.home())
|
for name, count in round_counts(summaries).items():
|
||||||
if isinstance(templates, Failure):
|
|
||||||
return templates
|
|
||||||
for name, count in round_counts([templates.summary(title) for title in titles]).items():
|
|
||||||
print(f"{name}: {count}{cap_note(count, cap(name)) if name in PASSES else ', not a pass: check the commit title'}")
|
print(f"{name}: {count}{cap_note(count, cap(name)) if name in PASSES else ', not a pass: check the commit title'}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import pathlib
|
import pathlib
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from larv_review.plan import Emptied, plan_reasons
|
from larv_review.scoring_due import Emptied, plan_reasons
|
||||||
from review_rules.comprehension_history import entries
|
from review_rules.comprehension_history import entries
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from git_cli.git_repo import file_at, git
|
from git_cli.git_repo import file_at, git
|
||||||
|
|||||||
@@ -80,15 +80,19 @@ def unanswered_round(titles: list[str], pass_: str) -> int | Failure:
|
|||||||
return done + 1
|
return done + 1
|
||||||
|
|
||||||
|
|
||||||
def reviewer_header(default: str, pass_: str, rerun: bool, home: pathlib.Path) -> str | Failure:
|
def branch_summaries(default: str, home: pathlib.Path) -> list[str] | Failure:
|
||||||
"""Writes the branch diff, the places and the plan's listing into the review folder, and returns the header that launches pass_'s reviewer in the pass's unanswered round, or its relaunch one rung up where rerun."""
|
"""The branch's commit titles since default, each read as its summary in the project's title templates, so round titles count under any template. rule-hook's round-cap reads them its own way: guarded, and counting zero rounds where git fails."""
|
||||||
titles = branch_titles(default)
|
titles = branch_titles(default)
|
||||||
if isinstance(titles, Failure):
|
if isinstance(titles, Failure):
|
||||||
return titles
|
return titles
|
||||||
templates = title_templates(None, home)
|
templates = title_templates(None, home)
|
||||||
if isinstance(templates, Failure):
|
return templates if isinstance(templates, Failure) else [templates.summary(title) for title in titles]
|
||||||
return templates
|
|
||||||
round_ = unanswered_round([templates.summary(title) for title in titles], pass_)
|
|
||||||
|
def reviewer_header(default: str, pass_: str, rerun: bool, home: pathlib.Path) -> str | Failure:
|
||||||
|
"""Writes the branch diff, the places and the plan's listing into the review folder, and returns the header that launches pass_'s reviewer in the pass's unanswered round, or its relaunch one rung up where rerun."""
|
||||||
|
summaries = branch_summaries(default, home)
|
||||||
|
round_ = summaries if isinstance(summaries, Failure) else unanswered_round(summaries, pass_)
|
||||||
if isinstance(round_, Failure):
|
if isinstance(round_, Failure):
|
||||||
return round_
|
return round_
|
||||||
found = [top(), *(git(*args) for args in (["symbolic-ref", "--short", "HEAD"], ["rev-parse", "--short", "HEAD"], ["merge-base", "HEAD", default]))]
|
found = [top(), *(git(*args) for args in (["symbolic-ref", "--short", "HEAD"], ["rev-parse", "--short", "HEAD"], ["merge-base", "HEAD", default]))]
|
||||||
|
|||||||
@@ -1,23 +1,17 @@
|
|||||||
"""round-title: print the opening of a round commit's title, counted from the round's report."""
|
"""round-title: print the opening of a round commit's title, counted from the round's report."""
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from git_cli.git_repo import branch_titles, top
|
from larv_review.reviewer_header import branch_summaries, unanswered_round
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from review_rules.review_folder import findings_in, review_folder, standing_report
|
from review_rules.review_folder import findings_in, review_folder, standing_report
|
||||||
from review_rules.round_titles import round_prefix
|
from review_rules.round_titles import round_prefix
|
||||||
from project_config.main import title_templates
|
from git_cli.git_repo import top
|
||||||
from larv_review.reviewer_header import unanswered_round
|
|
||||||
|
|
||||||
|
|
||||||
def round_title(default: str, pass_: str, home: pathlib.Path) -> str | Failure:
|
def round_title(default: str, pass_: str, home: pathlib.Path) -> str | Failure:
|
||||||
"""The title prefix of pass_'s unanswered round, counted from that round's report in the chunk's review folder."""
|
"""The title prefix of pass_'s unanswered round, counted from that round's report in the chunk's review folder."""
|
||||||
titles = branch_titles(default)
|
summaries = branch_summaries(default, home)
|
||||||
if isinstance(titles, Failure):
|
round_ = summaries if isinstance(summaries, Failure) else unanswered_round(summaries, pass_)
|
||||||
return titles
|
|
||||||
templates = title_templates(None, home)
|
|
||||||
if isinstance(templates, Failure):
|
|
||||||
return templates
|
|
||||||
round_ = unanswered_round([templates.summary(title) for title in titles], pass_)
|
|
||||||
if isinstance(round_, Failure):
|
if isinstance(round_, Failure):
|
||||||
return round_
|
return round_
|
||||||
worktree = top()
|
worktree = top()
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""When the plan calls a scoring run: a chunk that ships a floor item, one that empties a release that work has already landed towards, or one after a release cut unmeasured; and each reason it gives."""
|
||||||
|
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from release_plan.release_standing import Cut, LastCut, next_release, project_plan, standing_of, Unknown
|
from release_plan.release_standing import Cut, LastCut, next_release, project_plan, standing_of, Unknown
|
||||||
@@ -15,7 +15,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
|||||||
from larv_review.agreement import agreement_report, ruling_agreement, run_agreement
|
from larv_review.agreement import agreement_report, ruling_agreement, run_agreement
|
||||||
from review_rules.comprehension_history import appended, entries, HistoryChange, latest_places, Place, recorded, ruling_entry, scoring_entry, ScoringRun, Seat
|
from review_rules.comprehension_history import appended, entries, HistoryChange, latest_places, Place, recorded, ruling_entry, scoring_entry, ScoringRun, Seat
|
||||||
from larv_review.history_commands import appended_to
|
from larv_review.history_commands import appended_to
|
||||||
from larv_review.plan import checkout_plan, Emptied, EMPTIED_WORDS, landed_towards, plan_reasons, scoring_run_due
|
from larv_review.scoring_due import checkout_plan, Emptied, EMPTIED_WORDS, landed_towards, plan_reasons, scoring_run_due
|
||||||
from review_rules import comprehension_history
|
from review_rules import comprehension_history
|
||||||
from project_config.doubles import configured
|
from project_config.doubles import configured
|
||||||
from larv_review.ruling import counted, ruling, split, surplus, votes
|
from larv_review.ruling import counted, ruling, split, surplus, votes
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import collections
|
|||||||
import dataclasses
|
import dataclasses
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from claude_code.entries import AssistantTurn, Entry, messages, parse_entry, tool_calls, ToolCall, usage_count
|
from claude_code.entries import AssistantTurn, entries_of, Entry, messages, tool_calls, ToolCall, usage_count
|
||||||
from git_cli.git_command import commits
|
from git_cli.git_command import commits
|
||||||
from reading_cost.shell_reads import Reads, shell_reads
|
from reading_cost.shell_reads import Reads, shell_reads
|
||||||
from command_lines.shell_command import resolved, simple_commands
|
from command_lines.shell_command import resolved, simple_commands
|
||||||
@@ -38,10 +38,6 @@ def measure(threads: list[bytes], checkout: Checkout, home: str) -> Reading | No
|
|||||||
return Reading(sum(map(tokens_in, before)), files)
|
return Reading(sum(map(tokens_in, before)), files)
|
||||||
|
|
||||||
|
|
||||||
def entries_of(raw: bytes) -> list[Entry]:
|
|
||||||
return [entry for line in raw.splitlines() if (entry := parse_entry(line))]
|
|
||||||
|
|
||||||
|
|
||||||
def commit_time(worker: list[Entry], home: str) -> str | None:
|
def commit_time(worker: list[Entry], home: str) -> str | None:
|
||||||
return next((turn.timestamp for turn, call in tool_calls(worker) if call.name == "Bash" and commits(simple_commands(str(call.input.get("command", "")), turn.cwd, home), home)), None)
|
return next((turn.timestamp for turn, call in tool_calls(worker) if call.name == "Bash" and commits(simple_commands(str(call.input.get("command", "")), turn.cwd, home), home)), None)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import contextlib
|
|||||||
import dataclasses
|
import dataclasses
|
||||||
import fcntl
|
import fcntl
|
||||||
import functools
|
import functools
|
||||||
import io
|
|
||||||
import json
|
import json
|
||||||
import pathlib
|
import pathlib
|
||||||
import typing
|
import typing
|
||||||
@@ -14,7 +13,7 @@ from branch_chunks.cut import BranchChunk
|
|||||||
from transcript_archive.project_key import checkout_of
|
from transcript_archive.project_key import checkout_of
|
||||||
from routing_figures.chunk import Chunk, chunk_figures, ChunkFigures, Subagent
|
from routing_figures.chunk import Chunk, chunk_figures, ChunkFigures, Subagent
|
||||||
from git_cli.git_repo import default_ref, Git
|
from git_cli.git_repo import default_ref, Git
|
||||||
from claude_code.entries import Entry, parse_entry
|
from claude_code.entries import entries_of, Entry
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from text_files.compressed import read_stored
|
from text_files.compressed import read_stored
|
||||||
from text_files.file_writes import replace_file
|
from text_files.file_writes import replace_file
|
||||||
@@ -117,7 +116,7 @@ def branch_history(checkout: str, home: pathlib.Path, titles: Titles, git: Git)
|
|||||||
|
|
||||||
|
|
||||||
def entries(path: pathlib.Path) -> list[Entry]:
|
def entries(path: pathlib.Path) -> list[Entry]:
|
||||||
return [entry for line in io.BytesIO(read_stored(path)) if (entry := parse_entry(line))]
|
return entries_of(read_stored(path))
|
||||||
|
|
||||||
|
|
||||||
def subagent(transcript: pathlib.Path) -> Subagent:
|
def subagent(transcript: pathlib.Path) -> Subagent:
|
||||||
|
|||||||
+13
-14
@@ -5,9 +5,10 @@ import collections
|
|||||||
import re
|
import re
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from claude_code.entries import AssistantTurn, parse_entry, Text, tool_calls, ToolCall, ToolResult, ToolResults
|
from claude_code.entries import AssistantTurn, Entry, Text, tool_calls, ToolCall, ToolResult, ToolResults
|
||||||
from task_bench.figures import HOME, WORK
|
from task_bench.runs import HOME, WORK
|
||||||
from reading_cost.measure import reads_of
|
from reading_cost.measure import reads_of
|
||||||
|
from task_bench.figures import Side
|
||||||
|
|
||||||
# A trace keeps the first TEXT_LINES lines of the model's text between two calls, and the first TEXT_WIDTH characters of each.
|
# A trace keeps the first TEXT_LINES lines of the model's text between two calls, and the first TEXT_WIDTH characters of each.
|
||||||
TEXT_LINES = 3
|
TEXT_LINES = 3
|
||||||
@@ -22,12 +23,12 @@ AROUND_HITS = re.compile(r"Found \d+ .*|No \w+ found.*|No entries at this offset
|
|||||||
|
|
||||||
class Run(typing.NamedTuple):
|
class Run(typing.NamedTuple):
|
||||||
"""One run of a bug: the name of its stream's file without the suffix, whether its fix passed, the tokens it spent, None where
|
"""One run of a bug: the name of its stream's file without the suffix, whether its fix passed, the tokens it spent, None where
|
||||||
it didn't finish, and its stream."""
|
it didn't finish, and its stream's entries."""
|
||||||
|
|
||||||
id: str
|
id: str
|
||||||
passed: bool
|
passed: bool
|
||||||
tokens: int | None
|
tokens: int | None
|
||||||
stream: bytes
|
entries: typing.Sequence[Entry]
|
||||||
|
|
||||||
|
|
||||||
class Bug(typing.NamedTuple):
|
class Bug(typing.NamedTuple):
|
||||||
@@ -40,7 +41,7 @@ class Bug(typing.NamedTuple):
|
|||||||
runs: list[Run]
|
runs: list[Run]
|
||||||
|
|
||||||
|
|
||||||
def digest(sides: dict[str, str], table: list[str], bugs: list[Bug], is_file: typing.Callable[[str], bool]) -> str:
|
def digest(sides: dict[Side, str], table: list[str], bugs: list[Bug], is_file: typing.Callable[[str], bool]) -> str:
|
||||||
"""The digest of a bench of the commits sides names: where each side's code is, the table of its figures, then each bug.
|
"""The digest of a bench of the commits sides names: where each side's code is, the table of its figures, then each bug.
|
||||||
is_file says whether a path in the project names a file."""
|
is_file says whether a path in the project names a file."""
|
||||||
code = f"Base {sides['base']}, head {sides['head']}. A bug's name gives its line at the base. Each side's code without the bugs is in `trees/base` and `trees/head` in the bench's folder."
|
code = f"Base {sides['base']}, head {sides['head']}. A bug's name gives its line at the base. Each side's code without the bugs is in `trees/base` and `trees/head` in the bench's folder."
|
||||||
@@ -50,7 +51,7 @@ def digest(sides: dict[str, str], table: list[str], bugs: list[Bug], is_file: ty
|
|||||||
def told(bug: Bug, is_file: typing.Callable[[str], bool]) -> list[str]:
|
def told(bug: Bug, is_file: typing.Callable[[str], bool]) -> list[str]:
|
||||||
passing, failing = [run for run in bug.runs if run.passed], [run for run in bug.runs if not run.passed]
|
passing, failing = [run for run in bug.runs if run.passed], [run for run in bug.runs if not run.passed]
|
||||||
passed = f"{len(passing)} of the {len(bug.runs)} runs passed." if failing else f"The {counted(len(bug.runs), 'run')} passed."
|
passed = f"{len(passing)} of the {len(bug.runs)} runs passed." if failing else f"The {counted(len(bug.runs), 'run')} passed."
|
||||||
misled = decoys([run.stream for run in failing], bug.file, is_file)
|
misled = decoys([run.entries for run in failing], bug.file, is_file)
|
||||||
if not failing:
|
if not failing:
|
||||||
found = "No run failed, so the bug has no decoys."
|
found = "No run failed, so the bug has no decoys."
|
||||||
elif not misled:
|
elif not misled:
|
||||||
@@ -77,27 +78,25 @@ def told(bug: Bug, is_file: typing.Callable[[str], bool]) -> list[str]:
|
|||||||
"",
|
"",
|
||||||
f"{passed} {found}",
|
f"{passed} {found}",
|
||||||
*(["", *(f"- {decoy}" for decoy in misled)] if misled else []),
|
*(["", *(f"- {decoy}" for decoy in misled)] if misled else []),
|
||||||
*(line for run, why in shown for line in ["", f"### {run.id}, {why}", "", *trace(run.stream)]),
|
*(line for run, why in shown for line in ["", f"### {run.id}, {why}", "", *trace(run.entries)]),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def decoys(failing: list[bytes], fixed: str, is_file: typing.Callable[[str], bool]) -> list[str]:
|
def decoys(failing: list[typing.Sequence[Entry]], fixed: str, is_file: typing.Callable[[str], bool]) -> list[str]:
|
||||||
"""The files of the project that more than half of the failing runs' streams read, but for fixed, the file the bug is in:
|
"""The files of the project that more than half of the failing runs read, but for fixed, the file the bug is in:
|
||||||
each with how many runs read it, sorted by name."""
|
each with how many runs read it, sorted by name."""
|
||||||
read_by = collections.Counter(path for stream in failing for path in files_read(stream))
|
read_by = collections.Counter(path for entries in failing for path in files_read(entries))
|
||||||
by = lambda count: "the one failing run" if len(failing) == 1 else f"{count} of the {len(failing)} failing runs"
|
by = lambda count: "the one failing run" if len(failing) == 1 else f"{count} of the {len(failing)} failing runs"
|
||||||
return [f"`{path}`, read by {by(count)}" for path, count in sorted(read_by.items()) if count * 2 > len(failing) and path != fixed and is_file(path)]
|
return [f"`{path}`, read by {by(count)}" for path, count in sorted(read_by.items()) if count * 2 > len(failing) and path != fixed and is_file(path)]
|
||||||
|
|
||||||
|
|
||||||
def files_read(stream: bytes) -> set[str]:
|
def files_read(entries: typing.Sequence[Entry]) -> set[str]:
|
||||||
"""The paths in the project that the run opened or searched, a folder it searched among them."""
|
"""The paths in the project that the run opened or searched, a folder it searched among them."""
|
||||||
entries = [entry for line in stream.splitlines() if (entry := parse_entry(line))]
|
|
||||||
return {path.removeprefix(WORK + "/") for _, call in tool_calls(entries) for path in reads_of(call, WORK, HOME).read if path.startswith(WORK + "/")}
|
return {path.removeprefix(WORK + "/") for _, call in tool_calls(entries) for path in reads_of(call, WORK, HOME).read if path.startswith(WORK + "/")}
|
||||||
|
|
||||||
|
|
||||||
def trace(stream: bytes) -> list[str]:
|
def trace(entries: typing.Sequence[Entry]) -> list[str]:
|
||||||
"""The run in short: a line per tool call, and between calls the first TEXT_LINES lines of what the model wrote, each after `> `."""
|
"""The run in short: a line per tool call, and between calls the first TEXT_LINES lines of what the model wrote, each after `> `."""
|
||||||
entries = [entry for line in stream.splitlines() if (entry := parse_entry(line))]
|
|
||||||
results = {result.tool_use_id: result for entry in entries if isinstance(entry, ToolResults) for result in entry.results}
|
results = {result.tool_use_id: result for entry in entries if isinstance(entry, ToolResults) for result in entry.results}
|
||||||
return [line for entry in entries if isinstance(entry, AssistantTurn) for part in entry.parts for line in (written(part.text) if isinstance(part, Text) else [called(part, results.get(part.id))])]
|
return [line for entry in entries if isinstance(entry, AssistantTurn) for part in entry.parts for line in (written(part.text) if isinstance(part, Text) else [called(part, results.get(part.id))])]
|
||||||
|
|
||||||
|
|||||||
+65
-41
@@ -3,18 +3,17 @@ import dataclasses
|
|||||||
import statistics
|
import statistics
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
|
from claude_code.entries import Entry, entry_from, tool_calls, ToolCall
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from claude_code.entries import json_object, parse_entry, tool_calls, ToolCall
|
from task_bench.runs import HOME, WORK
|
||||||
from reading_cost.measure import reads_of
|
from reading_cost.measure import reads_of
|
||||||
from claude_code.tokens import Tokens, tokens_of
|
from claude_code.tokens import Tokens, tokens_of
|
||||||
|
|
||||||
# Where each run's container mounts its copy of the code, and its home folder: the paths in a run's stream start there.
|
|
||||||
WORK = "/work"
|
|
||||||
HOME = "/tmp"
|
|
||||||
# The tools that read or search without a shell. A Bash call counts where `reads_of` finds a file it reads.
|
# The tools that read or search without a shell. A Bash call counts where `reads_of` finds a file it reads.
|
||||||
READING_TOOLS = frozenset({"Glob", "Grep", "Read"})
|
READING_TOOLS = frozenset({"Glob", "Grep", "Read"})
|
||||||
SIDES = ("base", "head")
|
# A bench's two sides: the commit before the change and the one after it.
|
||||||
HEADER = ["| Bug | Side | Passed | Input | Cache write | Cache read | Output | Turns | Wall, s | Reads |", "|---|---|---|---|---|---|---|---|---|---|"]
|
Side = typing.Literal["base", "head"]
|
||||||
|
SIDES: tuple[Side, Side] = ("base", "head")
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(frozen=True)
|
||||||
@@ -30,30 +29,54 @@ class Figures:
|
|||||||
|
|
||||||
|
|
||||||
class Result(typing.NamedTuple):
|
class Result(typing.NamedTuple):
|
||||||
"""One run of a task at a side. figures is None where its claude ended without a result, as when it ran out of time."""
|
"""One run of a task at a side. figures is None where its claude ended without a result, as when it ran out of time. entries
|
||||||
|
holds the entries of its stream, which the digest quotes."""
|
||||||
|
|
||||||
task: int
|
task: int
|
||||||
side: str
|
side: Side
|
||||||
run: int
|
run: int
|
||||||
passed: bool
|
passed: bool
|
||||||
figures: Figures | None
|
figures: Figures | None
|
||||||
|
entries: typing.Sequence[Entry] = ()
|
||||||
|
|
||||||
|
|
||||||
def figures(stream: bytes, bug_file: str) -> Figures | None | Failure:
|
class Column(typing.NamedTuple):
|
||||||
"""The figures of the run whose claude printed stream, with bug_file the bug's file as the run's container names it.
|
"""A figure the table shows: its heading, its value in one run, None where the run has none, and whether the head's change
|
||||||
|
in it is a share of the base or a count."""
|
||||||
|
|
||||||
|
heading: str
|
||||||
|
value: typing.Callable[[Figures], float | None]
|
||||||
|
change: typing.Literal["share", "count"]
|
||||||
|
|
||||||
|
|
||||||
|
# Turns and reads are small counts, where a share misleads.
|
||||||
|
COLUMNS = (
|
||||||
|
Column("Input", lambda found: found.tokens.input, "share"),
|
||||||
|
Column("Cache write", lambda found: found.tokens.write_5m + found.tokens.write_1h, "share"),
|
||||||
|
Column("Cache read", lambda found: found.tokens.read, "share"),
|
||||||
|
Column("Output", lambda found: found.tokens.output, "share"),
|
||||||
|
Column("Turns", lambda found: found.turns, "count"),
|
||||||
|
Column("Wall, s", lambda found: found.seconds, "share"),
|
||||||
|
Column("Reads", lambda found: found.reads, "count"),
|
||||||
|
)
|
||||||
|
HEADINGS = ["Bug", "Side", "Passed", *(column.heading for column in COLUMNS)]
|
||||||
|
|
||||||
|
|
||||||
|
def figures(events: list[dict], bug_file: str) -> Figures | None | Failure:
|
||||||
|
"""The figures of the run whose claude printed events, the objects parsed from its stream's lines, with bug_file the bug's file as the run's
|
||||||
|
container names it.
|
||||||
|
|
||||||
None where the stream holds no result. A Failure where the API refused the run, as on a token it doesn't take: such a run
|
None where the stream holds no result. A Failure where the API refused the run, as on a token it doesn't take: such a run
|
||||||
doesn't measure anything, and every later run would end the same."""
|
doesn't measure anything, and every later run would end the same."""
|
||||||
events = [event for line in stream.splitlines() if (event := json_object(line))]
|
|
||||||
result = next((event for event in reversed(events) if event.get("type") == "result"), None)
|
result = next((event for event in reversed(events) if event.get("type") == "result"), None)
|
||||||
if result is None:
|
if result is None:
|
||||||
return None
|
return None
|
||||||
if result.get("api_error_status"):
|
# Claude Code retries a failed API call itself, on 429, 529 and 5xx, up to CLAUDE_CODE_MAX_RETRIES times, so its retries didn't clear this one.
|
||||||
|
if result.get("api_error_status") or result.get("terminal_reason") == "api_error":
|
||||||
return Failure(f"claude could not use the API: {result.get('result')}")
|
return Failure(f"claude could not use the API: {result.get('result')}")
|
||||||
# {"type": "system", "subtype": "init", "model": "claude-haiku-5-5", "claude_code_version": "2.1.330", ...}
|
# {"type": "system", "subtype": "init", "model": "claude-haiku-5-5", "claude_code_version": "2.1.330", ...}
|
||||||
init = next((event for event in events if event.get("subtype") == "init"), {})
|
init = next((event for event in events if event.get("subtype") == "init"), {})
|
||||||
entries = [entry for line in stream.splitlines() if (entry := parse_entry(line))]
|
calls = [call for _, call in tool_calls([entry_from(event) for event in events])]
|
||||||
calls = [call for _, call in tool_calls(entries)]
|
|
||||||
return Figures(str(init.get("claude_code_version", "")), str(init.get("model", "")), tokens_of(result.get("usage")), int(result.get("num_turns") or 0), (result.get("duration_ms") or 0) / 1000, reads_before(calls, bug_file))
|
return Figures(str(init.get("claude_code_version", "")), str(init.get("model", "")), tokens_of(result.get("usage")), int(result.get("num_turns") or 0), (result.get("duration_ms") or 0) / 1000, reads_before(calls, bug_file))
|
||||||
|
|
||||||
|
|
||||||
@@ -68,42 +91,43 @@ def reads_before(calls: list[ToolCall], bug_file: str) -> int | None:
|
|||||||
|
|
||||||
|
|
||||||
def table(results: list[Result], tasks: dict[int, str]) -> list[str]:
|
def table(results: list[Result], tasks: dict[int, str]) -> list[str]:
|
||||||
"""A row per task and side, then one per side over every task, then the head's change against the base. Each figure is the
|
"""A row per task and side, then one per side over every task, then the head's change against the base, as `change` says. Each
|
||||||
median over the side's runs that have figures, and Reads over those that opened the bug's file."""
|
figure is the median over the side's runs that have figures, and Reads over those that opened the bug's file."""
|
||||||
rows = [row(f"{task}: {tasks[task]}", side, [result for result in results if (result.task, result.side) == (task, side)]) for task in sorted(tasks) for side in SIDES]
|
sides = {(task, side): [result for result in results if (result.task, result.side) == (task, side)] for task in tasks for side in SIDES}
|
||||||
|
rows = [row(f"{task}: {tasks[task]}", side, sides[task, side]) for task in sorted(tasks) for side in SIDES]
|
||||||
base, head = ([result for result in results if result.side == side] for side in SIDES)
|
base, head = ([result for result in results if result.side == side] for side in SIDES)
|
||||||
return [*HEADER, *rows, row("All", "base", base), row("All", "head", head), change(base, head)]
|
return [cells(HEADINGS), cells(["---"] * len(HEADINGS)).replace(" ", ""), *rows, row("All", "base", base), row("All", "head", head), change([(sides[task, "base"], sides[task, "head"]) for task in sorted(tasks)])]
|
||||||
|
|
||||||
|
|
||||||
def medians(results: list[Result]) -> list[float | None]:
|
def median(column: Column, results: list[Result]) -> float | None:
|
||||||
"""Input, cache write, cache read, output, turns, wall time and reads."""
|
"""The column's median over the runs that have a value in it."""
|
||||||
measured = [result.figures for result in results if result.figures]
|
values = [value for result in results if result.figures and (value := column.value(result.figures)) is not None]
|
||||||
columns: list[list[float]] = [
|
return statistics.median(values) if values else None
|
||||||
[found.tokens.input for found in measured],
|
|
||||||
[found.tokens.write_5m + found.tokens.write_1h for found in measured],
|
|
||||||
[found.tokens.read for found in measured],
|
|
||||||
[found.tokens.output for found in measured],
|
|
||||||
[found.turns for found in measured],
|
|
||||||
[found.seconds for found in measured],
|
|
||||||
[found.reads for found in measured if found.reads is not None],
|
|
||||||
]
|
|
||||||
return [statistics.median(column) if column else None for column in columns]
|
|
||||||
|
|
||||||
|
|
||||||
def row(task: str, side: str, results: list[Result]) -> str:
|
def row(task: str, side: str, results: list[Result]) -> str:
|
||||||
passed = f"{sum(result.passed for result in results)}/{len(results)}"
|
passed = f"{sum(result.passed for result in results)}/{len(results)}"
|
||||||
return cells([task, side, passed, *("-" if median is None else number(median) for median in medians(results))])
|
return cells([task, side, passed, *("-" if (found := median(column, results)) is None else number(found) for column in COLUMNS)])
|
||||||
|
|
||||||
|
|
||||||
def change(base: list[Result], head: list[Result]) -> str:
|
def change(bugs: list[tuple[list[Result], list[Result]]]) -> str:
|
||||||
"""The head's row less the base's: a count as the difference, and tokens and wall time as that difference's share of the base's."""
|
"""The head's change against the base, from each bug's base runs and head runs. The pass count is the difference over every
|
||||||
passed = sum(result.passed for result in head) - sum(result.passed for result in base)
|
run. Each other figure is the mean, over the bugs, of the bug's own change: its head median less its base median, shown
|
||||||
pairs = list(zip(medians(base), medians(head)))
|
as a share of the base median for tokens and wall time, and as a count for turns and reads. This isn't the change from the All
|
||||||
shares = [None if was is None or now is None or not was else f"{number(round(100 * (now - was) / was), signed=True)} %" for was, now in pairs]
|
base row to the All head row: those medians land in whichever bug's runs sit in the middle of the pooled costs."""
|
||||||
counts = [None if was is None or now is None else number(now - was, signed=True) for was, now in pairs]
|
passed = sum(result.passed for _, head in bugs for result in head) - sum(result.passed for base, _ in bugs for result in base)
|
||||||
# Turns and reads are small counts, where a share misleads.
|
means = [mean_change([(median(column, base), median(column, head)) for base, head in bugs], share=column.change == "share") for column in COLUMNS]
|
||||||
mixed = [*shares[:4], counts[4], shares[5], counts[6]]
|
return cells(["All", "change", number(passed, signed=True), *(found or "-" for found in means)])
|
||||||
return cells(["All", "change", number(passed, signed=True), *(found or "-" for found in mixed)])
|
|
||||||
|
|
||||||
|
def mean_change(pairs: list[tuple[float | None, float | None]], share: bool) -> str | None:
|
||||||
|
"""The mean of the bugs' changes in one figure, from each bug's (base median, head median). A bug counts only where both
|
||||||
|
medians exist and, for a share, the base median isn't zero; None where no bug counts."""
|
||||||
|
changes = [(now - was) * (100 / was if share else 1) for was, now in pairs if was is not None and now is not None and (was or not share)]
|
||||||
|
if not changes:
|
||||||
|
return None
|
||||||
|
mean = statistics.mean(changes)
|
||||||
|
return f"{number(round(mean), signed=True)} %" if share else number(mean, signed=True)
|
||||||
|
|
||||||
|
|
||||||
def number(value: float, signed: bool = False) -> str:
|
def number(value: float, signed: bool = False) -> str:
|
||||||
|
|||||||
+216
-108
@@ -30,21 +30,27 @@ the copy's top, with no network, so the image must hold what the tests would oth
|
|||||||
base, which $PWD names, with `gremlins unleash ...` as "$@". Without it, the bench runs the `gremlins` on the host's PATH. For
|
base, which $PWD names, with `gremlins unleash ...` as "$@". Without it, the bench runs the `gremlins` on the host's PATH. For
|
||||||
example:
|
example:
|
||||||
|
|
||||||
docker run --rm --memory 8g --memory-swap 8g -v "$PWD:$PWD" -w "$PWD" golang:1.27.4 \
|
docker run --rm --memory 16g --memory-swap 16g -v "$PWD:$PWD" -w "$PWD" golang:1.27.4 \
|
||||||
sh -c 'shift; exec go run github.com/go-gremlins/gremlins/cmd/gremlins@v0.6.0 "$@"' sh
|
sh -c 'shift; exec go run github.com/go-gremlins/gremlins/cmd/gremlins@v0.6.0 "$@"' sh
|
||||||
|
|
||||||
It prints the base and the head, then a table: a row per bug and side with how many fixes passed and the medians, over the runs
|
It prints the base and the head, then a table: a row per bug and side with how many fixes passed and the medians, over the runs
|
||||||
that finished, of the input, cache-write, cache-read and output tokens, the turns, the wall time, and the reads and searches before
|
that finished, of the input, cache-write, cache-read and output tokens, the turns, the wall time, and the reads and searches before
|
||||||
the run first opened the file the bug is in. The median of the reads leaves out a run that never opened that file. Then come a row
|
the run first opened the file the bug is in. The median of the reads leaves out a run that never opened that file. Then come a row
|
||||||
per side over every bug, and the head's change against the base. The last line names the bench's folder: `task-bench` in the
|
per side over every bug, and the head's change against the base. That last row holds the pass count's difference and, for each other
|
||||||
chunk's review folder.
|
column, the mean over the bugs of each bug's own change, so it isn't the difference of the two rows above it. The last line names
|
||||||
|
the bench's folder: `task-bench` in the chunk's review folder.
|
||||||
|
|
||||||
That folder holds each run's result and stream, and digest.md, which says why runs failed in a few kilobytes per bug:
|
That folder holds each run's result and stream, and digest.md, which says why runs failed in a few kilobytes per bug:
|
||||||
- the table;
|
- the table;
|
||||||
- per bug its decoys, the files more than half of its failing runs read that the bug isn't in;
|
- per bug its decoys, the files more than half of its failing runs read that the bug isn't in;
|
||||||
- per bug up to two traces: of a failing run, one that didn't finish or else the one that spent the most tokens, and of the
|
- per bug up to two traces: of a failing run, one that didn't finish or else the one that spent the most tokens, and of the
|
||||||
passing run with the median tokens. A trace has a line per tool call, such as `Read pick.go:120-180` or `Grep "readName" → 4 hits`, and the first 3 lines of what Haiku wrote
|
passing run with the median tokens. A trace has a line per tool call, such as `Read pick.go:120-180` or `Grep "readName" → 4
|
||||||
between calls.
|
hits`, and the first 3 lines of what Haiku wrote between calls.
|
||||||
|
|
||||||
|
Read a change against the noise. Measured on `fejkdata`, a Go project, with the defaults, a bench of a commit against itself shows,
|
||||||
|
in 19 cases of 20, an All change under 12% in output tokens, 16% in cache-read tokens and 10% in wall time. On its bugs every run
|
||||||
|
passed, so the pass rate's noise is unmeasured.
|
||||||
|
`docs/decisions.md` → `task-bench: a bench takes` has the figures.
|
||||||
|
|
||||||
`task-bench gather`, run in the same checkout, turns the digest into plan items. It starts a claude on the project's rung, the
|
`task-bench gather`, run in the same checkout, turns the digest into plan items. It starts a claude on the project's rung, the
|
||||||
cheapest rung of the model loop-claude runs the project on, with the digest and the prompt in gather-prompt.md beside this file.
|
cheapest rung of the model loop-claude runs the project on, with the digest and the prompt in gather-prompt.md beside this file.
|
||||||
@@ -55,7 +61,7 @@ Each bench empties its own folder first, and removes the folder every earlier be
|
|||||||
not, unless a bench or a gather is using it. So gather a bench before the next one starts.
|
not, unless a bench or a gather is using it. So gather a bench before the next one starts.
|
||||||
|
|
||||||
Exit 1, saying why, on an unknown or repeated argument, a missing --image or --test, a --seed, --bugs or --runs that is no whole
|
Exit 1, saying why, on an unknown or repeated argument, a missing --image or --test, a --seed, --bugs or --runs that is no whole
|
||||||
number from 1, or no token; and where git, docker or Gremlins fails, the seats' places name no Go file, the tests fail at a side
|
number from 1, or no token; and where git, docker or Gremlins fails, the seats' places don't name any Go file, the tests fail at a side
|
||||||
without a bug, or no mutant becomes a bug. Where the API refuses a run, the bench stops there and exits 1 too, after the table of
|
without a bug, or no mutant becomes a bug. Where the API refuses a run, the bench stops there and exits 1 too, after the table of
|
||||||
the runs that finished.
|
the runs that finished.
|
||||||
gather exits 1, saying why, outside a checkout, without a digest, where loop-claude has saved no model for the project or the
|
gather exits 1, saying why, outside a checkout, without a digest, where loop-claude has saved no model for the project or the
|
||||||
@@ -73,17 +79,18 @@ import tarfile
|
|||||||
import typing
|
import typing
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from task_bench.digest import Bug, digest, Run
|
from task_bench.digest import Bug, counted, digest, Run
|
||||||
from task_bench.runs import checked_tree, closed, Containers, docker_cli, fix_attempted, MEMORY_MIB, opened, ran_tests, TimedOut, TOKEN
|
from task_bench.plant import bug_at_sides, drawn, killed_mutants, Mutant, place_files, task_text
|
||||||
|
from task_bench.runs import checked_tree, closed, Containers, docker_cli, fix_attempted, MEMORY_MIB, opened, ran_tests, TimedOut, TOKEN, WORK
|
||||||
from claude_code.reply import Claude
|
from claude_code.reply import Claude
|
||||||
from task_bench.bench_folder import clear_left, held
|
from task_bench.bench_folder import clear_left, held
|
||||||
from machine_load.slots import CPUS_PER_SLOT
|
from machine_load.slots import CPUS_PER_SLOT
|
||||||
from git_cli.git_repo import default_ref, Git, top
|
from git_cli.git_repo import default_ref, Git, top
|
||||||
from task_bench.gather import DIGEST, gather, run_claude
|
from task_bench.gather import DIGEST, gather, run_claude
|
||||||
from task_bench.plant import drawn, killed_mutants, line_at_head, Mutant, mutated, place_files, task_text
|
from claude_code.entries import entry_from, json_objects
|
||||||
from mutate_changes.tool_process import failed, Ran, run_tool
|
from mutate_changes.tool_process import failed, Ran, run_tool
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from task_bench.figures import figures, Result, SIDES, table, WORK
|
from task_bench.figures import figures, Result, Side, SIDES, table
|
||||||
from git_cli import git_repo
|
from git_cli import git_repo
|
||||||
from review_rules.review_folder import made_review_folder, REPORTS
|
from review_rules.review_folder import made_review_folder, REPORTS
|
||||||
from larv_review.history_commands import read_places
|
from larv_review.history_commands import read_places
|
||||||
@@ -104,13 +111,40 @@ class Task:
|
|||||||
"""A bug to fix: its number from 1, the mutant at the base, and per side the planted tree and what Haiku is told there."""
|
"""A bug to fix: its number from 1, the mutant at the base, and per side the planted tree and what Haiku is told there."""
|
||||||
number: int
|
number: int
|
||||||
mutant: Mutant
|
mutant: Mutant
|
||||||
trees: dict[str, str]
|
trees: dict[Side, str]
|
||||||
messages: dict[str, str]
|
messages: dict[Side, str]
|
||||||
|
|
||||||
def named(self) -> str:
|
def named(self) -> str:
|
||||||
return f"{self.mutant.path}:{self.mutant.line}:{self.mutant.column} {self.mutant.mutator}"
|
return f"{self.mutant.path}:{self.mutant.line}:{self.mutant.column} {self.mutant.mutator}"
|
||||||
|
|
||||||
|
|
||||||
|
class Asked(typing.NamedTuple):
|
||||||
|
"""What the caller asked of a bench: the seed that orders the mutants, how many bugs to plant and how often to run each fix."""
|
||||||
|
seed: int
|
||||||
|
bugs: int
|
||||||
|
runs: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclasses.dataclass(frozen=True)
|
||||||
|
class Bench:
|
||||||
|
"""What a bench's phases share: the checkout, per side its commit and its tree without a bug, what the caller asked, the
|
||||||
|
containers, the bench's folder, git, and say, which tells the caller each run's outcome as it finishes."""
|
||||||
|
checkout: str
|
||||||
|
sides: dict[Side, str]
|
||||||
|
trees: dict[Side, str]
|
||||||
|
asked: Asked
|
||||||
|
containers: Containers
|
||||||
|
folder: pathlib.Path
|
||||||
|
git: Git
|
||||||
|
say: typing.Callable[[str], None]
|
||||||
|
|
||||||
|
|
||||||
|
class Fixes(typing.NamedTuple):
|
||||||
|
"""The runs that finished, in the order they ran, and the failure that stopped the bench before the rest, if one did."""
|
||||||
|
results: list[Result]
|
||||||
|
stopped: Failure | None
|
||||||
|
|
||||||
|
|
||||||
def main(argv: list[str], env: typing.Mapping[str, str], read: typing.Callable[[pathlib.Path], str | Failure] = read_places, claude: Claude = run_claude) -> int:
|
def main(argv: list[str], env: typing.Mapping[str, str], read: typing.Callable[[pathlib.Path], str | Failure] = read_places, claude: Claude = run_claude) -> int:
|
||||||
"""Runs task-bench with the arguments argv; git, docker and Gremlins run in the environment env, `read` reads what
|
"""Runs task-bench with the arguments argv; git, docker and Gremlins run in the environment env, `read` reads what
|
||||||
`larv-review places` prints for the checkout, and `claude` runs the claude that gathers."""
|
`larv-review places` prints for the checkout, and `claude` runs the claude that gathers."""
|
||||||
@@ -157,8 +191,22 @@ def options(argv: list[str], env: typing.Mapping[str, str]) -> dict[str, str] |
|
|||||||
return given
|
return given
|
||||||
|
|
||||||
|
|
||||||
def bench(given: dict[str, str], env: typing.Mapping[str, str], places: str, home: pathlib.Path) -> list[str] | Failure:
|
def progress(line: str) -> None:
|
||||||
"""The report of one bench of the checkout the process runs in, with `places` what `larv-review places` prints there."""
|
"""Prints a line of a bench's progress to stderr, apart from its report on stdout."""
|
||||||
|
print(line, file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
|
def on_disk[T](doing: str, act: typing.Callable[[], T]) -> T | Failure:
|
||||||
|
"""act's answer, or a Failure that says what could not be done where the filesystem refuses act."""
|
||||||
|
try:
|
||||||
|
return act()
|
||||||
|
except OSError as failure:
|
||||||
|
return Failure(f"could not {doing}: {failure}")
|
||||||
|
|
||||||
|
|
||||||
|
def bench(given: dict[str, str], env: typing.Mapping[str, str], places: str, home: pathlib.Path, say: typing.Callable[[str], None] = progress) -> list[str] | Failure:
|
||||||
|
"""The report of one bench of the checkout the process runs in, with `places` what `larv-review places` prints there; say
|
||||||
|
tells the caller the bench's progress."""
|
||||||
git = functools.partial(git_repo.git, env=env)
|
git = functools.partial(git_repo.git, env=env)
|
||||||
checkout = top(git)
|
checkout = top(git)
|
||||||
if isinstance(checkout, Failure):
|
if isinstance(checkout, Failure):
|
||||||
@@ -166,7 +214,7 @@ def bench(given: dict[str, str], env: typing.Mapping[str, str], places: str, hom
|
|||||||
sides = commits(given, checkout, git)
|
sides = commits(given, checkout, git)
|
||||||
if isinstance(sides, Failure):
|
if isinstance(sides, Failure):
|
||||||
return sides
|
return sides
|
||||||
print(f"task-bench: base {sides['base'][:12]}, head {sides['head'][:12]}.", file=sys.stderr)
|
say(f"task-bench: base {sides['base'][:12]}, head {sides['head'][:12]}.")
|
||||||
review = made_review_folder(checkout, home)
|
review = made_review_folder(checkout, home)
|
||||||
if isinstance(review, Failure):
|
if isinstance(review, Failure):
|
||||||
return review
|
return review
|
||||||
@@ -174,37 +222,34 @@ def bench(given: dict[str, str], env: typing.Mapping[str, str], places: str, hom
|
|||||||
if isinstance(folder, Failure):
|
if isinstance(folder, Failure):
|
||||||
return folder
|
return folder
|
||||||
clear_left(home / REPORTS)
|
clear_left(home / REPORTS)
|
||||||
return bench_in(folder, given, env, places, checkout, sides, git)
|
return bench_in(folder, given, env, places, checkout, sides, git, say)
|
||||||
|
|
||||||
|
|
||||||
def bench_in(folder: pathlib.Path, given: dict[str, str], env: typing.Mapping[str, str], places: str, checkout: str, sides: dict[str, str], git: Git) -> list[str] | Failure:
|
def bench_in(folder: pathlib.Path, given: dict[str, str], env: typing.Mapping[str, str], places: str, checkout: str, sides: dict[Side, str], git: Git, say: typing.Callable[[str], None]) -> list[str] | Failure:
|
||||||
"""The report of a bench of the commits sides names, which empties folder and keeps its runs there."""
|
"""The report of a bench of the commits sides names, which empties folder and keeps its runs there."""
|
||||||
containers = Containers(docker_cli(env), f"task-bench-{uuid.uuid4().hex[:12]}", given["--test"], int(env.get(SHARE_VARIABLE) or MEMORY_MIB), f"{os.getuid()}:{os.getgid()}")
|
containers = Containers(docker_cli(env), f"task-bench-{uuid.uuid4().hex[:12]}", given["--test"], int(env.get(SHARE_VARIABLE) or MEMORY_MIB), f"{os.getuid()}:{os.getgid()}")
|
||||||
|
shutil.rmtree(folder, ignore_errors=True)
|
||||||
|
trees: dict[Side, str] = {}
|
||||||
|
for side, commit in sides.items():
|
||||||
|
tree = archived(commit, folder / "trees" / side, checkout, git)
|
||||||
|
if isinstance(tree, Failure):
|
||||||
|
return tree
|
||||||
|
trees[side] = tree
|
||||||
|
files = [path for path in place_files(places) if pathlib.Path(trees["base"], path).is_file()]
|
||||||
|
if not files:
|
||||||
|
return Failure("The places the seats found hard don't name any Go file that the base holds, so there is nowhere to plant a bug.")
|
||||||
|
run = functools.partial(run_tool, prefix=given.get("--prefix"), env=env, killpg=os.killpg)
|
||||||
|
mutants = killed_mutants(trees["base"], files, run, CPUS_PER_SLOT)
|
||||||
|
if isinstance(mutants, Failure):
|
||||||
|
return mutants
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(folder, ignore_errors=True)
|
found = opened(containers, given["--image"]) or benched(Bench(checkout, sides, trees, Asked(int(given["--seed"]), int(given["--bugs"]), int(given["--runs"])), containers, folder, git, say), mutants)
|
||||||
trees: dict[str, str] = {}
|
finally:
|
||||||
for side, commit in sides.items():
|
closed(containers)
|
||||||
tree = archived(commit, folder / "trees" / side, checkout, git)
|
|
||||||
if isinstance(tree, Failure):
|
|
||||||
return tree
|
|
||||||
trees[side] = tree
|
|
||||||
files = [path for path in place_files(places) if pathlib.Path(trees["base"], path).is_file()]
|
|
||||||
if not files:
|
|
||||||
return Failure("The places the seats found hard name no Go file that the base holds, so there is nowhere to plant a bug.")
|
|
||||||
run = functools.partial(run_tool, prefix=given.get("--prefix"), env=env, killpg=os.killpg)
|
|
||||||
mutants = killed_mutants(trees["base"], files, run, CPUS_PER_SLOT)
|
|
||||||
if isinstance(mutants, Failure):
|
|
||||||
return mutants
|
|
||||||
try:
|
|
||||||
found = opened(containers, given["--image"]) or benched(given, checkout, sides, trees, mutants, containers, folder, git)
|
|
||||||
finally:
|
|
||||||
closed(containers)
|
|
||||||
except OSError as failure:
|
|
||||||
return Failure(f"could not write under {folder}: {failure}")
|
|
||||||
return found if isinstance(found, Failure) else [*found, f"{KEPT}{folder}"]
|
return found if isinstance(found, Failure) else [*found, f"{KEPT}{folder}"]
|
||||||
|
|
||||||
|
|
||||||
def commits(given: dict[str, str], checkout: str, git: Git) -> dict[str, str] | Failure:
|
def commits(given: dict[str, str], checkout: str, git: Git) -> dict[Side, str] | Failure:
|
||||||
"""The base's commit and the head's."""
|
"""The base's commit and the head's."""
|
||||||
head = git("rev-parse", "--verify", f"{given.get('--head', 'HEAD')}^{{commit}}", cwd=checkout)
|
head = git("rev-parse", "--verify", f"{given.get('--head', 'HEAD')}^{{commit}}", cwd=checkout)
|
||||||
against = given.get("--base") or default_ref(cwd=checkout, run=git)
|
against = given.get("--base") or default_ref(cwd=checkout, run=git)
|
||||||
@@ -219,7 +264,9 @@ def commits(given: dict[str, str], checkout: str, git: Git) -> dict[str, str] |
|
|||||||
def archived(commit: str, into: pathlib.Path, checkout: str, git: Git) -> str | Failure:
|
def archived(commit: str, into: pathlib.Path, checkout: str, git: Git) -> str | Failure:
|
||||||
"""Makes `into` the tree at commit, as `git archive` holds it, and returns its path: without git's own data, and without a
|
"""Makes `into` the tree at commit, as `git archive` holds it, and returns its path: without git's own data, and without a
|
||||||
path the project marks `export-ignore`."""
|
path the project marks `export-ignore`."""
|
||||||
into.mkdir(parents=True)
|
made = on_disk(f"make {into}", lambda: into.mkdir(parents=True))
|
||||||
|
if isinstance(made, Failure):
|
||||||
|
return made
|
||||||
archive = into.with_suffix(".tar")
|
archive = into.with_suffix(".tar")
|
||||||
wrote = git("archive", "--format=tar", "--output", str(archive), commit, cwd=checkout)
|
wrote = git("archive", "--format=tar", "--output", str(archive), commit, cwd=checkout)
|
||||||
if isinstance(wrote, Failure):
|
if isinstance(wrote, Failure):
|
||||||
@@ -227,51 +274,86 @@ def archived(commit: str, into: pathlib.Path, checkout: str, git: Git) -> str |
|
|||||||
try:
|
try:
|
||||||
with tarfile.open(archive) as held:
|
with tarfile.open(archive) as held:
|
||||||
held.extractall(into, filter="tar")
|
held.extractall(into, filter="tar")
|
||||||
except tarfile.TarError as failure:
|
except (tarfile.TarError, OSError) as failure:
|
||||||
return Failure(f"could not unpack the tree at {commit}: {failure}")
|
return Failure(f"could not unpack the tree at {commit}: {failure}")
|
||||||
archive.unlink()
|
removed = on_disk(f"remove {archive}", archive.unlink)
|
||||||
return str(into)
|
return removed if isinstance(removed, Failure) else str(into)
|
||||||
|
|
||||||
|
|
||||||
def benched(given: dict[str, str], checkout: str, sides: dict[str, str], trees: dict[str, str], mutants: list[Mutant], containers: Containers, folder: pathlib.Path, git: Git) -> list[str] | Failure:
|
def benched(bench: Bench, mutants: list[Mutant]) -> list[str] | Failure:
|
||||||
"""Plants the bugs, runs each fix, writes the results into folder and returns the report."""
|
"""Plants the bugs, runs each fix, writes the results into the bench's folder and returns the report."""
|
||||||
for side, tree in trees.items():
|
if failure := baseline_failure(bench):
|
||||||
ran = tests_in_copy(containers, tree, folder)
|
return failure
|
||||||
|
tasks = planted_tasks(bench, mutants)
|
||||||
|
if isinstance(tasks, Failure):
|
||||||
|
return tasks
|
||||||
|
total = bench.asked.runs * len(tasks) * len(SIDES)
|
||||||
|
fixes = ran_fixes(bench, tasks, total)
|
||||||
|
if fixes.stopped and not fixes.results:
|
||||||
|
return fixes.stopped
|
||||||
|
names = {task.number: task.named() for task in tasks}
|
||||||
|
if failure := kept(bench, tasks, names, fixes.results):
|
||||||
|
return failure
|
||||||
|
if fixes.stopped:
|
||||||
|
return stopped_report(fixes.stopped, fixes.results, total, names, bench.folder)
|
||||||
|
return report(bench.sides, names, bench.asked, fixes.results)
|
||||||
|
|
||||||
|
|
||||||
|
def baseline_failure(bench: Bench) -> Failure | None:
|
||||||
|
"""Why a side's tests don't pass without a planted bug; None where they pass at both sides."""
|
||||||
|
for side, tree in bench.trees.items():
|
||||||
|
ran = tests_in_copy(bench.containers, tree, bench.folder)
|
||||||
if isinstance(ran, Failure) or ran.code:
|
if isinstance(ran, Failure) or ran.code:
|
||||||
return ran if isinstance(ran, Failure) else failed(f"The tests fail at the {side} without a planted bug: the test command", ran)
|
return ran if isinstance(ran, Failure) else failed(f"The tests fail at the {side} without a planted bug: the test command", ran)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def planted_tasks(bench: Bench, mutants: list[Mutant]) -> list[Task] | Failure:
|
||||||
|
"""The mutants that become bugs, in the order the seed draws them, until the bench has as many as asked for."""
|
||||||
tasks: list[Task] = []
|
tasks: list[Task] = []
|
||||||
for mutant in drawn(mutants, int(given["--seed"])):
|
for mutant in drawn(mutants, bench.asked.seed):
|
||||||
if len(tasks) == int(given["--bugs"]):
|
if len(tasks) == bench.asked.bugs:
|
||||||
break
|
break
|
||||||
task = planted(len(tasks) + 1, mutant, checkout, sides, trees, containers, folder, git)
|
task = planted(bench, len(tasks) + 1, mutant)
|
||||||
if isinstance(task, Failure):
|
if isinstance(task, Failure):
|
||||||
return task
|
return task
|
||||||
tasks += [task] if task else []
|
tasks += [task] if task else []
|
||||||
if not tasks:
|
if not tasks:
|
||||||
return Failure(f"None of the {len(mutants)} mutants the tests kill becomes a bug: each is on a line the head changed, or the test it fails doesn't print a message.")
|
return Failure(f"None of the {len(mutants)} mutants the tests kill becomes a bug: each is on a line the head changed, or the test it fails doesn't print a message.")
|
||||||
|
return tasks
|
||||||
|
|
||||||
|
|
||||||
|
def ran_fixes(bench: Bench, tasks: list[Task], total: int) -> Fixes:
|
||||||
|
"""Each task's fix at each side, as many times as asked for, the sides in turn, until a run stops the bench."""
|
||||||
results: list[Result] = []
|
results: list[Result] = []
|
||||||
stopped = None
|
for number, task, side in itertools.product(range(1, bench.asked.runs + 1), tasks, SIDES):
|
||||||
total = int(given["--runs"]) * len(tasks) * len(SIDES)
|
result = fixed(task, side, number, bench.containers, bench.folder)
|
||||||
for number, task, side in itertools.product(range(1, int(given["--runs"]) + 1), tasks, SIDES):
|
|
||||||
result = fixed(task, side, number, containers, folder)
|
|
||||||
if isinstance(result, Failure):
|
if isinstance(result, Failure):
|
||||||
stopped = result
|
return Fixes(results, result)
|
||||||
break
|
|
||||||
results.append(result)
|
results.append(result)
|
||||||
print(f"task-bench: run {len(results)} of {total}, bug {task.number} at the {side}: {'passed' if result.passed else 'not passed'}.", file=sys.stderr)
|
bench.say(f"task-bench: run {len(results)} of {total}, bug {task.number} at the {side}: {'passed' if result.passed else 'not passed'}.")
|
||||||
if stopped and not results:
|
return Fixes(results, None)
|
||||||
return stopped
|
|
||||||
names = {task.number: task.named() for task in tasks}
|
|
||||||
(folder / "results.json").write_text(json.dumps({"sides": sides, "seed": int(given["--seed"]), "bugs": names, "runs": [recorded(result) for result in results]}, indent="\t") + "\n", encoding="utf-8")
|
def kept(bench: Bench, tasks: list[Task], names: dict[int, str], results: list[Result]) -> Failure | None:
|
||||||
in_a_tree = lambda path: any(pathlib.Path(tree, path).is_file() for tree in trees.values())
|
"""Writes results.json and the digest into the bench's folder. names holds each bug's name by its number."""
|
||||||
(folder / DIGEST).write_text(digest(sides, table(results, names), [digested(task, results, folder) for task in tasks], in_a_tree), encoding="utf-8", errors="replace")
|
in_a_tree = lambda path: any(pathlib.Path(tree, path).is_file() for tree in bench.trees.values())
|
||||||
if stopped:
|
recorded_runs = json.dumps({"sides": bench.sides, "seed": bench.asked.seed, "bugs": names, "runs": [recorded(result) for result in results]}, indent="\t") + "\n"
|
||||||
# The runs that finished took hours and tokens, so the bench shows them before it fails.
|
digest_text = digest(bench.sides, table(results, names), [digested(task, results, bench.folder) for task in tasks], in_a_tree)
|
||||||
return Failure("\n".join([stopped.reason, f"task-bench stopped after {len(results)} of {total} runs, which results.json holds in {folder}:", "", *table(results, names)]))
|
try:
|
||||||
|
(bench.folder / "results.json").write_text(recorded_runs, encoding="utf-8")
|
||||||
|
(bench.folder / DIGEST).write_text(digest_text, encoding="utf-8", errors="replace")
|
||||||
|
except OSError as failure:
|
||||||
|
return Failure(f"could not write the results under {bench.folder}: {failure}")
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def report(sides: dict[Side, str], names: dict[int, str], asked: Asked, results: list[Result]) -> list[str]:
|
||||||
|
"""What a finished bench prints: the commits, the bugs named in names, what ran them, and the table."""
|
||||||
ran_on = sorted({f"{found.model} in Claude Code {found.version}" for result in results if (found := result.figures)})
|
ran_on = sorted({f"{found.model} in Claude Code {found.version}" for result in results if (found := result.figures)})
|
||||||
short = [] if len(tasks) == int(given["--bugs"]) else [f"Planted {len(tasks)} of the {given['--bugs']} bugs asked for: no other mutant the tests kill becomes one."]
|
short = [] if len(names) == asked.bugs else [f"Planted {len(names)} of the {asked.bugs} bugs asked for: no other mutant the tests kill becomes one."]
|
||||||
return [
|
return [
|
||||||
f"task-bench: base {sides['base'][:12]}, head {sides['head'][:12]}. {counted(len(tasks), 'bug')}, each run {counted(int(given['--runs']), 'time')} at each side by {' and '.join(ran_on) or 'no run that finished'}.",
|
f"task-bench: base {sides['base'][:12]}, head {sides['head'][:12]}. {counted(len(names), 'bug')}, each run {counted(asked.runs, 'time')} at each side by {' and '.join(ran_on) or 'no run that finished'}.",
|
||||||
*short,
|
*short,
|
||||||
"",
|
"",
|
||||||
*table(results, names),
|
*table(results, names),
|
||||||
@@ -279,70 +361,100 @@ def benched(given: dict[str, str], checkout: str, sides: dict[str, str], trees:
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def planted(number: int, mutant: Mutant, checkout: str, sides: dict[str, str], trees: dict[str, str], containers: Containers, folder: pathlib.Path, git: Git) -> Task | Failure | None:
|
def stopped_report(stopped: Failure, results: list[Result], total: int, names: dict[int, str], folder: pathlib.Path) -> Failure:
|
||||||
"""The task of fixing mutant, with its planted tree at each side; None where the mutant doesn't become a bug at one side or the other.
|
"""Why the bench stopped, then the table of the runs that finished: they took hours and tokens, so the bench shows them
|
||||||
|
before it fails."""
|
||||||
|
return Failure("\n".join([stopped.reason, f"task-bench stopped after {len(results)} of {total} runs, which results.json holds in {folder}:", "", *table(results, names)]))
|
||||||
|
|
||||||
The bug is the same change to the same line at both sides, so only the code around it differs between them."""
|
|
||||||
diff = git("diff", "-U0", "--no-color", "--no-ext-diff", "--no-textconv", sides["base"], sides["head"], "--", mutant.path, cwd=checkout, errors="replace")
|
def planted(bench: Bench, number: int, mutant: Mutant) -> Task | Failure | None:
|
||||||
|
"""The task of fixing mutant, with its planted tree at each side; None where the mutant doesn't become a bug at one side or the other."""
|
||||||
|
diff = bench.git("diff", "-U0", "--no-color", "--no-ext-diff", "--no-textconv", bench.sides["base"], bench.sides["head"], "--", mutant.path, cwd=bench.checkout, errors="replace")
|
||||||
if isinstance(diff, Failure):
|
if isinstance(diff, Failure):
|
||||||
return diff
|
return diff
|
||||||
at_head = line_at_head(diff, mutant.line)
|
sources = on_disk(f"read {mutant.path}", lambda: {side: source.read_bytes() if (source := pathlib.Path(tree, mutant.path)).is_file() else None for side, tree in bench.trees.items()})
|
||||||
if at_head is None:
|
if isinstance(sources, Failure):
|
||||||
|
return sources
|
||||||
|
bugs = bug_at_sides(mutant, diff, sources)
|
||||||
|
if bugs is None:
|
||||||
return None
|
return None
|
||||||
planted_trees, messages = {}, {}
|
trees: dict[Side, str] = {}
|
||||||
for side, placed in (("base", mutant), ("head", mutant._replace(line=at_head))):
|
messages: dict[Side, str] = {}
|
||||||
source = pathlib.Path(trees[side], mutant.path)
|
for side, changed in bugs.items():
|
||||||
changed = mutated(source.read_bytes(), placed) if source.is_file() else None
|
tree = bench.folder / "bugs" / str(number) / side
|
||||||
if changed is None:
|
message = planted_tree(bench, side, tree, mutant.path, changed)
|
||||||
return None
|
if message is None or isinstance(message, Failure):
|
||||||
tree = folder / "bugs" / str(number) / side
|
return message
|
||||||
shutil.rmtree(tree, ignore_errors=True)
|
trees[side], messages[side] = str(tree), message
|
||||||
shutil.copytree(trees[side], tree, symlinks=True)
|
return Task(number, mutant, trees, messages)
|
||||||
(tree / mutant.path).write_bytes(changed)
|
|
||||||
ran = tests_in_copy(containers, str(tree), folder)
|
|
||||||
if isinstance(ran, Failure) and not isinstance(ran, TimedOut):
|
def planted_tree(bench: Bench, side: Side, tree: pathlib.Path, path: str, changed: bytes) -> str | Failure | None:
|
||||||
return ran
|
"""Makes tree a copy of the side's with the file at path holding changed, committed once, and returns what the failing test
|
||||||
# Tests that never end under the bug have no message to tell Haiku.
|
prints there; None where it prints no message to tell Haiku."""
|
||||||
message = None if isinstance(ran, TimedOut) else task_text(ran.output)
|
shutil.rmtree(tree, ignore_errors=True)
|
||||||
if message is None:
|
try:
|
||||||
return None
|
shutil.copytree(bench.trees[side], tree, symlinks=True)
|
||||||
for args in (["init", "--quiet"], ["add", "--all", "--force"], COMMIT):
|
(tree / path).write_bytes(changed)
|
||||||
done = git(*args, cwd=str(tree))
|
except OSError as failure:
|
||||||
if isinstance(done, Failure):
|
return Failure(f"could not plant the bug in {tree}: {failure}")
|
||||||
return done
|
ran = tests_in_copy(bench.containers, str(tree), bench.folder)
|
||||||
planted_trees[side], messages[side] = str(tree), message
|
# Tests that never end under the bug have no message.
|
||||||
return Task(number, mutant, planted_trees, messages)
|
if isinstance(ran, TimedOut):
|
||||||
|
return None
|
||||||
|
if isinstance(ran, Failure):
|
||||||
|
return ran
|
||||||
|
message = task_text(ran.output)
|
||||||
|
if message is None:
|
||||||
|
return None
|
||||||
|
for args in (["init", "--quiet"], ["add", "--all", "--force"], COMMIT):
|
||||||
|
done = bench.git(*args, cwd=str(tree))
|
||||||
|
if isinstance(done, Failure):
|
||||||
|
return done
|
||||||
|
return message
|
||||||
|
|
||||||
|
|
||||||
def tests_in_copy(containers: Containers, tree: str, folder: pathlib.Path) -> Ran | Failure:
|
def tests_in_copy(containers: Containers, tree: str, folder: pathlib.Path) -> Ran | Failure:
|
||||||
"""The test command's run in a copy of tree, removed afterwards, so what the tests write stays out of tree."""
|
"""The test command's run in a copy of tree, removed afterwards, so what the tests write stays out of tree."""
|
||||||
copy = folder / "tested"
|
copy = folder / "tested"
|
||||||
shutil.copytree(tree, copy, symlinks=True)
|
copied = on_disk(f"copy {tree} to test it", lambda: shutil.copytree(tree, copy, symlinks=True))
|
||||||
|
if isinstance(copied, Failure):
|
||||||
|
return copied
|
||||||
try:
|
try:
|
||||||
return ran_tests(containers, str(copy))
|
return ran_tests(containers, str(copy))
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(copy, ignore_errors=True)
|
shutil.rmtree(copy, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def fixed(task: Task, side: str, number: int, containers: Containers, folder: pathlib.Path) -> Result | Failure:
|
def fixed(task: Task, side: Side, number: int, containers: Containers, folder: pathlib.Path) -> Result | Failure:
|
||||||
"""One run: Haiku's fix of task at side in a copy of its planted tree, then the tests over what it changed. The stream stays in
|
"""One run: Haiku's fix of task at side in a copy of its planted tree, then the tests over what it changed. The stream stays in
|
||||||
folder; the copy is removed. Tests that run out of time don't pass."""
|
folder; the copy is removed. Tests that run out of time don't pass."""
|
||||||
stream = stream_of(Result(task.number, side, number, False, None), folder)
|
stream = stream_of(Result(task.number, side, number, False, None), folder)
|
||||||
stream.parent.mkdir(exist_ok=True)
|
|
||||||
copy, check = folder / "copy", folder / "check"
|
copy, check = folder / "copy", folder / "check"
|
||||||
try:
|
try:
|
||||||
shutil.copytree(task.trees[side], copy, symlinks=True)
|
try:
|
||||||
|
stream.parent.mkdir(exist_ok=True)
|
||||||
|
shutil.copytree(task.trees[side], copy, symlinks=True)
|
||||||
|
except OSError as failure:
|
||||||
|
return Failure(f"could not copy bug {task.number}'s tree at the {side}: {failure}")
|
||||||
attempted = fix_attempted(containers, str(copy), task.messages[side], stream)
|
attempted = fix_attempted(containers, str(copy), task.messages[side], stream)
|
||||||
if isinstance(attempted, Failure):
|
if isinstance(attempted, Failure):
|
||||||
return attempted
|
return attempted
|
||||||
found = figures(stream.read_bytes(), os.path.join(WORK, task.mutant.path))
|
raw = on_disk(f"read {stream}", stream.read_bytes)
|
||||||
|
if isinstance(raw, Failure):
|
||||||
|
return raw
|
||||||
|
events = json_objects(raw)
|
||||||
|
entries = [entry_from(event) for event in events]
|
||||||
|
found = figures(events, os.path.join(WORK, task.mutant.path))
|
||||||
if isinstance(found, Failure):
|
if isinstance(found, Failure):
|
||||||
return found
|
return found
|
||||||
checked_tree(task.trees[side], str(copy), str(check))
|
checked = on_disk(f"make the tree that checks bug {task.number}'s fix at the {side}", lambda: checked_tree(task.trees[side], str(copy), str(check)))
|
||||||
|
if isinstance(checked, Failure):
|
||||||
|
return checked
|
||||||
ran = ran_tests(containers, str(check))
|
ran = ran_tests(containers, str(check))
|
||||||
if isinstance(ran, Failure) and not isinstance(ran, TimedOut):
|
if isinstance(ran, Failure) and not isinstance(ran, TimedOut):
|
||||||
return ran
|
return ran
|
||||||
return Result(task.number, side, number, isinstance(ran, Ran) and ran.code == 0, found)
|
return Result(task.number, side, number, isinstance(ran, Ran) and ran.code == 0, found, tuple(entries))
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(copy, ignore_errors=True)
|
shutil.rmtree(copy, ignore_errors=True)
|
||||||
shutil.rmtree(check, ignore_errors=True)
|
shutil.rmtree(check, ignore_errors=True)
|
||||||
@@ -355,7 +467,7 @@ def stream_of(result: Result, folder: pathlib.Path) -> pathlib.Path:
|
|||||||
|
|
||||||
def digested(task: Task, results: list[Result], folder: pathlib.Path) -> Bug:
|
def digested(task: Task, results: list[Result], folder: pathlib.Path) -> Bug:
|
||||||
"""The bug as the digest tells it, with each of its runs in results. A run that didn't finish has no tokens."""
|
"""The bug as the digest tells it, with each of its runs in results. A run that didn't finish has no tokens."""
|
||||||
runs = [Run(stream_of(result, folder).stem, result.passed, found.tokens.context() + found.tokens.output if (found := result.figures) else None, stream_of(result, folder).read_bytes()) for result in results if result.task == task.number]
|
runs = [Run(stream_of(result, folder).stem, result.passed, found.tokens.context() + found.tokens.output if (found := result.figures) else None, result.entries) for result in results if result.task == task.number]
|
||||||
return Bug(f"{task.number}: {task.named()}", task.mutant.path, task.messages["base"], runs)
|
return Bug(f"{task.number}: {task.named()}", task.mutant.path, task.messages["base"], runs)
|
||||||
|
|
||||||
|
|
||||||
@@ -365,7 +477,3 @@ def recorded(result: Result) -> dict:
|
|||||||
if not (found := result.figures):
|
if not (found := result.figures):
|
||||||
return run
|
return run
|
||||||
return {**run, "claude_code": found.version, "model": found.model, "tokens": dataclasses.asdict(found.tokens), "turns": found.turns, "seconds": found.seconds, "reads": found.reads}
|
return {**run, "claude_code": found.version, "model": found.model, "tokens": dataclasses.asdict(found.tokens), "turns": found.turns, "seconds": found.seconds, "reads": found.reads}
|
||||||
|
|
||||||
|
|
||||||
def counted(count: int, noun: str) -> str:
|
|
||||||
return f"{count} {noun}{'' if count == 1 else 's'}"
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from failure import Failure
|
|||||||
from mutate_changes.in_diff_tools import gremlins_mutants
|
from mutate_changes.in_diff_tools import gremlins_mutants
|
||||||
from mutate_changes.changed_lines import is_test
|
from mutate_changes.changed_lines import is_test
|
||||||
from mutate_changes.tool_process import Run
|
from mutate_changes.tool_process import Run
|
||||||
|
from task_bench.figures import Side
|
||||||
|
|
||||||
# A place as `larv-review places` prints it: `<path>:<line>` in backticks.
|
# A place as `larv-review places` prints it: `<path>:<line>` in backticks.
|
||||||
PLACE = re.compile(r"`([^`\s:]+):\d+`")
|
PLACE = re.compile(r"`([^`\s:]+):\d+`")
|
||||||
@@ -86,6 +87,26 @@ def mutated(source: bytes, mutant: Mutant) -> bytes | None:
|
|||||||
return b"\n".join(lines)
|
return b"\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def bug_at_sides(mutant: Mutant, diff: str, sources: dict[Side, bytes | None]) -> dict[Side, bytes] | None:
|
||||||
|
"""The file of mutant with the bug in it, at the base and at the head. None where the mutant doesn't become a bug at one side
|
||||||
|
or the other.
|
||||||
|
|
||||||
|
sources holds the file at each side, None where the side lacks it; diff is the file's diff from base to head.
|
||||||
|
|
||||||
|
The bug is the same change to the same line at both sides, so only the code around it differs between them."""
|
||||||
|
at_head = line_at_head(diff, mutant.line)
|
||||||
|
if at_head is None:
|
||||||
|
return None
|
||||||
|
bugs: dict[Side, bytes] = {}
|
||||||
|
placings: tuple[tuple[Side, Mutant], ...] = (("base", mutant), ("head", mutant._replace(line=at_head)))
|
||||||
|
for side, placed in placings:
|
||||||
|
changed = None if (source := sources[side]) is None else mutated(source, placed)
|
||||||
|
if changed is None:
|
||||||
|
return None
|
||||||
|
bugs[side] = changed
|
||||||
|
return bugs
|
||||||
|
|
||||||
|
|
||||||
def line_at_head(diff: str, line: int) -> int | None:
|
def line_at_head(diff: str, line: int) -> int | None:
|
||||||
"""The number at the head of a file's line `line` at the base, or None where the head changed or removed that line.
|
"""The number at the head of a file's line `line` at the base, or None where the head changed or removed that line.
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ import typing
|
|||||||
|
|
||||||
from mutate_changes.tool_process import failed, Ran
|
from mutate_changes.tool_process import failed, Ran
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from task_bench.figures import HOME, WORK
|
|
||||||
from mutate_changes.changed_lines import is_test
|
from mutate_changes.changed_lines import is_test
|
||||||
from task_bench.api_proxy import PORT
|
from task_bench.api_proxy import PORT
|
||||||
|
|
||||||
MODEL = "claude-haiku-5-5"
|
MODEL = "claude-haiku-5-5"
|
||||||
|
# Where each run's container mounts its copy of the code, and its home folder: the paths in a run's stream start there.
|
||||||
|
WORK = "/work"
|
||||||
|
HOME = "/tmp"
|
||||||
# No MCP server, skill, command or stored session, so a run starts from the code alone; -p needs --verbose with stream-json, and no
|
# No MCP server, skill, command or stored session, so a run starts from the code alone; -p needs --verbose with stream-json, and no
|
||||||
# one answers a permission prompt. Not --bare, which can't sign in by a long-lived token: docs/decisions.md → `Claude Code in a home
|
# one answers a permission prompt. Not --bare, which can't sign in by a long-lived token: docs/decisions.md → `Claude Code in a home
|
||||||
# of its own`.
|
# of its own`.
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import unittest
|
|||||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
from task_bench.digest import Bug, decoys, digest, Run, trace
|
from task_bench.digest import Bug, decoys, digest, Run, trace
|
||||||
|
from claude_code.entries import entries_of, Entry
|
||||||
|
|
||||||
|
|
||||||
def said(text: str) -> dict:
|
def said(text: str) -> dict:
|
||||||
@@ -21,11 +22,11 @@ def result(at: str, text: str, failed: bool = False) -> dict:
|
|||||||
return {"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "tool_use_id": f"toolu_{at}", "content": text, "is_error": failed}]}}
|
return {"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "tool_use_id": f"toolu_{at}", "content": text, "is_error": failed}]}}
|
||||||
|
|
||||||
|
|
||||||
def stream(*events: dict) -> bytes:
|
def stream(*events: dict) -> list[Entry]:
|
||||||
return "\n".join(map(json.dumps, events)).encode()
|
return entries_of("\n".join(map(json.dumps, events)).encode())
|
||||||
|
|
||||||
|
|
||||||
def reading(*paths: str) -> bytes:
|
def reading(*paths: str) -> list[Entry]:
|
||||||
return stream(*(call("Read", str(at), file_path=f"/work/{path}") for at, path in enumerate(paths)))
|
return stream(*(call("Read", str(at), file_path=f"/work/{path}") for at, path in enumerate(paths)))
|
||||||
|
|
||||||
|
|
||||||
@@ -145,11 +146,11 @@ class DigestTest(unittest.TestCase):
|
|||||||
self.assertIn("### bug-2-base-1, the passing run with the median tokens, 10 tokens", held.splitlines())
|
self.assertIn("### bug-2-base-1, the passing run with the median tokens, 10 tokens", held.splitlines())
|
||||||
|
|
||||||
def test_the_median_is_by_tokens_whatever_the_order_the_runs_ran_in(self):
|
def test_the_median_is_by_tokens_whatever_the_order_the_runs_ran_in(self):
|
||||||
runs = [Run("bug-2-base-1", True, 20, b""), Run("bug-2-head-1", True, 10, b""), Run("bug-2-base-2", True, 30, b"")]
|
runs = [Run("bug-2-base-1", True, 20, []), Run("bug-2-head-1", True, 10, []), Run("bug-2-base-2", True, 30, [])]
|
||||||
self.assertEqual(digest(SIDES, [], [Bug("2: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()[-2:], ["### bug-2-base-1, the passing run with the median tokens, 20 tokens", ""])
|
self.assertEqual(digest(SIDES, [], [Bug("2: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()[-2:], ["### bug-2-base-1, the passing run with the median tokens, 20 tokens", ""])
|
||||||
|
|
||||||
def test_a_run_that_did_not_finish_is_the_failing_trace_and_is_left_out_of_the_median(self):
|
def test_a_run_that_did_not_finish_is_the_failing_trace_and_is_left_out_of_the_median(self):
|
||||||
runs = [Run("bug-4-base-1", False, 900, b""), Run("bug-4-head-1", False, None, b""), Run("bug-4-base-2", True, None, b""), Run("bug-4-head-2", True, 60, b"")]
|
runs = [Run("bug-4-base-1", False, 900, []), Run("bug-4-head-1", False, None, []), Run("bug-4-base-2", True, None, []), Run("bug-4-head-2", True, 60, [])]
|
||||||
held = digest(SIDES, [], [Bug("4: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()
|
held = digest(SIDES, [], [Bug("4: a.go:1:1 X", "a.go", "boom", runs)], lambda path: True).splitlines()
|
||||||
self.assertEqual([line for line in held if line.startswith("###")], ["### bug-4-head-1, a failing run that didn't finish", "### bug-4-head-2, the passing run with the median tokens, 60 tokens"])
|
self.assertEqual([line for line in held if line.startswith("###")], ["### bug-4-head-1, a failing run that didn't finish", "### bug-4-head-2, the passing run with the median tokens, 60 tokens"])
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import unittest
|
|||||||
|
|
||||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
|
from task_bench import figures as bench_figures
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from task_bench.figures import Figures, figures, Result, table
|
from task_bench.figures import Figures, Result, table
|
||||||
|
from claude_code.entries import json_objects
|
||||||
from claude_code.tokens import Tokens
|
from claude_code.tokens import Tokens
|
||||||
|
|
||||||
INIT = {"type": "system", "subtype": "init", "cwd": "/work", "model": "claude-haiku-5-5", "claude_code_version": "2.1.330"}
|
INIT = {"type": "system", "subtype": "init", "cwd": "/work", "model": "claude-haiku-5-5", "claude_code_version": "2.1.330"}
|
||||||
@@ -23,6 +25,10 @@ def stream(*events: dict) -> bytes:
|
|||||||
return "\n".join(map(json.dumps, events)).encode() + b"\n"
|
return "\n".join(map(json.dumps, events)).encode() + b"\n"
|
||||||
|
|
||||||
|
|
||||||
|
def figures(raw: bytes, bug_file: str) -> Figures | None | Failure:
|
||||||
|
return bench_figures.figures(json_objects(raw), bug_file)
|
||||||
|
|
||||||
|
|
||||||
class FiguresTest(unittest.TestCase):
|
class FiguresTest(unittest.TestCase):
|
||||||
def test_reads_the_version_model_tokens_turns_and_wall_time_from_the_streams_first_and_last_events(self):
|
def test_reads_the_version_model_tokens_turns_and_wall_time_from_the_streams_first_and_last_events(self):
|
||||||
found = figures(stream(INIT, RESULT), "/work/calc.go")
|
found = figures(stream(INIT, RESULT), "/work/calc.go")
|
||||||
@@ -69,6 +75,10 @@ class FiguresTest(unittest.TestCase):
|
|||||||
refused = {**RESULT, "is_error": True, "api_error_status": 401, "result": "Failed to authenticate. API Error: 401 OAuth access token is invalid."}
|
refused = {**RESULT, "is_error": True, "api_error_status": 401, "result": "Failed to authenticate. API Error: 401 OAuth access token is invalid."}
|
||||||
self.assertEqual(figures(stream(INIT, refused), "/work/calc.go"), Failure("claude could not use the API: Failed to authenticate. API Error: 401 OAuth access token is invalid."))
|
self.assertEqual(figures(stream(INIT, refused), "/work/calc.go"), Failure("claude could not use the API: Failed to authenticate. API Error: 401 OAuth access token is invalid."))
|
||||||
|
|
||||||
|
def test_a_run_that_ended_on_an_api_error_without_a_status_is_a_failure_that_quotes_claude(self):
|
||||||
|
refused = {**RESULT, "is_error": True, "terminal_reason": "api_error", "result": "CLAUDE_CODE_OAUTH_TOKEN is not a valid header value."}
|
||||||
|
self.assertEqual(figures(stream(INIT, refused), "/work/calc.go"), Failure("claude could not use the API: CLAUDE_CODE_OAUTH_TOKEN is not a valid header value."))
|
||||||
|
|
||||||
|
|
||||||
def run(task: int, side: str, number: int, passed: bool, input_: int = 100, turns: int = 10, seconds: float = 60, reads: int | None = 3) -> Result:
|
def run(task: int, side: str, number: int, passed: bool, input_: int = 100, turns: int = 10, seconds: float = 60, reads: int | None = 3) -> Result:
|
||||||
return Result(task, side, number, passed, Figures("2.1.330", "claude-haiku-5-5", Tokens(input=input_, write_5m=20, write_1h=980, read=5000, output=400), turns, seconds, reads))
|
return Result(task, side, number, passed, Figures("2.1.330", "claude-haiku-5-5", Tokens(input=input_, write_5m=20, write_1h=980, read=5000, output=400), turns, seconds, reads))
|
||||||
@@ -102,6 +112,25 @@ class TableTest(unittest.TestCase):
|
|||||||
results = [run(1, "base", 1, True, input_=0, turns=10, seconds=60, reads=0), run(1, "head", 1, False, input_=50, turns=12, seconds=120, reads=2)]
|
results = [run(1, "base", 1, True, input_=0, turns=10, seconds=60, reads=0), run(1, "head", 1, False, input_=50, turns=12, seconds=120, reads=2)]
|
||||||
self.assertEqual(table(results, {1: "calc.go:4:7 ARITHMETIC_BASE"})[-1], "| All | change | -1 | - | 0 % | 0 % | 0 % | +2 | +100 % | +2 |")
|
self.assertEqual(table(results, {1: "calc.go:4:7 ARITHMETIC_BASE"})[-1], "| All | change | -1 | - | 0 % | 0 % | 0 % | +2 | +100 % | +2 |")
|
||||||
|
|
||||||
|
def test_the_change_is_the_mean_of_the_bugs_own_changes_not_the_change_of_the_pooled_medians(self):
|
||||||
|
results = [
|
||||||
|
run(1, "base", 1, True, input_=100, turns=10, seconds=60, reads=3), run(1, "head", 1, True, input_=200, turns=14, seconds=90, reads=5),
|
||||||
|
run(2, "base", 1, True, input_=1000, turns=20, seconds=60, reads=7), run(2, "head", 1, True, input_=1000, turns=20, seconds=60, reads=7),
|
||||||
|
]
|
||||||
|
rows = table(results, {1: "calc.go:4:7 ARITHMETIC_BASE", 2: "pick.go:9:3 ARITHMETIC_BASE"})
|
||||||
|
self.assertEqual(rows[-3:], [
|
||||||
|
"| All | base | 2/2 | 550 | 1000 | 5000 | 400 | 15 | 60 | 5 |",
|
||||||
|
"| All | head | 2/2 | 600 | 1000 | 5000 | 400 | 17 | 75 | 6 |",
|
||||||
|
"| All | change | 0 | +50 % | 0 % | 0 % | 0 % | +2 | +25 % | +1 |",
|
||||||
|
])
|
||||||
|
|
||||||
|
def test_a_bug_whose_base_measured_zero_is_left_out_of_the_mean_share(self):
|
||||||
|
results = [
|
||||||
|
run(1, "base", 1, True, input_=0), run(1, "head", 1, True, input_=50),
|
||||||
|
run(2, "base", 1, True, input_=100), run(2, "head", 1, True, input_=150),
|
||||||
|
]
|
||||||
|
self.assertEqual(table(results, {1: "a.go:1:1 ARITHMETIC_BASE", 2: "b.go:1:1 ARITHMETIC_BASE"})[-1].split(" | ")[3], "+50 %")
|
||||||
|
|
||||||
def test_a_run_without_figures_counts_as_not_passed_and_a_side_without_any_shows_a_dash(self):
|
def test_a_run_without_figures_counts_as_not_passed_and_a_side_without_any_shows_a_dash(self):
|
||||||
results = [Result(1, "base", 1, False, None), run(1, "head", 1, True)]
|
results = [Result(1, "base", 1, False, None), run(1, "head", 1, True)]
|
||||||
self.assertEqual(table(results, {1: "calc.go:4:7 ARITHMETIC_BASE"})[2:], [
|
self.assertEqual(table(results, {1: "calc.go:4:7 ARITHMETIC_BASE"})[2:], [
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import unittest
|
|||||||
|
|
||||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
from task_bench.plant import drawn, go_files, killed_mutants, line_at_head, Mutant, mutated, place_files, task_text
|
from task_bench.plant import bug_at_sides, drawn, go_files, killed_mutants, line_at_head, Mutant, mutated, place_files, task_text
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from mutate_changes.tool_process import Ran
|
from mutate_changes.tool_process import Ran
|
||||||
|
|
||||||
@@ -156,6 +156,25 @@ class LineAtHeadTest(unittest.TestCase):
|
|||||||
self.assertEqual(line_at_head("", 12), 12)
|
self.assertEqual(line_at_head("", 12), 12)
|
||||||
|
|
||||||
|
|
||||||
|
class BugAtSidesTest(unittest.TestCase):
|
||||||
|
MUTANT = Mutant("calc.go", 3, 11, "ARITHMETIC_BASE")
|
||||||
|
BASE = b"package calc\n\n\treturn a + b\n"
|
||||||
|
# The head adds a line above the bug's.
|
||||||
|
HEAD = b"package calc\n// Add adds.\n\n\treturn a + b\n"
|
||||||
|
DIFF = "@@ -1,0 +2 @@\n+// Add adds.\n"
|
||||||
|
|
||||||
|
def test_the_bug_is_the_same_change_at_each_side_on_the_line_as_that_side_numbers_it(self):
|
||||||
|
found = bug_at_sides(self.MUTANT, self.DIFF, {"base": self.BASE, "head": self.HEAD})
|
||||||
|
self.assertEqual(found, {"base": self.BASE.replace(b"+", b"-"), "head": self.HEAD.replace(b"+", b"-")})
|
||||||
|
|
||||||
|
def test_a_line_the_head_changed_holds_no_bug(self):
|
||||||
|
self.assertIsNone(bug_at_sides(self.MUTANT, "@@ -3 +3 @@\n-\treturn a + b\n+\treturn b + a\n", {"base": self.BASE, "head": self.BASE}))
|
||||||
|
|
||||||
|
def test_a_side_without_the_file_or_without_the_operator_the_mutant_changes_holds_no_bug(self):
|
||||||
|
self.assertIsNone(bug_at_sides(self.MUTANT, "", {"base": self.BASE, "head": None}))
|
||||||
|
self.assertIsNone(bug_at_sides(self.MUTANT, "", {"base": self.BASE, "head": b"package calc\n\n\treturn sum(a, b)\n"}))
|
||||||
|
|
||||||
|
|
||||||
class KilledMutantsTest(unittest.TestCase):
|
class KilledMutantsTest(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
folder = tempfile.TemporaryDirectory()
|
folder = tempfile.TemporaryDirectory()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
fix is checked in, and the proxy that reaches only the API."""
|
fix is checked in, and the proxy that reaches only the API."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import dataclasses
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@@ -15,12 +16,14 @@ import unittest
|
|||||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
from task_bench import api_proxy, bench_folder, main, runs
|
from task_bench import api_proxy, bench_folder, main, runs
|
||||||
|
from test_env import assert_not_root, isolated_env
|
||||||
from task_bench.runs import checked_tree, closed, Containers, docker_cli, fix_attempted, opened, ran_tests, TimedOut
|
from task_bench.runs import checked_tree, closed, Containers, docker_cli, fix_attempted, opened, ran_tests, TimedOut
|
||||||
from task_bench.plant import drawn, Mutant
|
from task_bench.plant import drawn, Mutant
|
||||||
|
from claude_code.entries import Entry, entry_from
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from test_env import isolated_env
|
from task_bench.figures import Figures, Result
|
||||||
from mutate_changes.tool_process import Ran
|
from mutate_changes.tool_process import Ran
|
||||||
from task_bench.figures import Result
|
from claude_code.tokens import Tokens
|
||||||
|
|
||||||
BASE_CODE = "package calc\n\nfunc Add(a, b int) int {\n\treturn a + b\n}\n\nfunc Twice(a int) int {\n\treturn a * 2\n}\n"
|
BASE_CODE = "package calc\n\nfunc Add(a, b int) int {\n\treturn a + b\n}\n\nfunc Twice(a int) int {\n\treturn a * 2\n}\n"
|
||||||
# The head adds a line right above Add, which moves it down, and rewrites Twice's line.
|
# The head adds a line right above Add, which moves it down, and rewrites Twice's line.
|
||||||
@@ -163,6 +166,16 @@ class BenchTest(unittest.TestCase):
|
|||||||
self.assertEqual((folder / "runs/bug-1-base-1.stderr").read_bytes(), b"")
|
self.assertEqual((folder / "runs/bug-1-base-1.stderr").read_bytes(), b"")
|
||||||
self.assertEqual(os.readlink(folder / "bugs/1/head/dangling"), "missing")
|
self.assertEqual(os.readlink(folder / "bugs/1/head/dangling"), "missing")
|
||||||
|
|
||||||
|
def test_plants_the_bug_on_the_same_line_at_the_head_whatever_the_callers_git_does_to_a_diff(self):
|
||||||
|
# Colour, an external diff and a textconv that numbers the lines each change what `git diff` prints, and so where the head's line is.
|
||||||
|
self.git("config", "color.diff", "always")
|
||||||
|
self.git("config", "diff.external", "false")
|
||||||
|
self.git("config", "diff.numbered.textconv", "cat -n")
|
||||||
|
(self.repo / ".git/info/attributes").write_text("*.go diff=numbered\n")
|
||||||
|
report = self.bench()
|
||||||
|
self.assertNotIsInstance(report, Failure, report)
|
||||||
|
self.assertIn("| 1: calc.go:4:11 ARITHMETIC_BASE | head | 2/2 | 40 | 9000 | 52000 | 800 | 3 | 61.5 | 1 |", report)
|
||||||
|
|
||||||
def test_writes_a_digest_of_the_runs_with_each_bugs_decoys_and_traces(self):
|
def test_writes_a_digest_of_the_runs_with_each_bugs_decoys_and_traces(self):
|
||||||
folder = pathlib.Path(self.bench()[-1].removeprefix(main.KEPT))
|
folder = pathlib.Path(self.bench()[-1].removeprefix(main.KEPT))
|
||||||
digest = (folder / "digest.md").read_text().splitlines()
|
digest = (folder / "digest.md").read_text().splitlines()
|
||||||
@@ -219,7 +232,7 @@ class BenchTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_the_command_line_fails_with_the_reason_where_the_places_or_the_bench_fail(self):
|
def test_the_command_line_fails_with_the_reason_where_the_places_or_the_bench_fail(self):
|
||||||
argv = [part for name, value in self.given.items() for part in (name, value)]
|
argv = [part for name, value in self.given.items() for part in (name, value)]
|
||||||
for places, said in ((Failure("no history"), "no history\n"), ("- `gone.go:1` `Gone`: removed\n", "The places the seats found hard name no Go file that the base holds, so there is nowhere to plant a bug.\n")):
|
for places, said in ((Failure("no history"), "no history\n"), ("- `gone.go:1` `Gone`: removed\n", "The places the seats found hard don't name any Go file that the base holds, so there is nowhere to plant a bug.\n")):
|
||||||
with contextlib.redirect_stdout(io.StringIO()) as out, contextlib.redirect_stderr(io.StringIO()) as errors:
|
with contextlib.redirect_stdout(io.StringIO()) as out, contextlib.redirect_stderr(io.StringIO()) as errors:
|
||||||
self.assertEqual(main.main(argv, self.env, lambda home: places), 1)
|
self.assertEqual(main.main(argv, self.env, lambda home: places), 1)
|
||||||
self.assertEqual((out.getvalue(), errors.getvalue().splitlines(keepends=True)[-1]), ("", said))
|
self.assertEqual((out.getvalue(), errors.getvalue().splitlines(keepends=True)[-1]), ("", said))
|
||||||
@@ -289,7 +302,7 @@ class BenchTest(unittest.TestCase):
|
|||||||
def test_fails_where_the_places_name_no_go_file_of_the_base(self):
|
def test_fails_where_the_places_name_no_go_file_of_the_base(self):
|
||||||
with contextlib.redirect_stderr(io.StringIO()):
|
with contextlib.redirect_stderr(io.StringIO()):
|
||||||
found = main.bench({**self.given, "--base": "main"}, self.env, "- `gone.go:1` `Gone`: removed\n- `README.md:1` `Calc`: thin\n", self.home)
|
found = main.bench({**self.given, "--base": "main"}, self.env, "- `gone.go:1` `Gone`: removed\n- `README.md:1` `Calc`: thin\n", self.home)
|
||||||
self.assertEqual(found, Failure("The places the seats found hard name no Go file that the base holds, so there is nowhere to plant a bug."))
|
self.assertEqual(found, Failure("The places the seats found hard don't name any Go file that the base holds, so there is nowhere to plant a bug."))
|
||||||
self.assertFalse(self.log.exists())
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
def test_fails_where_the_tests_fail_without_a_bug(self):
|
def test_fails_where_the_tests_fail_without_a_bug(self):
|
||||||
@@ -344,6 +357,33 @@ class BenchTest(unittest.TestCase):
|
|||||||
self.assertIn("docker build", found.reason)
|
self.assertIn("docker build", found.reason)
|
||||||
|
|
||||||
|
|
||||||
|
class ReportTest(unittest.TestCase):
|
||||||
|
SIDES = {"base": "b" * 40, "head": "h" * 40}
|
||||||
|
NAMES = {1: "calc.go:4:11 ARITHMETIC_BASE"}
|
||||||
|
RESULTS = [Result(1, "base", 1, True, Figures("2.1.330", "claude-haiku-5-5", Tokens(40, 0, 9000, 52000, 800), 7, 61.5, 2)), Result(1, "head", 1, False, None)]
|
||||||
|
TABLE = [
|
||||||
|
"| Bug | Side | Passed | Input | Cache write | Cache read | Output | Turns | Wall, s | Reads |",
|
||||||
|
"|---|---|---|---|---|---|---|---|---|---|",
|
||||||
|
"| 1: calc.go:4:11 ARITHMETIC_BASE | base | 1/1 | 40 | 9000 | 52000 | 800 | 7 | 61.5 | 2 |",
|
||||||
|
"| 1: calc.go:4:11 ARITHMETIC_BASE | head | 0/1 | - | - | - | - | - | - | - |",
|
||||||
|
"| All | base | 1/1 | 40 | 9000 | 52000 | 800 | 7 | 61.5 | 2 |",
|
||||||
|
"| All | head | 0/1 | - | - | - | - | - | - | - |",
|
||||||
|
"| All | change | -1 | - | - | - | - | - | - | - |",
|
||||||
|
]
|
||||||
|
|
||||||
|
def test_names_the_commits_the_bugs_the_runs_and_what_ran_them_above_the_table(self):
|
||||||
|
told = main.report(self.SIDES, self.NAMES, main.Asked(seed=1, bugs=1, runs=2), self.RESULTS)
|
||||||
|
self.assertEqual(told, ["task-bench: base bbbbbbbbbbbb, head hhhhhhhhhhhh. 1 bug, each run 2 times at each side by claude-haiku-5-5 in Claude Code 2.1.330.", "", *self.TABLE, ""])
|
||||||
|
|
||||||
|
def test_says_where_fewer_bugs_were_planted_than_asked_for_and_where_no_run_finished(self):
|
||||||
|
told = main.report(self.SIDES, self.NAMES, main.Asked(seed=1, bugs=3, runs=1), self.RESULTS[1:])
|
||||||
|
self.assertEqual(told[:3], ["task-bench: base bbbbbbbbbbbb, head hhhhhhhhhhhh. 1 bug, each run 1 time at each side by no run that finished.", "Planted 1 of the 3 bugs asked for: no other mutant the tests kill becomes one.", ""])
|
||||||
|
|
||||||
|
def test_a_stopped_bench_tells_why_then_how_far_it_came_then_the_table(self):
|
||||||
|
told = main.stopped_report(Failure("claude could not use the API: Invalid bearer token"), self.RESULTS, 10, self.NAMES, pathlib.Path("/reviews/task-bench"))
|
||||||
|
self.assertEqual(told, Failure("\n".join(["claude could not use the API: Invalid bearer token", "task-bench stopped after 2 of 10 runs, which results.json holds in /reviews/task-bench:", "", *self.TABLE])))
|
||||||
|
|
||||||
|
|
||||||
class MainTest(unittest.TestCase):
|
class MainTest(unittest.TestCase):
|
||||||
def run_main(self, *argv: str, token: str = "t") -> tuple[int, str]:
|
def run_main(self, *argv: str, token: str = "t") -> tuple[int, str]:
|
||||||
with contextlib.redirect_stderr(io.StringIO()) as errors, contextlib.redirect_stdout(io.StringIO()):
|
with contextlib.redirect_stderr(io.StringIO()) as errors, contextlib.redirect_stdout(io.StringIO()):
|
||||||
@@ -377,12 +417,10 @@ class MainTest(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
def test_a_run_that_did_not_finish_has_no_tokens_in_the_digest(self):
|
def test_a_run_that_did_not_finish_has_no_tokens_in_the_digest(self):
|
||||||
with tempfile.TemporaryDirectory() as folder:
|
task = main.Task(1, Mutant("calc.go", 4, 11, "ARITHMETIC_BASE"), {}, {"base": "boom", "head": "bang"})
|
||||||
pathlib.Path(folder, "runs").mkdir()
|
entries = (Entry(),)
|
||||||
pathlib.Path(folder, "runs/bug-1-base-2.jsonl").write_bytes(b"{}")
|
bug = main.digested(task, [Result(1, "base", 2, False, None, entries), Result(2, "base", 1, True, None)], pathlib.Path("/bench"))
|
||||||
task = main.Task(1, Mutant("calc.go", 4, 11, "ARITHMETIC_BASE"), {}, {"base": "boom", "head": "bang"})
|
self.assertEqual(bug, ("1: calc.go:4:11 ARITHMETIC_BASE", "calc.go", "boom", [("bug-1-base-2", False, None, entries)]))
|
||||||
bug = main.digested(task, [Result(1, "base", 2, False, None), Result(2, "base", 1, True, None)], pathlib.Path(folder))
|
|
||||||
self.assertEqual(bug, ("1: calc.go:4:11 ARITHMETIC_BASE", "calc.go", "boom", [("bug-1-base-2", False, None, b"{}")]))
|
|
||||||
|
|
||||||
def test_records_a_run_that_did_not_finish_without_figures(self):
|
def test_records_a_run_that_did_not_finish_without_figures(self):
|
||||||
self.assertEqual(main.recorded(Result(1, "base", 2, False, None)), {"bug": 1, "side": "base", "run": 2, "passed": False, "finished": False})
|
self.assertEqual(main.recorded(Result(1, "base", 2, False, None)), {"bug": 1, "side": "base", "run": 2, "passed": False, "finished": False})
|
||||||
@@ -431,6 +469,9 @@ class RunOutcomesTest(unittest.TestCase):
|
|||||||
def containers(self, *runs: Ran | Failure) -> Containers:
|
def containers(self, *runs: Ran | Failure) -> Containers:
|
||||||
return Containers(InTurn(*runs), "bench", "go test ./...", 512, "1000:1000")
|
return Containers(InTurn(*runs), "bench", "go test ./...", 512, "1000:1000")
|
||||||
|
|
||||||
|
def bench(self, *runs: Ran | Failure) -> main.Bench:
|
||||||
|
return main.Bench("", {"base": "b", "head": "h"}, self.trees, main.Asked(seed=1, bugs=1, runs=1), self.containers(*runs), self.folder, lambda *args, **given: "", lambda line: None)
|
||||||
|
|
||||||
def test_a_fix_whose_tests_run_out_of_time_does_not_pass(self):
|
def test_a_fix_whose_tests_run_out_of_time_does_not_pass(self):
|
||||||
late = TimedOut("docker run still ran after 30 min")
|
late = TimedOut("docker run still ran after 30 min")
|
||||||
self.assertEqual(main.fixed(self.task, "base", 1, self.containers(Ran(0, ""), late), self.folder), Result(1, "base", 1, False, None))
|
self.assertEqual(main.fixed(self.task, "base", 1, self.containers(Ran(0, ""), late), self.folder), Result(1, "base", 1, False, None))
|
||||||
@@ -441,15 +482,63 @@ class RunOutcomesTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_tests_docker_could_not_run_without_a_bug_fail_the_bench(self):
|
def test_tests_docker_could_not_run_without_a_bug_fail_the_bench(self):
|
||||||
broke = Failure("docker could not start: No such file or directory")
|
broke = Failure("docker could not start: No such file or directory")
|
||||||
self.assertEqual(main.benched({}, "", {}, self.trees, [], self.containers(broke), self.folder, None), broke)
|
self.assertEqual(main.benched(self.bench(broke), []), broke)
|
||||||
|
|
||||||
def test_a_mutant_whose_tests_run_out_of_time_is_passed_over(self):
|
def test_a_mutant_whose_tests_run_out_of_time_is_passed_over(self):
|
||||||
late = TimedOut("docker run still ran after 30 min")
|
late = TimedOut("docker run still ran after 30 min")
|
||||||
self.assertIsNone(main.planted(1, self.MUTANT, "", {"base": "b", "head": "h"}, self.trees, self.containers(late), self.folder, lambda *args, **given: ""))
|
self.assertIsNone(main.planted(self.bench(late), 1, self.MUTANT))
|
||||||
|
|
||||||
def test_a_mutant_whose_tests_docker_could_not_run_fails_the_bench(self):
|
def test_a_mutant_whose_tests_docker_could_not_run_fails_the_bench(self):
|
||||||
broke = Failure("docker could not start: No such file or directory")
|
broke = Failure("docker could not start: No such file or directory")
|
||||||
self.assertEqual(main.planted(1, self.MUTANT, "", {"base": "b", "head": "h"}, self.trees, self.containers(broke), self.folder, lambda *args, **given: ""), broke)
|
self.assertEqual(main.planted(self.bench(broke), 1, self.MUTANT), broke)
|
||||||
|
|
||||||
|
def assertFailsWith(self, found, start: str):
|
||||||
|
self.assertIsInstance(found, Failure)
|
||||||
|
self.assertTrue(found.reason.startswith(start), found.reason)
|
||||||
|
|
||||||
|
def test_a_tree_that_cannot_be_copied_for_a_fix_fails_the_bench_naming_the_bug_and_side(self):
|
||||||
|
task = dataclasses.replace(self.task, trees={"base": str(self.folder / "gone"), "head": str(self.tree)})
|
||||||
|
self.assertFailsWith(main.fixed(task, "base", 1, self.containers(), self.folder), "could not copy bug 1's tree at the base: ")
|
||||||
|
|
||||||
|
def test_failing_to_make_the_tree_that_checks_a_fix_fails_the_bench_naming_the_bug_and_side(self):
|
||||||
|
(self.folder / "check").mkdir()
|
||||||
|
self.assertFailsWith(main.fixed(self.task, "base", 1, self.containers(Ran(0, "")), self.folder), "could not make the tree that checks bug 1's fix at the base: ")
|
||||||
|
|
||||||
|
def test_results_that_cannot_be_written_fail_the_bench_naming_the_folder(self):
|
||||||
|
bench = dataclasses.replace(self.bench(), folder=self.folder / "gone")
|
||||||
|
self.assertFailsWith(main.kept(bench, [], {}, []), f"could not write the results under {self.folder / 'gone'}: ")
|
||||||
|
|
||||||
|
def test_a_bug_that_cannot_be_planted_fails_the_bench_naming_the_tree(self):
|
||||||
|
(self.folder / "file").write_text("")
|
||||||
|
tree = self.folder / "file" / "base"
|
||||||
|
self.assertFailsWith(main.planted_tree(self.bench(), "base", tree, "calc.go", b""), f"could not plant the bug in {tree}: ")
|
||||||
|
|
||||||
|
def test_a_tree_that_cannot_be_copied_for_its_tests_fails_the_bench_naming_it(self):
|
||||||
|
gone = str(self.folder / "gone")
|
||||||
|
self.assertFailsWith(main.tests_in_copy(self.containers(), gone, self.folder), f"could not copy {gone} to test it: ")
|
||||||
|
|
||||||
|
def test_a_tree_whose_folder_cannot_be_made_fails_the_bench_naming_it(self):
|
||||||
|
(self.folder / "file").write_text("")
|
||||||
|
into = self.folder / "file" / "base"
|
||||||
|
self.assertFailsWith(main.archived("b", into, "", lambda *args, **given: ""), f"could not make {into}: ")
|
||||||
|
|
||||||
|
def test_a_mutant_in_a_file_that_cannot_be_read_fails_the_bench_naming_the_file(self):
|
||||||
|
assert_not_root(self)
|
||||||
|
(self.tree / "calc.go").chmod(0)
|
||||||
|
self.addCleanup((self.tree / "calc.go").chmod, 0o644)
|
||||||
|
self.assertFailsWith(main.planted(self.bench(), 1, self.MUTANT), "could not read calc.go: ")
|
||||||
|
|
||||||
|
def test_a_digest_quoting_half_of_a_surrogate_pair_is_written_with_a_question_mark_in_its_place(self):
|
||||||
|
# Claude Code may cut a string between the halves of an emoji's pair, and JSON parses the half it keeps into a lone surrogate.
|
||||||
|
said = entry_from(json.loads('{"type": "assistant", "message": {"content": [{"type": "text", "text": "half \\ud83d pair"}]}}'))
|
||||||
|
self.assertIsNone(main.kept(self.bench(), [self.task], {1: "calc.go:4:11 ARITHMETIC_BASE"}, [Result(1, "base", 1, False, None, [said])]))
|
||||||
|
self.assertIn("half ? pair", (self.folder / "digest.md").read_text(encoding="utf-8"))
|
||||||
|
|
||||||
|
def test_a_mutant_in_a_file_the_head_lacks_is_passed_over(self):
|
||||||
|
head = self.folder / "head"
|
||||||
|
head.mkdir()
|
||||||
|
bench = dataclasses.replace(self.bench(), trees={"base": str(self.tree), "head": str(head)})
|
||||||
|
self.assertIsNone(main.planted(bench, 1, self.MUTANT))
|
||||||
|
|
||||||
|
|
||||||
class ContainersTest(unittest.TestCase):
|
class ContainersTest(unittest.TestCase):
|
||||||
@@ -638,5 +727,17 @@ class ApiProxyTest(unittest.IsolatedAsyncioTestCase):
|
|||||||
self.assertEqual(await self.answered(request), b"HTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\n\r\n")
|
self.assertEqual(await self.answered(request), b"HTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\n\r\n")
|
||||||
|
|
||||||
|
|
||||||
|
class OnDisk(unittest.TestCase):
|
||||||
|
def test_a_refused_file_operation_is_a_failure_that_says_what_could_not_be_done(self):
|
||||||
|
with tempfile.TemporaryDirectory() as folder:
|
||||||
|
missing = pathlib.Path(folder, "gone", "file")
|
||||||
|
found = main.on_disk(f"read {missing}", missing.read_bytes)
|
||||||
|
self.assertIsInstance(found, Failure)
|
||||||
|
self.assertTrue(found.reason.startswith(f"could not read {missing}: "), found.reason)
|
||||||
|
|
||||||
|
def test_an_operation_that_succeeds_gives_its_answer(self):
|
||||||
|
self.assertEqual(main.on_disk("count", lambda: 3), 3)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -4228,3 +4228,147 @@ Inherited architect, decided by:
|
|||||||
- 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/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/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.
|
- 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.
|
||||||
|
|
||||||
|
## 2026-11-22T15:29:07Z, item-503 at 16d9b3a0
|
||||||
|
|
||||||
|
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
| Junior A | 6 | 5 | 5.5 | 5 | 5.5 |
|
||||||
|
| Mid A | 7 | 5.5 | 6 | 5 | 6 |
|
||||||
|
| Maintainability senior | 7 | 5.5 | 6 | 6 | 6 |
|
||||||
|
| Inherited architect | 7 | 6.5 | 6 | 7.5 | 7 |
|
||||||
|
| Mean | 6.75 | 5.63 | 5.88 | 5.88 | 6.13 |
|
||||||
|
|
||||||
|
Junior A, hardest first:
|
||||||
|
|
||||||
|
- Navigation, Overall: `bin/agent_cycle/run.py:102` `archived`: cites a close.py that doesn't exist, which cost a search
|
||||||
|
- Locality, Shape, Overall: `bin/do_epic/main.py:538` `handed_on`: five-way branch over outcome, automation and merged-status config
|
||||||
|
- Locality: `bin/do_epic/scheduler.py:172` `start_chunks`: chunk state is rebuilt from tmux window names no module owns
|
||||||
|
- Self-sufficiency: `bin/agent_cycle/run.py:32` `Cycle`: the why of its 17 fields sits in docs/decisions.md
|
||||||
|
|
||||||
|
Mid A, hardest first:
|
||||||
|
|
||||||
|
- Locality, Overall: `bin/chunk_pr/main.py:587` `levelled_and_finished`: step order is load-bearing and unmarked
|
||||||
|
- Shape, Overall: `bin/do_epic/main.py:539` `handed_on`: five branches over three configuration facts
|
||||||
|
- Self-sufficiency: `bin/larv_review/main.py:1` module docstring: the rules for votes and owed runs live only in a 167-line help text
|
||||||
|
|
||||||
|
Maintainability senior, hardest first:
|
||||||
|
|
||||||
|
- Locality, Overall: `bin/do_epic/main.py:379` `parked_through`: starts other chunks from what reads like a wait
|
||||||
|
- Locality: `bin/agent_cycle/tmux.py:92` `as_listed`: chunk state shared across processes in window names
|
||||||
|
- Shape: `bin/plan/ranking.py:239` `score`: the OLD_SHAPE fork doubles the paths through ranking
|
||||||
|
|
||||||
|
Inherited architect, would restructure first:
|
||||||
|
|
||||||
|
- Navigation, Shape, Overall: `README.md:234` "Packages under bin/": about 85 entries at one level, six packages missing from the list
|
||||||
|
- Locality: `bin/rule_hook/main.py:94` `breaches_of`: the round cap binds at commit time, not at reviewer launch
|
||||||
|
- Shape: `bin/chunk_pr/main.py:167` `step`: seven subcommands and inline forge branches in one 764-line module
|
||||||
|
|
||||||
|
## 2026-11-22T23:50:46Z, item-515 at 6322c6e1
|
||||||
|
|
||||||
|
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
| Junior A | 6.5 | 5 | 5.5 | 5 | 5.5 |
|
||||||
|
| Mid A | 7 | 5.5 | 6 | 6 | 6 |
|
||||||
|
| Maintainability senior | 7 | 5.5 | 6 | 6 | 6 |
|
||||||
|
| Inherited architect | 7 | 6.5 | 6 | 6.5 | 6.5 |
|
||||||
|
| Mean | 6.88 | 5.63 | 5.88 | 5.88 | 6.00 |
|
||||||
|
|
||||||
|
Junior A, hardest first:
|
||||||
|
|
||||||
|
- Locality, Shape, Overall: `bin/do_epic/main.py:538` `handed_on`: five-way branch over outcome, automation and PR status
|
||||||
|
- Locality: `bin/do_epic/main.py:379` `parked_through`: starts other chunks from what reads like a wait
|
||||||
|
- Self-sufficiency: `skills/larv-review/SKILL.md:94` "Round cap": the review loop's rules live only in the skill's text
|
||||||
|
- Navigation: `bin/agent_cycle/run.py:103` `archived`: cites a close.py that doesn't exist
|
||||||
|
|
||||||
|
Mid A, hardest first:
|
||||||
|
|
||||||
|
- Locality, Shape, Overall: `bin/do_epic/main.py:538` `handed_on`: five branches over three configuration facts
|
||||||
|
- Locality: `bin/do_epic/scheduler.py:172` `start_chunks`: chunk state is rebuilt from tmux window names
|
||||||
|
- Shape: `bin/chunk_pr/main.py:448` `merged`: the merge's steps run through three long functions
|
||||||
|
- Self-sufficiency: `bin/project_config/settings.py:201` `load`: the settings' meaning sits in the help text
|
||||||
|
|
||||||
|
Maintainability senior, hardest first:
|
||||||
|
|
||||||
|
- Locality, Overall: `bin/agent_cycle/routing.py:115` `unfinished_route`: the route depends on state three modules write
|
||||||
|
- Locality: `bin/do_epic/main.py:379` `parked_through`: starts other chunks from what reads like a wait
|
||||||
|
- Shape: `bin/do_epic/main.py:538` `handed_on`: five-way branch over outcome, automation and PR status
|
||||||
|
- Self-sufficiency: `bin/agent_cycle/verdicts.py:41` `Verdict`: cites `cycle.judge.re_ask_checked`, which doesn't exist
|
||||||
|
|
||||||
|
Inherited architect, would restructure first:
|
||||||
|
|
||||||
|
- Shape, Overall: `bin/do_epic/main.py:379` `parked_through`: the launcher and the chunk's window share one module
|
||||||
|
- Shape: `bin/chunk_pr/main.py:448` `merged`: seven subcommands in one module
|
||||||
|
- Navigation: `README.md:234` "Packages under bin/": about 80 entries at one level
|
||||||
|
- Self-sufficiency: `skills/larv-review/SKILL.md:94` "Round cap": the review loop lives only in the skill's text
|
||||||
|
|
||||||
|
## 2026-11-22T23:54:53Z, item-515 rerun at 6322c6e1
|
||||||
|
|
||||||
|
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
| Junior A | 6.5 | 5 | 5.5 | 5 | 5.5 |
|
||||||
|
| Mid A | 7 | 5.5 | 6 | 6 | 6 |
|
||||||
|
| Maintainability senior | 7 | 6 | 6 | 6 | 6.5 |
|
||||||
|
| Inherited architect | 6.5 | 6.5 | 5.5 | 6 | 6 |
|
||||||
|
| Mean | 6.75 | 5.75 | 5.75 | 5.75 | 6.00 |
|
||||||
|
|
||||||
|
Junior A, hardest first:
|
||||||
|
|
||||||
|
- Locality, Overall: `bin/do_epic/main.py:379` `parked_through`: seven flags to hold over park, resume and a human's merge
|
||||||
|
- Shape, Self-sufficiency: `bin/do_epic/main.py:538` `handed_on`: five branches that need the README's do-epic settings beside them
|
||||||
|
- Locality: `bin/chunk_pr/main.py:448` `merged`: one loop interleaves the queue turn, approval waits and parking
|
||||||
|
- Shape: `bin/plan/ranking.py:144` `weigh`: the OLD_SHAPE and SHAPE paths run through the same functions
|
||||||
|
|
||||||
|
Mid A, hardest first:
|
||||||
|
|
||||||
|
- Locality, Shape, Overall: `bin/do_epic/main.py:538` `handed_on`: five branches over the landing, the automation and two statuses
|
||||||
|
- Locality: `bin/do_epic/main.py:379` `parked_through`: park must come before resume, and no code enforces it
|
||||||
|
- Locality: `bin/chunk_pr/main.py:587` `levelled_and_finished`: the steps' order is load-bearing and unexplained
|
||||||
|
- Self-sufficiency: `bin/agent_cycle/judge.py:25` `INTERRUPT_RULES`: behaviour lives in prompt text no code shows the effect of
|
||||||
|
|
||||||
|
Maintainability senior, hardest first:
|
||||||
|
|
||||||
|
- Locality, Overall: `bin/do_epic/main.py:538` `handed_on`: five ways on three axes, with no table of the cases
|
||||||
|
- Locality: `bin/do_epic/main.py:379` `parked_through`: a negated three-part condition, and state carried between passes
|
||||||
|
- Shape: `bin/plan/ranking.py:239` `score`: every change is made twice, for OLD_SHAPE and SHAPE
|
||||||
|
- Self-sufficiency: `bin/larv_review/main.py:33` module docstring: when a scoring run is due is stated only in help prose
|
||||||
|
|
||||||
|
Inherited architect, would restructure first:
|
||||||
|
|
||||||
|
- Shape, Overall: `bin/do_epic/main.py:301` `chunk_run`: argument parsing, status, dry run, windows and parking in one 47 KB module
|
||||||
|
- Locality: `bin/rule_hook/round_cap.py:28` `earlier_titles`: three callers count rounds from titles fetched three ways
|
||||||
|
- Navigation, Shape: `README.md:234` "Packages under bin/": about 95 entries at one level, tool and shared packages side by side
|
||||||
|
- Shape: `bin/larv_review/plan.py:1` module: decides whether a scoring run is due, not anything about the plan
|
||||||
|
|
||||||
|
## 2026-11-23T01:34:06Z, PR #695 at 4dd8b730, against 5b61b476
|
||||||
|
|
||||||
|
Ruling: better
|
||||||
|
|
||||||
|
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
| Mid A | better | better | better | better | better |
|
||||||
|
| Inherited architect | better | better | better | better | better |
|
||||||
|
|
||||||
|
Mid A, decided by:
|
||||||
|
|
||||||
|
- Locality, Shape: `bin/task_bench/main.py:283` `benched`: six named steps over one Bench record, where the base did all of them in one body under a catch-all OSError several frames up
|
||||||
|
- Locality, Self-sufficiency: `bin/task_bench/main.py:199` `on_disk`: each file action names its own failure where it happens
|
||||||
|
- Locality, Self-sufficiency: `bin/task_bench/figures.py:53` `COLUMNS`: each column carries its heading, value and change kind, where the base tied three lists together by position
|
||||||
|
- Locality, Shape, Self-sufficiency: `bin/do_epic/main.py:378` `issue_move`: the move decision is a pure function with its table in the docstring; `How` says little on its own
|
||||||
|
- Navigation, Shape: `bin/do_epic/parking.py:18` `parked_through`: parking has a module of its own, though `parking.py` beside `parked.py` takes opening both
|
||||||
|
- Self-sufficiency, Locality: `bin/do_epic/parking.py:56` `news_after`: the two kinds of news are a pure function, not a nested branch
|
||||||
|
- Navigation, Shape: `bin/larv_review/scoring_due.py:1` module docstring: the name says what it decides, where `plan.py` clashed with the `plan` package
|
||||||
|
- Locality: `bin/larv_review/reviewer_header.py:83` `branch_summaries`: one shared function where two copies were
|
||||||
|
- Locality, Navigation: `bin/task_bench/main.py:468` `digested`: each stream is parsed once and carried in Result; `Side` lives in figures.py
|
||||||
|
|
||||||
|
Inherited architect, decided by:
|
||||||
|
|
||||||
|
- Locality, Self-sufficiency: `bin/do_epic/main.py:378` `issue_move`: the decision is pure, with its first-row-wins table in its docstring, and `handed_on` only matches on it
|
||||||
|
- Locality, Self-sufficiency: `bin/task_bench/figures.py:53` `COLUMNS`: one row per column, where `column not in (4, 6)` needed three places read together
|
||||||
|
- Navigation, Shape: `bin/do_epic/parking.py:18` `parked_through`: a parked chunk's symptom leads to a module named for it, and main.py drops from 699 to 563 lines
|
||||||
|
- Self-sufficiency, Locality: `bin/do_epic/parking.py:56` `news_after`: a pure function whose docstring lists the two kinds of news
|
||||||
|
- Navigation: `bin/larv_review/scoring_due.py:1` module docstring: the name no longer means two things
|
||||||
|
- Shape, Locality: `bin/task_bench/main.py:283` `benched`: a Bench record and named phases that each fit on a screen
|
||||||
|
- Navigation, Shape: `bin/do_epic/epic_run.py:21` `EpicRun`: the shared run record has one named place both main.py and parking.py import
|
||||||
|
- Locality: `bin/claude_code/entries.py:87` `json_objects`: stream parsing done once in one module
|
||||||
|
- Shape: `bin/task_bench/main.py:199` `on_disk`: sits beside hand-written try/except OSError blocks, two ways for one job; plant.py imports `Side` from the measuring module
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ Each project principle states one rule that the decisions below apply; their ent
|
|||||||
- routing: a worker whose run ends asking for a higher rung, citing an escalation trigger the judge finds in the transcript, steps one rung up as the judge interrupts or quotes an answer, or next cycle, up to two rungs above the rung its item picks
|
- routing: a worker whose run ends asking for a higher rung, citing an escalation trigger the judge finds in the transcript, steps one rung up as the judge interrupts or quotes an answer, or next cycle, up to two rungs above the rung its item picks
|
||||||
- routing: loop-claude reads the items a chunk takes from the worker's latest `Chunk items:` line and scores them by `todo.md` as the default branch held it when the cycle started; the judge reports the escalation and whether a release is ready to cut
|
- routing: loop-claude reads the items a chunk takes from the worker's latest `Chunk items:` line and scores them by `todo.md` as the default branch held it when the cycle started; the judge reports the escalation and whether a release is ready to cut
|
||||||
- routing: the worker changes rung only as a chunk starts, after every second unfinished verdict, when it names a chunk item that picks a higher rung, or when it cites an escalation trigger the judge finds
|
- routing: the worker changes rung only as a chunk starts, after every second unfinished verdict, when it names a chunk item that picks a higher rung, or when it cites an escalation trigger the judge finds
|
||||||
|
- task-bench: a bench takes 5 bugs and 5 runs per side, after a 2 × 2 pilot on a new setup, and at no affordable count does a chunk-sized change rise above the noise
|
||||||
- tests: each test earns its keep as the technical principles' test bullet says, and the worker takes a test's expected values from its item, never from the code
|
- tests: each test earns its keep as the technical principles' test bullet says, and the worker takes a test's expected values from its item, never from the code
|
||||||
- the repo may name bender, bender-infra and ai-sandbox
|
- the repo may name bender, bender-infra and ai-sandbox
|
||||||
- todo.md: an item of the next release predicts the files and parts it will touch under `Touches:` in its detail; chunk-preflight takes, in the plan's order, the items that overlap none taken before them as the chunks that may run at once, and the optional `touch-predictions` record keeps each chunk's prediction beside what it touched
|
- todo.md: an item of the next release predicts the files and parts it will touch under `Touches:` in its detail; chunk-preflight takes, in the plan's order, the items that overlap none taken before them as the chunks that may run at once, and the optional `touch-predictions` record keeps each chunk's prediction beside what it touched
|
||||||
@@ -818,6 +819,48 @@ Valid while Claude Code loads `~/.claude/rules/*.md` in every project, a path-sc
|
|||||||
|
|
||||||
2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over one synced in `env.ANTHROPIC_MODEL`, which would override a `/model` pick from the next session on. A model per machine is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. The cost: a move or pull that changes `settings.json` drops the machine's model. The effort keys, `effortLevel` and `modelSettings`, stay synced: the routing decision on a chunk's worker rung relies on the effort `settings.json` gives every interactive session. Valid while Claude Code writes the model it picks into `settings.json`.
|
2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over one synced in `env.ANTHROPIC_MODEL`, which would override a `/model` pick from the next session on. A model per machine is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. The cost: a move or pull that changes `settings.json` drops the machine's model. The effort keys, `effortLevel` and `modelSettings`, stay synced: the routing decision on a chunk's worker rung relies on the effort `settings.json` gives every interactive session. Valid while Claude Code writes the model it picks into `settings.json`.
|
||||||
|
|
||||||
|
## task-bench: a bench takes 5 bugs and 5 runs per side, after a 2 × 2 pilot on a new setup, and at no affordable count does a chunk-sized change rise above the noise
|
||||||
|
|
||||||
|
2026-11-22, lilleman, through todo item 503. Serves goal 1.4, since a bench of 50 runs costs hours and tens of millions of tokens, and goal 1.1, since a bench that can't tell a change from noise doesn't prove anything.
|
||||||
|
|
||||||
|
**Defaults stay 5 bugs and 5 runs.** A sixth run per side cuts the spread of the mean of the bugs' cache-read changes from 16% to 13% for 10 more runs, about 35 minutes.
|
||||||
|
|
||||||
|
**A chunk-sized change doesn't rise above the noise.** PR #490 moved the medians by 5% to 9%. The spread at 5 × 6, the largest count measured, is 11% to 13%. It falls with the square root of the runs, so seeing a 9% change takes about 13 runs per side and bug: 130 runs, 8 hours and 70M cache-read tokens. No chunk waits that long. The bench shows a change of more than about 15% in tokens, since its All change is the mean of the bugs' own changes (item 514). Before that, the change of the pooled medians needed more than 31% in output tokens and 50% in cache-read tokens. Planting harder bugs doesn't make the pass rate show one either: see "Harder bugs" below. Reads and turns, which are counts, not token sums, spread as wide as the tokens: see "Reads and turns" below.
|
||||||
|
|
||||||
|
**Pilot first.** A new setup, or a project the bench hasn't run on, runs 2 bugs × 2 runs before a full bench (lilleman, 2026-11-21). A pilot takes about 40 minutes. The first pilot of this calibration passed no run, because the API refused a token that held a line break. It showed that within 15 minutes, where a full bench would have planted for 25 minutes first and printed the same.
|
||||||
|
|
||||||
|
Measured on `fejkdata` (Go, 5 bugs planted in the files `larv-review places` names, seed 1, Haiku at low effort), 2026-11-21:
|
||||||
|
|
||||||
|
- **Same commit at both sides** (head `c7dd7e15`, 5 bugs × 6 runs, after a pilot of 2 bugs × 2 runs): all 68 runs passed, as did the 30 counted chunk runs below, 98 in all. So the pass rate's spread is zero and it can't show a change of any size. "Harder bugs" below measures the pass rate's spread on a bug Haiku fails. The pooled change was -5% in output tokens, -12% in cache-read tokens and -15% in wall time.
|
||||||
|
- **Spread by bugs × runs.** Each bug's 12 runs were split at random into two sides 4,000 times. Each cell is the 95th percentile of the change's size, in percent, first for the change of the All rows' pooled medians, which the bench printed before item 514, then for the mean of the bugs' own changes, which it prints now:
|
||||||
|
|
||||||
|
| Bugs × runs | Output tokens | Cache-read tokens | Wall time |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 5 × 3 | 41 / 17 | 56 / 22 | 27 / 86 |
|
||||||
|
| 5 × 4 | 33 / 14 | 48 / 18 | 23 / 20 |
|
||||||
|
| 5 × 5 | 31 / 12 | 50 / 16 | 21 / 10 |
|
||||||
|
| 5 × 6 | 28 / 11 | 43 / 13 | 19 / 8.5 |
|
||||||
|
| 3 × 6 | 28 / 14 | 40 / 17 | 16 / 12 |
|
||||||
|
|
||||||
|
The All rows pool every run, so their median lands in whichever bug's runs sit in the middle of the pooled costs, and a bug's cost differs from another's by up to 8×. In tokens, the mean of the bugs' changes has a third to half of the pooled change's spread. In wall time, the mean gains only from 5 × 5. The 86 at 5 × 3 wasn't traced. For the mean of the bugs' token changes, 5 × 4 and 3 × 6 give the same spread (14 and 14, 18 and 17) for 40 and 36 runs. The bench still prints the pooled All rows per side, and the mean as the All change.
|
||||||
|
- **Reads and turns** (2026-11-22) spread as wide as the tokens. `fejkdata` at `095d9bb3` against itself, 5 bugs × 5 runs after a 2 × 2 pilot: all 58 runs passed. Each bug's 10 runs were split at random into two sides 4,000 times. Each cell is the 95th percentile of the change's size. The pooled medians' change is what the All change was before item 514; the mean of the bugs' own changes is what it is now:
|
||||||
|
|
||||||
|
| Figure | Pooled medians' change | Mean of the bugs' changes |
|
||||||
|
|---|---|---|
|
||||||
|
| Output tokens | 25% | 12% |
|
||||||
|
| Cache-read tokens | 41% | 17% |
|
||||||
|
| Turns | 31%, or 3.0 turns | 14%, or 1.8 turns |
|
||||||
|
| Reads and searches before the first open of the bug's file | 4.0 reads | 0.6 reads |
|
||||||
|
|
||||||
|
Neither count sees a change the tokens can't. The bugs' median turns average 14.5 and their median reads 3.9, so 1.8 turns is 12% of a bug's turns and 0.6 reads is 15% of its reads, in line with the tokens' 12% and 17%. The pooled change's spread, 4.0 reads, is more than a bug's typical 3.9 reads. Reads are small whole numbers, from 0 to 9, so the change in reads is given in reads, not as a percentage. The 9 of the 50 runs that never opened the bug's file are left out of the reads' medians. The tokens' own figures moved by up to a fifth against the first calibration's above (25 and 41 against 31 and 50 for the pooled change), so each 95th percentile may be off by about a fifth.
|
||||||
|
- **Harder bugs** (2026-11-22). No bug is hard enough to make the pass rate show a chunk-sized change. Hiding the tests, the one way that made Haiku fail, also spreads the token figures about three times as wide. So the bench plants as before. Two ways were tried on `fejkdata`, at `2575c275` against itself with seed 1:
|
||||||
|
- **Two mutants in one function**: each bug's mutant, and the mutant nearest to it in the same function that the tests kill, with the tests at hand as in every bench above. A 2 × 2 pilot passed 8 of 8 runs. Haiku runs `go test`, which names the failing test and its line. So it fixes one mutant, runs the tests again and fixes the other.
|
||||||
|
- **The tests hidden.** The copy Haiku got held no test file and no `testdata` folder. Haiku's prompt said that the tests were missing. The check ran the side's own tests over Haiku's code. A 5 × 5 bench passed 48 of 50 runs: one bug failed 2 of its 10 runs, and the other four passed all 10. Each bug's 10 runs were split at random into two sides 4,000 times, as above. The 95th percentile of the pass count's change is 2 runs of 25, or 8 points, so the bench would show a change of 3 runs, 12 points, or more. Every other figure spreads wider than it does with the tests at hand. For the mean of the bugs' changes, the spread is 46% in output tokens, 43% in cache-read tokens, 23% in turns and 45% in wall time. With the tests at hand it is 12%, 16%, 14% and 10%. The bug that failed twice took from 0.5M to 6.3M cache-read tokens a run. The bench took 2.2 hours and 47M cache-read tokens, where a 5 × 5 bench with the tests takes 28M. So hiding the tests buys a pass count that shows a change of 12 points, and pays with token figures that show a change of 45% where they showed 15%.
|
||||||
|
|
||||||
|
The pass rate's noise follows from arithmetic. Where both sides pass at the rate p, two sides of 25 runs differ by more than 1.96 × √(2p(1 − p) / 25) in 1 bench of 20. That is 11 points at p = 0.96, the rate measured here, 22 points at 0.8 and 28 points at 0.5. The measured 8 points and the 12 above bracket the 11: a pass count moves in whole runs, and 2 runs of 25 are 8 points, 3 are 12. Whether a chunk moves the pass rate that far is a judgment, not a measurement: PR #490 moved the costs by 5% to 9%, and no figure here suggests that such a change moves the pass rate by 11 points. For that reason a third way wasn't run: keeping a mutant only where Haiku fails it in one or more of 5 trial runs at the base. It would pick bugs like the one that failed twice here, at p = 0.8, and with the tests at hand no bug failed in 98 runs.
|
||||||
|
- **One finished chunk**: `fejkdata`'s PR #490, base `33b7fa80`, head `5b9c2a14`, which the comprehension panel ruled better on Navigation, Locality and Shape and the same on Self-sufficiency. The bench planted 5 bugs and ran 38 of 50 runs before the machine restarted. The first 3 runs per bug and side, 30 runs, are the ones counted, and all passed. The mean of the bugs' changes was +4.6% in output tokens, +8.9% in cache-read tokens and +3.8% in turns, with the bugs' own changes in cache-read tokens from -41% to +47%. The two token figures sit inside the spread at 5 × 3, 17% and 22%. The turns' +3.8% sits inside their spread at 5 × 5, 14%, and the spread at 5 × 3 can only be wider. The mean of the wall times' changes, +105%, lies above the 86% of that row, from one bug whose head runs took 6.8 times as long at the median. Nobody read its streams to find out why. The head cost slightly more tokens where the panel finds it easier to read, and the wall time can't be judged, so the bench neither confirmed nor contradicted the panel.
|
||||||
|
- **Cost**: 5 bugs × 6 runs took 3.9 hours and 34M cache-read, 1.2M cache-write and 0.3M output tokens; a run takes about 3.5 minutes, and planting 16 to 25 minutes. A 5 × 5 bench is about 3.3 hours and 28M cache-read tokens. Gremlins ran out of 8 GB at the base of PR #490, so the help's example takes 16 GB.
|
||||||
|
|
||||||
## tests: CI runs the suite through `ci.sh` on every pull request, in a pinned Python container, and `main`'s branch protection holds a merge until it passes
|
## tests: CI runs the suite through `ci.sh` on every pull request, in a pinned Python container, and `main`'s branch protection holds a merge until it passes
|
||||||
|
|
||||||
2026-11-09, larv-review, through todo item 12. Serves goal 1.1: a merge no longer rests on the worker's word. larv-review's gate was the local run alone, which it skips when the last stability round left the suite green, so an unattended chunk could merge on the worker's own report. gitea.larvit.se's runners labelled `docker-host` run `.gitea/workflows/ci.yml`, which runs `ci.sh` on the committed HEAD in a pinned Python container; the script's header says how. A run takes about 3 minutes.
|
2026-11-09, larv-review, through todo item 12. Serves goal 1.1: a merge no longer rests on the worker's word. larv-review's gate was the local run alone, which it skips when the last stability round left the suite green, so an unattended chunk could merge on the worker's own report. gitea.larvit.se's runners labelled `docker-host` run `.gitea/workflows/ci.yml`, which runs `ci.sh` on the committed HEAD in a pinned Python container; the script's header says how. A run takes about 3 minutes.
|
||||||
|
|||||||
@@ -3367,3 +3367,92 @@ Read most (opens and searches):
|
|||||||
- `bin/mutate-changes` 2
|
- `bin/mutate-changes` 2
|
||||||
- `bin/mutate_changes/main.py` 2
|
- `bin/mutate_changes/main.py` 2
|
||||||
- `bin/mutate_changes/test_mutate_changes_runs.py` 2
|
- `bin/mutate_changes/test_mutate_changes_runs.py` 2
|
||||||
|
|
||||||
|
## Reading cost, chunk d56c1f21bd44, finished 2026-11-21T12:07:42Z
|
||||||
|
|
||||||
|
136856 new input tokens before the first commit.
|
||||||
|
|
||||||
|
Read most (opens and searches):
|
||||||
|
|
||||||
|
- `bin/task_bench/main.py` 8
|
||||||
|
- `bin/task_bench/test_task_bench.py` 6
|
||||||
|
- `.gitignore` 3
|
||||||
|
- `README.md` 3
|
||||||
|
- `bin/claude_code/entries.py` 3
|
||||||
|
- `bin/chunk_driver/project/model_choice.py` 2
|
||||||
|
- `bin/git_cli/git_repo.py` 2
|
||||||
|
- `bin/reading_cost/measure.py` 2
|
||||||
|
- `bin/review_rules/review_folder.py` 2
|
||||||
|
- `bin/task_bench/figures.py` 2
|
||||||
|
|
||||||
|
## Reading cost, chunk 666aabdd77a8, finished 2026-11-22T15:50:09Z
|
||||||
|
|
||||||
|
283046 new input tokens before the first commit.
|
||||||
|
|
||||||
|
Read most (opens and searches):
|
||||||
|
|
||||||
|
- `docs/decisions.md` 14
|
||||||
|
- `bin/task_bench/main.py` 9
|
||||||
|
- `bin/task_bench/figures.py` 4
|
||||||
|
- `bin/task_bench/plant.py` 4
|
||||||
|
- `bin/task_bench/test_figures.py` 4
|
||||||
|
- `bin/task_bench/runs.py` 3
|
||||||
|
- `CHANGELOG.md` 2
|
||||||
|
- `README.md` 2
|
||||||
|
- `docs/comprehension-history.md` 2
|
||||||
|
- `docs/score-anchors.md` 2
|
||||||
|
|
||||||
|
## Reading cost, chunk f8fb061b8347, finished 2026-11-22T16:17:47Z
|
||||||
|
|
||||||
|
49961 new input tokens before the first commit.
|
||||||
|
|
||||||
|
Read most (opens and searches):
|
||||||
|
|
||||||
|
- `CHANGELOG.md` 2
|
||||||
|
- `README.md` 1
|
||||||
|
- `bin/task_bench/figures.py` 1
|
||||||
|
- `bin/task_bench/main.py` 1
|
||||||
|
- `bin/task_bench/test_figures.py` 1
|
||||||
|
- `ci.sh` 1
|
||||||
|
|
||||||
|
## Reading cost, chunk 5e92d92c0f61, finished 2026-11-22T16:55:52Z
|
||||||
|
|
||||||
|
63406 new input tokens before the first commit.
|
||||||
|
|
||||||
|
Read most (opens and searches):
|
||||||
|
|
||||||
|
- `bin/task_bench/main.py` 3
|
||||||
|
- `docs/decisions.md` 2
|
||||||
|
- `CHANGELOG.md` 1
|
||||||
|
- `README.md` 1
|
||||||
|
- `bin/task_bench/figures.py` 1
|
||||||
|
- `bin/task_bench/test_figures.py` 1
|
||||||
|
- `ci.sh` 1
|
||||||
|
|
||||||
|
## Reading cost, chunk 756ad55ec2e9, finished 2026-11-22T20:42:27Z
|
||||||
|
|
||||||
|
89968 new input tokens before the first commit.
|
||||||
|
|
||||||
|
Read most (opens and searches):
|
||||||
|
|
||||||
|
- `bin/task_bench/figures.py` 3
|
||||||
|
- `docs/decisions.md` 3
|
||||||
|
- `README.md` 2
|
||||||
|
- `bin/task_bench/main.py` 2
|
||||||
|
- `bin/task_bench/runs.py` 2
|
||||||
|
- `ci.sh` 2
|
||||||
|
- `bin/task_bench/bench_folder.py` 1
|
||||||
|
|
||||||
|
## Reading cost, chunk 55d6a4a1c134, finished 2026-11-23T00:01:27Z
|
||||||
|
|
||||||
|
96728 new input tokens before the first commit.
|
||||||
|
|
||||||
|
Read most (opens and searches):
|
||||||
|
|
||||||
|
- `bin/task_bench/main.py` 7
|
||||||
|
- `bin/task_bench/test_task_bench.py` 4
|
||||||
|
- `README.md` 2
|
||||||
|
- `bin/task_bench/plant.py` 2
|
||||||
|
- `bin/task_bench/runs.py` 2
|
||||||
|
- `docs/decisions.md` 2
|
||||||
|
- `CHANGELOG.md` 1
|
||||||
|
|||||||
@@ -6,15 +6,18 @@
|
|||||||
|
|
||||||
`Bar = 0.1`
|
`Bar = 0.1`
|
||||||
|
|
||||||
`Next ID = 513`
|
`Next ID = 524`
|
||||||
|
|
||||||
|
## Renamed
|
||||||
|
|
||||||
|
- 0.15.1 renamed to 0.16.0
|
||||||
|
|
||||||
## Items
|
## Items
|
||||||
|
|
||||||
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|
||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||
| 503 | 0.15.1 | | owner | **Calibrate `task-bench` on fejkdata: bench a head against itself for the noise floor, then one finished chunk at its base and head, and record in a decision how many tasks and runs the bench needs.** | 1 | 2 | 1 | 2 | 2 | 1.1 by 3 | 1.2 |
|
| 509 | 0.16.0 | | owner | **Run `task-bench` beside the scoring run in larv-review comprehension check, and record its figures in the comprehension history beside the panel scores.** | 3 | 2 | 3 | 6 | 5 | code health by 5, 1.1 by 3 | 5.6 |
|
||||||
| 509 | 0.16.0 | 503 | owner | **Run `task-bench` beside the scoring run in larv-review comprehension check, and record its figures in the comprehension history beside the panel scores.** | 3 | 2 | 3 | 6 | 5 | code health by 5, 1.1 by 3 | 5.6 |
|
| 504 | 0.16.0 | | owner | **Bench new features in `task-bench`, each a spec for Haiku with acceptance tests it never sees and a reference patch that proves it can be built, kept in a `bench-tasks` folder the project config names, starting with six for fejkdata.** | 3 | 2 | 1 | 4 | 6 | 1.1 by 4, code health by 3 | 2.6 |
|
||||||
| 504 | 0.16.0 | 503 | owner | **Bench new features in `task-bench`, each a spec for Haiku with acceptance tests it never sees and a reference patch that proves it can be built, kept in a `bench-tasks` folder the project config names, starting with six for fejkdata.** | 3 | 2 | 1 | 4 | 6 | 1.1 by 4, code health by 3 | 2.6 |
|
|
||||||
| 505 | 0.16.0 | 504 | owner | **Bench adding source data in `task-bench`: hand Haiku a fake register that a seeded script generates for a made-up country, and check the importer, the data and the licence entry it adds, starting with five tasks for fejkdata.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 3, code health by 2 | 2.6 |
|
| 505 | 0.16.0 | 504 | owner | **Bench adding source data in `task-bench`: hand Haiku a fake register that a seeded script generates for a made-up country, and check the importer, the data and the licence entry it adds, starting with five tasks for fejkdata.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 3, code health by 2 | 2.6 |
|
||||||
| 508 | 0.16.0 | | owner | **Plant bugs for `task-bench` in Python, Rust, TypeScript and PHP, from the mutants `mutate-changes` runs for each, so this repo benches itself.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 3, code health by 2 | 2.6 |
|
| 508 | 0.16.0 | | owner | **Plant bugs for `task-bench` in Python, Rust, TypeScript and PHP, from the mutants `mutate-changes` runs for each, so this repo benches itself.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 3, code health by 2 | 2.6 |
|
||||||
| 506 | 0.16.0 | 504 | owner | **Go over the bench features in each release review: reapply each reference patch, drop a feature that no longer breaks a goal, and add features until they cover the places the seats find hardest.** | 2 | 2 | 2 | 4 | 3 | 1.1 by 3 | 1.1 |
|
| 506 | 0.16.0 | 504 | owner | **Go over the bench features in each release review: reapply each reference patch, drop a feature that no longer breaks a goal, and add features until they cover the places the seats find hardest.** | 2 | 2 | 2 | 4 | 3 | 1.1 by 3 | 1.1 |
|
||||||
@@ -22,6 +25,7 @@
|
|||||||
| 507 | 0.16.0 | 504 | owner | **Bench rebuilding a feature the project shipped: revert its commit at the head, hand Haiku its item tagline, and check with the tests that commit added.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 3 | 0.7 |
|
| 507 | 0.16.0 | 504 | owner | **Bench rebuilding a feature the project shipped: revert its commit at the head, hand Haiku its item tagline, and check with the tests that commit added.** | 3 | 2 | 1 | 4 | 5 | 1.1 by 3 | 0.7 |
|
||||||
| 477 | 0.17.0 | | question | **Rewrite `## Goals` and `## Audience` for a setup others install and run apart from their own `~/.claude`.** | 1 | 1 | 2 | 2 | 2 | | 0.0 |
|
| 477 | 0.17.0 | | question | **Rewrite `## Goals` and `## Audience` for a setup others install and run apart from their own `~/.claude`.** | 1 | 1 | 2 | 2 | 2 | | 0.0 |
|
||||||
| 478 | 0.17.0 | | question | **Name the project, its repo and its two commands, today proposed as `do-release` and `do-epic`.** | 1 | 1 | 2 | 2 | 1 | | 0.0 |
|
| 478 | 0.17.0 | | question | **Name the project, its repo and its two commands, today proposed as `do-release` and `do-epic`.** | 1 | 1 | 2 | 2 | 1 | | 0.0 |
|
||||||
|
| 523 | 0.17.0 | | | **Make the security pass and stability-reviewer check that a new secret's docs name its scope and its reach, such as the other repositories its account can use.** | 1 | 1 | 2 | 2 | 1 | 1.1 by 2 | 0.9 |
|
||||||
| 480 | 0.18.0 | | owner | **Resolve every path the tools use in one module: the release root (the folder the running code ships in), the config folder, the state folder and the Claude home. Then only that module names `~/.claude`, and the loop still runs from `~/.claude`.** | 3 | 2 | 3 | 6 | 6 | 1.6 by 3, code health by 3 | 2.4 |
|
| 480 | 0.18.0 | | owner | **Resolve every path the tools use in one module: the release root (the folder the running code ships in), the config folder, the state folder and the Claude home. Then only that module names `~/.claude`, and the loop still runs from `~/.claude`.** | 3 | 2 | 3 | 6 | 6 | 1.6 by 3, code health by 3 | 2.4 |
|
||||||
| 481 | 0.18.0 | 480 | owner | **Put the release's tools on `PATH` for every session the loop starts and every hook it runs, name them bare in the prose in place of `~/.claude/bin/<tool>`, and refuse the old spelling in new prose.** | 3 | 2 | 3 | 6 | 6 | 1.4 by 2, code health by 2 | 1.6 |
|
| 481 | 0.18.0 | 480 | owner | **Put the release's tools on `PATH` for every session the loop starts and every hook it runs, name them bare in the prose in place of `~/.claude/bin/<tool>`, and refuse the old spelling in new prose.** | 3 | 2 | 3 | 6 | 6 | 1.4 by 2, code health by 2 | 1.6 |
|
||||||
| 482 | 0.19.0 | 478, 481 | owner | **Install the setup with `uv tool install` from a release tag, with `do-release` and `do-epic` on `PATH`, and replace `deploy-release` with `do-release self-update`.** | 3 | 2 | 3 | 6 | 7 | 1.6 by 4, 1.3 by 3 | 1.3 |
|
| 482 | 0.19.0 | 478, 481 | owner | **Install the setup with `uv tool install` from a release tag, with `do-release` and `do-epic` on `PATH`, and replace `deploy-release` with `do-release self-update`.** | 3 | 2 | 3 | 6 | 7 | 1.6 by 4, 1.3 by 3 | 1.3 |
|
||||||
@@ -43,6 +47,7 @@
|
|||||||
| 496 | 0.22.0 | 478, 491 | owner | **Rename the repo to the name item 478 picks, and rename what says Claude where it means any harness, such as `CLAUDE.md`.** | 3 | 2 | 3 | 6 | 6 | code health by 2 | 1.3 |
|
| 496 | 0.22.0 | 478, 491 | owner | **Rename the repo to the name item 478 picks, and rename what says Claude where it means any harness, such as `CLAUDE.md`.** | 3 | 2 | 3 | 6 | 6 | code health by 2 | 1.3 |
|
||||||
| 494 | 0.22.0 | 477, 483 | owner | **Let a newcomer install, log in and run a first project from the README alone, with an example config, and test a fresh install in a container in the gate.** | 2 | 2 | 2 | 4 | 5 | 1.6 by 4 | 0.8 |
|
| 494 | 0.22.0 | 477, 483 | owner | **Let a newcomer install, log in and run a first project from the README alone, with an example config, and test a fresh install in a container in the gate.** | 2 | 2 | 2 | 4 | 5 | 1.6 by 4 | 0.8 |
|
||||||
| 446 | 0.23.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 |
|
| 446 | 0.23.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 |
|
||||||
|
| 521 | 0.23.0 | | | **Refuse a `.dockerignore` that leaves out a secret-named entry the `.gitignore` beside it ignores, where a Dockerfile copies the whole build context.** | 2 | 2 | 3 | 5 | 3 | 4 by 4 | 5.0 |
|
||||||
| 462 | 0.23.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 |
|
| 462 | 0.23.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.23.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 |
|
| 77 | 0.23.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.23.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 |
|
| 196 | 0.23.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 |
|
||||||
@@ -52,7 +57,7 @@
|
|||||||
| 499 | 0.23.0 | | defect | **Stop `todo-item add` and `edit` from waiting on a stdin that stays open without data, so a call without a heredoc ends at once.** | 2 | 2 | 2 | 4 | 2 | 1.5 by 3, 1.4 by 2 | 1.9 |
|
| 499 | 0.23.0 | | defect | **Stop `todo-item add` and `edit` from waiting on a stdin that stays open without data, so a call without a heredoc ends at once.** | 2 | 2 | 2 | 4 | 2 | 1.5 by 3, 1.4 by 2 | 1.9 |
|
||||||
| 445 | 0.23.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 |
|
| 445 | 0.23.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.23.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 |
|
| 171 | 0.23.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.23.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 |
|
| 300 | 0.23.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, Shape and Self-sufficiency first; today the second scoring run at 6322c6e1 scored Navigation 6.75, Locality 5.75, Shape 5.75, Self-sufficiency 5.75 and Overall 6.00.** | 4 | 2 | 3 | 7 | 8 | code health by 8 | 1.7 |
|
||||||
| 264 | 0.23.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 |
|
| 264 | 0.23.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.23.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 |
|
| 323 | 0.23.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.23.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 |
|
| 342 | 0.23.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 |
|
||||||
@@ -86,9 +91,12 @@
|
|||||||
| 266 | 0.23.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 |
|
| 266 | 0.23.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.23.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 |
|
| 339 | 0.23.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.23.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 |
|
| 341 | 0.23.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 |
|
||||||
|
| 522 | 0.23.0 | | | **Let a subagent that ships a chunk in a worktree of another repo run larv-review's security pass on that worktree's diff.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 3 | 1.0 |
|
||||||
|
| 518 | 0.23.0 | | | **Refuse `nothing`, `no one` and `nobody` after a verb or a preposition in everything Claude writes: files, commit messages, pull requests and Jira text before they are written, and chat replies by sending them back to be reworded.** | 3 | 2 | 3 | 6 | 5 | 1.1 by 4 | 0.9 |
|
||||||
| 181 | 0.23.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 |
|
| 181 | 0.23.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.23.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 |
|
| 193 | 0.23.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.23.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 |
|
| 194 | 0.23.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 |
|
||||||
|
| 519 | 0.23.0 | | | **Make stability-reviewer check that a test which runs git, or a script that runs git on another repository, isolates it from the caller's git environment.** | 1 | 2 | 2 | 3 | 1 | 1.1 by 2 | 0.9 |
|
||||||
| 298 | 0.23.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 |
|
| 298 | 0.23.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.23.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 |
|
| 265 | 0.23.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 |
|
||||||
| 475 | 0.23.0 | | | **Have stability-reviewer report, as a finding, each lookup that an input from outside the repo can make fail without an error naming what was missing.** | 1 | 1 | 2 | 2 | 2 | 1.1 by 2 | 0.8 |
|
| 475 | 0.23.0 | | | **Have stability-reviewer report, as a finding, each lookup that an input from outside the repo can make fail without an error naming what was missing.** | 1 | 1 | 2 | 2 | 2 | 1.1 by 2 | 0.8 |
|
||||||
@@ -97,6 +105,7 @@
|
|||||||
| 169 | 0.23.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 |
|
| 169 | 0.23.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.23.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 |
|
| 447 | 0.23.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.23.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 |
|
| 367 | 0.23.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 |
|
||||||
|
| 520 | 0.23.0 | | | **Mutate the shell lines a branch changes in `mutate-changes`, so a change to a shell script gets the same check as one in Python, Go or PHP.** | 3 | 2 | 2 | 5 | 5 | 1.1 by 2 | 0.5 |
|
||||||
| 423 | 0.23.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 |
|
| 423 | 0.23.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.23.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 |
|
| 197 | 0.23.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.24.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 |
|
| 1 | 0.24.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 |
|
||||||
@@ -104,15 +113,6 @@
|
|||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
### 503. Calibrate `task-bench` on fejkdata: bench a head against itself for the noise floor, then one finished chunk at its base and head, and record in a decision how many tasks and runs the bench needs.
|
|
||||||
|
|
||||||
The decision records the spread of the pass rate and of the median tokens when both sides are the same commit, the task and run counts at which a chunk's change rises above that spread, and what one bench costs in tokens and hours. Where no affordable count rises above the noise, it says so, and files what to try instead. The bench's defaults take the counts it picks.
|
|
||||||
|
|
||||||
Touches:
|
|
||||||
|
|
||||||
- `docs/decisions.md`: `## task-bench: how many tasks and runs a bench takes`
|
|
||||||
- `bin/task_bench/main.py`: `main` (small)
|
|
||||||
|
|
||||||
### 509. Run `task-bench` beside the scoring run in larv-review comprehension check, and record its figures in the comprehension history beside the panel scores.
|
### 509. Run `task-bench` beside the scoring run in larv-review comprehension check, and record its figures in the comprehension history beside the panel scores.
|
||||||
|
|
||||||
It stays a report beside the panel until about 10 chunks show whether the two agree; whether it can replace the scoring run or gate a merge is the human's call then.
|
It stays a report beside the panel until about 10 chunks show whether the two agree; whether it can replace the scoring run or gate a merge is the human's call then.
|
||||||
@@ -171,6 +171,10 @@ Part of the standalone-install plan lilleman approved on 2026-11-20. `do-release
|
|||||||
|
|
||||||
Part of the standalone-install plan lilleman approved on 2026-11-20. Later items say `do-release` and `do-epic` for the names this item picks. The names set the install folders, such as `~/.config/do-release/`, so items 482, 485 and 496, and every item they block, wait for them.
|
Part of the standalone-install plan lilleman approved on 2026-11-20. Later items say `do-release` and `do-epic` for the names this item picks. The names set the install folders, such as `~/.config/do-release/`, so items 482, 485 and 496, and every item they block, wait for them.
|
||||||
|
|
||||||
|
### 523. Make the security pass and stability-reviewer check that a new secret's docs name its scope and its reach, such as the other repositories its account can use.
|
||||||
|
|
||||||
|
An outside reviewer found it on a client project's PR that added a secret: a Gitea token documented as able to run Actions on one repository, "and nothing wider". The token reaches every repository its owning account can, so the docs had to require a dedicated account with access to that repository only. Neither `/security-review` nor stability-reviewer raised it. Where a change adds a secret or a token, ask each to check that the doc beside it states what the credential can reach, not only what the change uses it for.
|
||||||
|
|
||||||
### 480. Resolve every path the tools use in one module: the release root (the folder the running code ships in), the config folder, the state folder and the Claude home. Then only that module names `~/.claude`, and the loop still runs from `~/.claude`.
|
### 480. Resolve every path the tools use in one module: the release root (the folder the running code ships in), the config folder, the state folder and the Claude home. Then only that module names `~/.claude`, and the loop still runs from `~/.claude`.
|
||||||
|
|
||||||
Part of the standalone-install plan lilleman approved on 2026-11-20. `do-release` and `do-epic` stand for the names item 478 picks. Today about 160 references in some 40 modules name `~/.claude`; `bin/loop_state/paths.py` holds a few. This item changes no behaviour.
|
Part of the standalone-install plan lilleman approved on 2026-11-20. `do-release` and `do-epic` stand for the names item 478 picks. Today about 160 references in some 40 modules name `~/.claude`; `bin/loop_state/paths.py` holds a few. This item changes no behaviour.
|
||||||
@@ -257,6 +261,17 @@ Touches:
|
|||||||
- `bin/loop_effects/child_shells.py`: `stop` (small)
|
- `bin/loop_effects/child_shells.py`: `stop` (small)
|
||||||
- `bin/loop_claude/loop/usage.py`: `HELP` (small)
|
- `bin/loop_claude/loop/usage.py`: `HELP` (small)
|
||||||
|
|
||||||
|
### 521. Refuse a `.dockerignore` that leaves out a secret-named entry the `.gitignore` beside it ignores, where a Dockerfile copies the whole build context.
|
||||||
|
|
||||||
|
An outside reviewer caught what our review missed: a repo's `.gitignore` ignored `auth.json`, Composer's credentials file, while its `.dockerignore` didn't, and its Dockerfiles run `COPY . .`. A developer's local `auth.json` could then reach the image. Today rule-hook checks ignore files only for sort order (`ignorefile-sorted`).
|
||||||
|
|
||||||
|
Add a rule-hook check on Write and Edit of `.gitignore`, `.dockerignore` and `Dockerfile*`, and a gate check:
|
||||||
|
- where a Dockerfile in the repo copies the whole context (`COPY . <dest>` or `ADD . <dest>`),
|
||||||
|
- each `.gitignore` entry whose name marks a secret (`.env`, `.env.*`, `auth.json`, `*.pem`, `*.key`, `id_*`, `credentials*`, `*secret*`)
|
||||||
|
- must also be in `.dockerignore`, or be excluded by a pattern there.
|
||||||
|
|
||||||
|
Name the entry and the Dockerfile line. Source the secret-name list from a widely used one, such as GitHub's gitignore templates or gitleaks' default rules, and cite it in the decision that records the list.
|
||||||
|
|
||||||
### 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.
|
### 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.
|
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.
|
||||||
@@ -325,30 +340,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).
|
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, 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.
|
### 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, Shape and Self-sufficiency first; today the second scoring run at 6322c6e1 scored Navigation 6.75, Locality 5.75, Shape 5.75, Self-sufficiency 5.75 and Overall 6.00.
|
||||||
|
|
||||||
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.
|
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 item 515's chunk at 6322c6e1. The lowest means are Locality, Shape and Self-sufficiency, all at 5.75 in the second run; the first run put Locality at 5.63 and the other two at 5.88. Locality: do-epic and chunk-pr run order-dependent steps and carry state between loop passes (`handed_on`, `parked_through`, `merged`, `levelled_and_finished`), and no code enforces the order. Shape: `bin/do_epic/main.py` and `bin/chunk_pr/main.py` are hubs of about 700 and 764 lines, `bin/` holds about 95 entries at one level, and the OLD_SHAPE fork in `bin/plan/ranking.py` doubles the paths through ranking. Self-sufficiency: the why behind code sits in `docs/decisions.md`, the README or help prose, not beside the unit. 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.
|
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`), Locality and Self-sufficiency first:
|
Places the seats named, hardest first (`larv-review places`), Locality first:
|
||||||
|
|
||||||
- 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, Shape, Self-sufficiency: `bin/do_epic/main.py:538` `handed_on`: five branches over the landing, the automation and two statuses, with no table of the cases; it needs the README's do-epic settings beside it. Seven of eight seats named it over the two runs.
|
||||||
- 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/main.py:379` `parked_through`, with `:455` `resumed_news`: seven flags to hold over park, resume and a human's merge; park must come before resume, and no code enforces it. Six 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: `bin/chunk_pr/main.py:448` `merged`, with `:587` `levelled_and_finished`: one loop interleaves the queue turn, approval waits and parking, and the steps' order is load-bearing and unexplained. Four 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.
|
- Locality: `bin/rule_hook/round_cap.py:28` `earlier_titles`: three callers count rounds from titles fetched three ways.
|
||||||
- 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: `bin/do_epic/scheduler.py:172` `start_chunks`: chunk state is rebuilt from tmux window names.
|
||||||
- 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/agent_cycle/routing.py:115` `unfinished_route`: the route depends on state three modules write.
|
||||||
- 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.
|
- Shape: `bin/do_epic/main.py:301` `chunk_run`: argument parsing, status, dry run, windows and parking in one 47 KB module.
|
||||||
- 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/plan/ranking.py:239` `score`, with `:144` `weigh`: every change is made twice, for OLD_SHAPE and SHAPE. Two seats named it.
|
||||||
- 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.
|
- Navigation, Shape: `README.md:234` "Packages under bin/": about 95 entries at one level, tool and shared packages side by side. Both architects named it.
|
||||||
- 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/larv_review/plan.py:1` module: decides whether a scoring run is due, not anything about the plan.
|
||||||
- Shape: `bin/do_epic/gates.py:42` `gate`: a long ordered chain where a missing value means something different on each line.
|
- Self-sufficiency: `skills/larv-review/SKILL.md:94` "Round cap": the review loop's rules live only in the skill's text. Two seats named it.
|
||||||
- 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/larv_review/main.py:33` module docstring: when a scoring run is due is stated only in help prose.
|
||||||
- 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.
|
- Self-sufficiency: `bin/agent_cycle/judge.py:25` `INTERRUPT_RULES`: behaviour lives in prompt text no code shows the effect of.
|
||||||
- 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.
|
- Self-sufficiency: `bin/project_config/settings.py:201` `load`: the settings' meaning sits in the help text.
|
||||||
- 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.
|
- Self-sufficiency: `bin/agent_cycle/verdicts.py:41` `Verdict`: cites `cycle.judge.re_ask_checked`, which doesn't exist.
|
||||||
- Locality: `reviewer-merge-trials/driver.py:4`: a frozen trial imports live code under `bin/`, so a refactor there breaks a record.
|
- Navigation: `bin/agent_cycle/run.py:103` `archived`: cites a `close.py` that doesn't exist.
|
||||||
|
|
||||||
### 264. Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars.
|
### 264. Report the comprehension seats and the escalated subagents as subagent types of their own in `routing-figures.md`, with their dollars.
|
||||||
|
|
||||||
@@ -596,6 +611,31 @@ Touches:
|
|||||||
- `bin/agent_cycle/test_run.py`: `Cycles` (small)
|
- `bin/agent_cycle/test_run.py`: `Cycles` (small)
|
||||||
- `bin/loop_claude/loop/test_usage.py`: `HelpLimits` (small)
|
- `bin/loop_claude/loop/test_usage.py`: `HelpLimits` (small)
|
||||||
|
|
||||||
|
### 522. Let a subagent that ships a chunk in a worktree of another repo run larv-review's security pass on that worktree's diff.
|
||||||
|
|
||||||
|
On 2026-11-22, eleven subagents each shipped a chunk in a worktree of a different repo. Every one of them hit the same problem at the security pass:
|
||||||
|
- `/security-review` reads the diff of the session's working directory, which a subagent inherits from the main session.
|
||||||
|
- A `cd` inside the subagent doesn't reach the skill.
|
||||||
|
- `EnterWorktree` refuses a worktree of another repo.
|
||||||
|
|
||||||
|
So each subagent stopped before opening its pull request, and the main session had to `cd` into each worktree and launch the security subagent from there. Every chunk waited on the main session. Some subagents also reviewed by hand, which larv-review forbids.
|
||||||
|
|
||||||
|
Make one of these work, and test it with a subagent in a worktree of another repo:
|
||||||
|
- `EnterWorktree`, or a launch option, sets a subagent's working directory to any worktree path;
|
||||||
|
- or larv-review's security launch names the worktree and the base ref, and the skill reviews `git diff <base>...HEAD` there.
|
||||||
|
|
||||||
|
Then larv-review §3 → "Security" says how a subagent in another repo's worktree runs the pass.
|
||||||
|
|
||||||
|
### 518. Refuse `nothing`, `no one` and `nobody` after a verb or a preposition in everything Claude writes: files, commit messages, pull requests and Jira text before they are written, and chat replies by sending them back to be reworded.
|
||||||
|
|
||||||
|
The human can't stand the `changes nothing` form, and `CLAUDE.md` → "Prose" bans it, yet it still slips through: on 2026-11-22 a draft goal read "a repo that calls the action and changes nothing keeps working". A prose rule only works when the model notices, so move the check into tools, which catch it every time.
|
||||||
|
|
||||||
|
- **rule-hook, before the write:** refuse a Write, Edit or MultiEdit whose new text in a prose file (`.md`, or a comment or docstring) holds the form. Do the same for a Bash call whose commit message, `chunk-pr`/`gh`/`tea` pull request text or `jira-rest` body holds it. Name the phrase and suggest the `doesn't <verb> anything` form.
|
||||||
|
- **A Stop hook for chat:** chat can't be filtered before it shows, so a Stop hook reads the last assistant message from the transcript and, where it holds the form, blocks once with the phrase, so the reply is followed by a reworded one. Leave out code blocks and quoted text.
|
||||||
|
- **The gate:** a check in `ci.sh` over the shipped prose, comments, docstrings and test names. Fix what it finds today, such as `bin/rule_hook/endless_wait.py` ("nothing bounds it"), `bin/rule_hook/reviewer_rung.py` ("nothing tells which rung") and the test names `test_a_blocked_call_overrides_nothing_yet` and `test_a_missing_field_breaks_nothing`.
|
||||||
|
|
||||||
|
The form is the word after another word inside a clause: `<word> nothing`, `<word> no one`, `<word> nobody`. A clause that opens with it, as in "Nothing changes", is fine. Bench the pattern on this repo's prose and a few client repos' commit history before it blocks: a false positive blocks every session's writes (I 3).
|
||||||
|
|
||||||
### 181. Have the test of a quoted answer's step-up assert the stepped rung's facts as literals, not through `prompts.rungs_held`.
|
### 181. Have the test of a quoted answer's step-up assert the stepped rung's facts as literals, not through `prompts.rungs_held`.
|
||||||
|
|
||||||
`bin/agent_cycle/test_run.py`'s `test_a_quoted_answer_that_cites_an_escalation_trigger_steps_the_worker_up_before_it_resumes_and_archives_the_step` builds its expected prompt from `prompts.rungs_held`, the code under test, so a bug there passes it. The technical principles' test bullet bans that shape. Assert the new rung and one review launch as literals, as the typed answer's step-up test does. Raised by the principles audit of PR #308.
|
`bin/agent_cycle/test_run.py`'s `test_a_quoted_answer_that_cites_an_escalation_trigger_steps_the_worker_up_before_it_resumes_and_archives_the_step` builds its expected prompt from `prompts.rungs_held`, the code under test, so a bug there passes it. The technical principles' test bullet bans that shape. Assert the new rung and one review launch as literals, as the typed answer's step-up test does. Raised by the principles audit of PR #308.
|
||||||
@@ -608,6 +648,18 @@ Found by review of PR #317. `bin/plan/goals_file.py`'s `numbered` writes `typing
|
|||||||
|
|
||||||
Found by review of PR #317. The black-box test, `bin/loop_claude/test_black_box.py:609`, not the unit test of the same name in `bin/agent_cycle/test_retry.py`, which runs on a fake clock, sets `resets_at` from the test's `time.time()` and expects the wait, rounded to tens, to be 3720. When more than about 5 s pass between that read and the loop's, the wait rounds to 3710 and the test fails with no bug. Item 102 covers only replacing the `time.sleep` swap; this item changes the expected value, for example by asserting the wait against `resets_at + 120` minus the time the loop read, or a bound on it.
|
Found by review of PR #317. The black-box test, `bin/loop_claude/test_black_box.py:609`, not the unit test of the same name in `bin/agent_cycle/test_retry.py`, which runs on a fake clock, sets `resets_at` from the test's `time.time()` and expects the wait, rounded to tens, to be 3720. When more than about 5 s pass between that read and the loop's, the wait rounds to 3710 and the test fails with no bug. Item 102 covers only replacing the `time.sleep` swap; this item changes the expected value, for example by asserting the wait against `resets_at + 120` minus the time the loop read, or a bound on it.
|
||||||
|
|
||||||
|
### 519. Make stability-reviewer check that a test which runs git, or a script that runs git on another repository, isolates it from the caller's git environment.
|
||||||
|
|
||||||
|
An outside reviewer caught what our review missed, twice in one day:
|
||||||
|
- **A test inherited the environment of whoever ran it.** The test ran git through the script under test. The stability reviewer found one half: the developer's global config, where `commit.gpgsign=true` made every test error. The forge's reviewer found the other: a `GIT_DIR` set by a hook or an outer git command points git at another repository.
|
||||||
|
- **A script did the same.** It ran `git -C <clone>` on another repository, so an inherited `GIT_DIR` or `GIT_WORK_TREE` sent its `rev-parse` and `checkout -B` to the caller's repository instead.
|
||||||
|
|
||||||
|
Add one check to the stability reviewer (`agents/stability-reviewer.md`), or to the testing principle it cites:
|
||||||
|
- A test that runs git, or runs a script that does, sets `GIT_CONFIG_GLOBAL=/dev/null` and `GIT_CONFIG_NOSYSTEM=1`, and clears `GIT_DIR`, `GIT_WORK_TREE`, `GIT_INDEX_FILE`, `GIT_OBJECT_DIRECTORY` and `GIT_ALTERNATE_OBJECT_DIRECTORIES`.
|
||||||
|
- A script that runs git on a repository other than its own clears the same repository variables first.
|
||||||
|
|
||||||
|
A finding names the test or script line and the variables it inherits.
|
||||||
|
|
||||||
### 298. 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.
|
### 298. 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.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
@@ -660,6 +712,19 @@ Touches:
|
|||||||
|
|
||||||
One of 0.13.0's history ports, per lilleman's call of 2026-11-12.
|
One of 0.13.0's history ports, per lilleman's call of 2026-11-12.
|
||||||
|
|
||||||
|
### 520. Mutate the shell lines a branch changes in `mutate-changes`, so a change to a shell script gets the same check as one in Python, Go or PHP.
|
||||||
|
|
||||||
|
Ten client chunks in one day changed only shell scripts. Each found that `mutate-changes` prints "Not mutated, as no tool covers their language" for `.sh` files. Each stability reviewer then mutated lines by hand: 10 to 26 mutants per chunk, judged by eye, with a different operator set each time.
|
||||||
|
|
||||||
|
First look for a maintained mutation tool for POSIX sh and Bash, and cite what was found. Where none is maintained, add a small built-in operator set to `mutate-changes`, applied only to changed lines:
|
||||||
|
- negate a test (`[ ... ]`, `[[ ... ]]`, `test`);
|
||||||
|
- swap `-n` and `-z`, `=` and `!=`, `&&` and `||`;
|
||||||
|
- drop a command from a pipeline or a list;
|
||||||
|
- empty a variable expansion's default (`${X:-y}` becomes `${X}`);
|
||||||
|
- remove an `exit 1` or a `return 1`.
|
||||||
|
|
||||||
|
Run the repo's own gate per mutant, as for the other languages, and print each survivor.
|
||||||
|
|
||||||
### 423. Skip the judge's model call on a worker's final message that the offline classifier decides is finished.
|
### 423. Skip the judge's model call on a worker's final message that the offline classifier decides is finished.
|
||||||
|
|
||||||
On 2026-11-18 lilleman ruled that the classifier's miss rate of about 1 in 100 decided is close enough to no missed interrupt (`docs/decisions.md` → `routing: the offline classifier may decide finished, since lilleman ruled a miss rate of about 1 in 100 decided close enough to none; the judge's model keeps every other verdict kind`).
|
On 2026-11-18 lilleman ruled that the classifier's miss rate of about 1 in 100 decided is close enough to no missed interrupt (`docs/decisions.md` → `routing: the offline classifier may decide finished, since lilleman ruled a miss rate of about 1 in 100 decided close enough to none; the judge's model keeps every other verdict kind`).
|
||||||
|
|||||||
Reference in New Issue
Block a user