From 280f7521d07547672845c4731df7b80eea73e88a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 02:09:49 +0100 Subject: [PATCH 01/23] Bench a shipped feature whose branch landed by fast-forward from the commits after the item shipped before it --- README.md | 2 +- bin/task_bench/main.py | 8 ++-- bin/task_bench/shipped_features.py | 35 ++++++++++------ bin/task_bench/test_shipped_features.py | 53 ++++++++++++++++++------- docs/reading-cost.md | 12 ++++++ 5 files changed, 78 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 02eb8079..46dfe067 100644 --- a/README.md +++ b/README.md @@ -228,7 +228,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` sets the filter `settings` on `settings.json`, and Install's `git config` line makes this script that filter. - `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it. - `subagent-rung [--plan] ` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model on the project's routing ladder, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule. -- `task-bench --image --test []` plants bugs that the tests catch, in the Go and Python files that hold the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. With `--tasks features` it has Haiku build each feature in the folder the config names as `bench-tasks` instead, from its spec, and checks the build with acceptance tests Haiku never sees. With `--tasks data-sources` it has Haiku add each data source there: a folder that also holds `generate-register`, the seeded script whose made-up register Haiku imports. With `--tasks shipped-features` it has Haiku rebuild features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of the plan item, and checks the build with the tests that change holds. It passes over a feature whose branch landed by fast-forward. With `--record-figures`, a bench that finishes appends its figures over every task to the comprehension history. A scoring run starts the bench that way where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. +- `task-bench --image --test []` plants bugs that the tests catch, in the Go and Python files that hold the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. With `--tasks features` it has Haiku build each feature in the folder the config names as `bench-tasks` instead, from its spec, and checks the build with acceptance tests Haiku never sees. With `--tasks data-sources` it has Haiku add each data source there: a folder that also holds `generate-register`, the seeded script whose made-up register Haiku imports. With `--tasks shipped-features` it has Haiku rebuild features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of the plan item, and checks the build with the tests that change holds. Where a feature's branch landed by fast-forward, its change runs from the commit after the one that took the previous item out of the plan. With `--record-figures`, a bench that finishes appends its figures over every task to the comprehension history. A scoring run starts the bench that way where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. - `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show ` one item's row and detail; `add …` files an item under the next free ID, `edit …` sets an item's cells or detail, and `move --release ` sets an item's release; `finish ` removes a finished item and adds the bullet passed with `--changelog` to `CHANGELOG.md`, except for a plan kept in Jira. Each change ranks a markdown plan. `todo-item --help` states the flags. - `touch-predictions record ...` appends what a chunk's items were predicted to touch, under `Touches:` in their details, beside the files and parts its branch touched, to the record the config names as `touch-predictions`; `touch-predictions --help` shows the spelling and how a part is named. `chunk-preflight` reads the same predictions to name the items that may start chunks at once. - `wait-for [] [--timeout ]` waits until a file a background job writes holds a line matching the pattern, and prints it. diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index fc66729b..58e2e1f1 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -91,9 +91,11 @@ them, 5 by default, count. For each: - Haiku is told the tagline of the item, or of each item the chunk shipped; - the acceptance tests are the test files the change touched, and its files under a `testdata` folder, each as the head holds it; - the reference patch is the change itself. -With those, a shipped feature counts, and a build passes, as for a feature. The bench also passes over three kinds: -- one whose branch landed by fast-forward. Its commits keep a commit time each, so the history doesn't say which of them - built it; +With those, a shipped feature counts, and a build passes, as for a feature. Where its branch landed by fast-forward, its +commits keep a commit time each, so the history doesn't mark the feature's start. Its change then runs from the commit after +the one that took the previous item out of the plan, and a commit between two features that belongs to neither joins the later +one; the acceptance check still holds. The bench also passes over three kinds: +- one whose branch landed by fast-forward, with no feature shipped before it to start from; - one whose change doesn't come out of both trees cleanly, as where a later chunk rewrote its lines; - one whose change touched no test the head still holds. The report says which and why. The table has a row per shipped feature and side, named by its items, as `item 7`. diff --git a/bin/task_bench/shipped_features.py b/bin/task_bench/shipped_features.py index dcbc97b3..ac94dcbb 100644 --- a/bin/task_bench/shipped_features.py +++ b/bin/task_bench/shipped_features.py @@ -14,15 +14,15 @@ from branch_chunks.read import cut_with_shipped, unsupported from failure import Failure from git_cli.git_repo import Git from plan.todo_table import Item, tagline_text -from branch_chunks.cut import Landing from project_config.main import located from task_bench.runs import of_tests from project_config.settings import RECORDS from task_bench.figures import Side, SIDES -# Why a feature whose chunk landed by fast-forward is passed over. Each of its commits is a chunk of its own to branch_chunks, -# so the chunk that took the item out holds the branch's last commit alone. -FAST_FORWARDED = "its branch landed by fast-forward, so the history doesn't say which commits built it" +# Why a feature whose chunk landed by fast-forward and has no earlier feature before it is passed over. Each of its commits is a +# chunk of its own to branch_chunks, so the chunk that took the item out holds the branch's last commit alone, and only the commit +# of the feature shipped before it says where the branch starts. +FAST_FORWARDED = "its branch landed by fast-forward, and no feature shipped before it to say which commits built it" # The options that keep the checkout's diff config out of a patch. --no-renames writes a renamed file as one file removed and # one added, so `git apply` doesn't have to detect the rename again. @@ -31,13 +31,13 @@ PLAIN_DIFF = ("--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", "- class Shipped(typing.NamedTuple): """A feature the project shipped: the name the report gives it, such as `item 7`, the tagline of each item its chunk took out - of the plan, a paragraph each, the commits its chunk's change runs between, and how the chunk landed.""" + of the plan, a paragraph each, and the commits its change runs between. before is None where the history doesn't say where + the change starts.""" name: str told: str - before: str + before: str | None tip: str - landing: Landing class ShippedFeatures(typing.NamedTuple): @@ -62,11 +62,20 @@ def read_shipped(home: pathlib.Path, checkout: str, base: str, git: Git) -> Ship if isinstance(cut, Failure): return cut branch, shipped = cut - found = [ - Shipped(named(items), "\n\n".join(tagline_text(item.tagline) for item in items), chunk.before, chunk.tip, chunk.landing) - for chunk, items in zip(branch.chunks, shipped) - if items and chunk.before - ] + found: list[Shipped] = [] + # The oldest chunk first, so each feature knows the commit the one before it shipped at. + shipped_at = None + for chunk, items in reversed(list(zip(branch.chunks, shipped))): + if not items: + continue + if chunk.before: + # A fast-forwarded branch keeps a commit time per commit, so branch_chunks cuts each commit into a chunk of its own, and + # this chunk holds only the commit that took the item out. The feature is every commit since the last item shipped. + starts = shipped_at if chunk.landing == "push" else chunk.before + told = "\n\n".join(tagline_text(item.tagline) for item in items) + found.append(Shipped(named(items), told, starts, chunk.tip)) + shipped_at = chunk.tip + found.reverse() if not found: return Failure("No chunk on the base's history took an item out of todo.md, so that history holds no shipped feature to rebuild.") return ShippedFeatures(found, [path for path in map(config.tracked, ("plan", *RECORDS)) if path]) @@ -89,7 +98,7 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned break # A feature passed over leaves no folder, so the next one tried takes the same number. folder = bench.folder / "shipped-features" / str(len(tasks) + 1) - taken_out = FAST_FORWARDED if feature.landing == "push" else on_disk(f"take {feature.name} out of the trees in {folder}", lambda: without(bench, feature, shipped.records, folder)) + taken_out = FAST_FORWARDED if feature.before is None else on_disk(f"take {feature.name} out of the trees in {folder}", lambda: without(bench, feature, shipped.records, folder)) why = taken_out if not isinstance(taken_out, TakenOut) else why_passed_over(bench, taken_out.trees, taken_out.feature) if isinstance(why, Failure): return why diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index a6488716..8fddbf40 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -92,6 +92,22 @@ class ShippedFeaturesCase(BenchOfTasksCase): self.env.pop(name, None) + def fast_forwarded_item_11(self): + """Item 11 lands as a fast-forward leaves a branch: a plan commit, the feature and the commit that takes the item out, each + with the time it was written at, so each is a chunk of its own to branch_chunks. The head leaves the default branch after.""" + self.git("checkout", "--quiet", "main") + self.plan(11) + self.landed(6, "Plan an item", written_then=True) + (self.repo / "third.go").write_text("package calc\n") + (self.repo / "third_test.go").write_text("test -e third.go\n") + self.landed(7, "Add Third", written_then=True) + self.plan() + self.landed(8, "Finish item 11 in the plan", written_then=True) + self.git("checkout", "--quiet", "-B", "item-1") + (self.repo / "calc.go").write_text(HEAD_CODE) + self.commit("Head") + + class ShippedFeatureBenchTest(ShippedFeaturesCase): def test_has_haiku_rebuild_each_shipped_feature_from_its_tagline_and_checks_it_with_the_tests_its_change_added(self): report = self.bench() @@ -175,23 +191,13 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase): self.assertEqual(report.reason, "No shipped feature on the base's history counts; the lines above say why.") self.assertIn("task-bench: passed over the shipped feature item 8: its revert doesn't apply at the head.", self.progress.getvalue().splitlines()) - def test_passes_over_a_feature_whose_branch_landed_by_fast_forward(self): - # Each commit keeps the time it was written at, so the commit that takes the item out is a chunk of its own. - self.git("checkout", "--quiet", "main") - self.plan(11) - self.landed(6, "Plan an item") - (self.repo / "third.go").write_text("package calc\n") - (self.repo / "third_test.go").write_text("test -e third.go\n") - self.landed(7, "Add Third", written_then=True) - self.plan() - self.landed(8, "Finish item 11 in the plan", written_then=True) - # The bench's base is where the head left the default branch, so the head leaves it after item 11. - self.git("checkout", "--quiet", "-B", "item-1") - (self.repo / "calc.go").write_text(HEAD_CODE) - self.commit("Head") + def test_rebuilds_a_feature_whose_branch_landed_by_fast_forward_from_the_commits_after_the_item_shipped_before_it(self): + self.fast_forwarded_item_11() report = self.bench(**{"--shipped": "1"}) self.assertNotIsInstance(report, Failure, report) - self.assertEqual(report[1], "Passed over the shipped feature item 11: its branch landed by fast-forward, so the history doesn't say which commits built it.") + # Nothing is passed over, and the feature has a row at each side. + self.assertEqual(report[1], "") + self.assertEqual([line[:23] for line in report if line.startswith("| 1: item 11")], ["| 1: item 11 | base | 0", "| 1: item 11 | head | 0"]) def test_fails_before_docker_runs_where_the_history_shipped_no_item(self): self.git("branch", "--quiet", "--force", "main", "main~8") @@ -221,6 +227,23 @@ class ReadShippedTest(ShippedFeaturesCase): ]) self.assertEqual(shipped.records, ["todo.md", "decisions.md", "score-anchors.md", "docs/comprehension-history.md", "docs/reading-cost.md", "changelog.md"]) + def test_a_fast_forwarded_feature_starts_after_the_chunk_that_shipped_the_item_before_it(self): + self.fast_forwarded_item_11() + newest = self.read().found[0] + self.assertEqual((newest.name, newest.before, newest.tip), ("item 11", self.git("rev-parse", "main~3"), self.git("rev-parse", "main"))) + + def test_a_fast_forwarded_feature_with_no_item_shipped_before_it_has_no_start(self): + self.git("checkout", "--quiet", "--orphan", "fresh") + self.git("rm", "--quiet", "-r", "-f", ".") + self.plan(11) + self.landed(1, "Plan an item", written_then=True) + (self.repo / "third.go").write_text("package calc\n") + self.landed(2, "Add Third", written_then=True) + self.plan() + self.landed(3, "Finish item 11 in the plan", written_then=True) + self.git("branch", "--quiet", "--force", "main", "fresh") + self.assertEqual([(feature.name, feature.before) for feature in self.read().found], [("item 11", None)]) + def test_a_chunk_that_shipped_two_items_is_one_feature_told_by_both_taglines(self): self.git("checkout", "--quiet", "main") self.plan(7, 8) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 3df0d017..f2efc71c 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -3558,3 +3558,15 @@ Read most (opens and searches): - `README.md` 1 - `bin/task_bench/python_bugs.py` 1 - `bin/task_bench/test_planted_mutant.py` 1 + +## Reading cost, chunk be78ef577b52, finished 2026-11-24T01:07:00Z + +102199 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/task_bench/feature_tasks.py` 3 +- `bin/task_bench/main.py` 2 +- `bin/task_bench/registers.py` 1 +- `bin/task_bench/runs.py` 1 +- `bin/task_bench/tasks.py` 1 From f025bc65cdec236d87a729ce0a179b3c6f41d59d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 02:30:12 +0100 Subject: [PATCH 02/23] Test that a fast-forwarded feature with no earlier feature is passed over --- bin/task_bench/test_shipped_features.py | 32 ++++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index 8fddbf40..c09e1102 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -107,6 +107,19 @@ class ShippedFeaturesCase(BenchOfTasksCase): (self.repo / "calc.go").write_text(HEAD_CODE) self.commit("Head") + def fast_forwarded_item_11_alone(self): + """Makes the default branch a history of its own, where item 11 is the one item shipped, by fast-forward.""" + self.git("checkout", "--quiet", "--orphan", "fresh") + self.git("rm", "--quiet", "-r", "-f", ".") + self.plan(11) + (self.repo / "calc_test.go").write_text("exit 0\n") + self.landed(1, "Plan an item", written_then=True) + (self.repo / "third.go").write_text("package calc\n") + self.landed(2, "Add Third", written_then=True) + self.plan() + self.landed(3, "Finish item 11 in the plan", written_then=True) + self.git("branch", "--quiet", "--force", "main", "fresh") + class ShippedFeatureBenchTest(ShippedFeaturesCase): def test_has_haiku_rebuild_each_shipped_feature_from_its_tagline_and_checks_it_with_the_tests_its_change_added(self): @@ -199,6 +212,15 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase): self.assertEqual(report[1], "") self.assertEqual([line[:23] for line in report if line.startswith("| 1: item 11")], ["| 1: item 11 | base | 0", "| 1: item 11 | head | 0"]) + def test_passes_over_a_fast_forwarded_feature_where_no_item_shipped_before_it(self): + self.fast_forwarded_item_11_alone() + self.git("checkout", "--quiet", "-B", "item-1") + (self.repo / "calc.go").write_text(HEAD_CODE) + self.commit("Head") + report = self.bench(**{"--shipped": "1"}) + self.assertEqual(report.reason, "No shipped feature on the base's history counts; the lines above say why.") + self.assertIn("task-bench: passed over the shipped feature item 11: its branch landed by fast-forward, and no feature shipped before it to say which commits built it.", self.progress.getvalue().splitlines()) + def test_fails_before_docker_runs_where_the_history_shipped_no_item(self): self.git("branch", "--quiet", "--force", "main", "main~8") report = self.bench() @@ -233,15 +255,7 @@ class ReadShippedTest(ShippedFeaturesCase): self.assertEqual((newest.name, newest.before, newest.tip), ("item 11", self.git("rev-parse", "main~3"), self.git("rev-parse", "main"))) def test_a_fast_forwarded_feature_with_no_item_shipped_before_it_has_no_start(self): - self.git("checkout", "--quiet", "--orphan", "fresh") - self.git("rm", "--quiet", "-r", "-f", ".") - self.plan(11) - self.landed(1, "Plan an item", written_then=True) - (self.repo / "third.go").write_text("package calc\n") - self.landed(2, "Add Third", written_then=True) - self.plan() - self.landed(3, "Finish item 11 in the plan", written_then=True) - self.git("branch", "--quiet", "--force", "main", "fresh") + self.fast_forwarded_item_11_alone() self.assertEqual([(feature.name, feature.before) for feature in self.read().found], [("item 11", None)]) def test_a_chunk_that_shipped_two_items_is_one_feature_told_by_both_taglines(self): From 4328a13ad8a45b2929a3e9a8e66be5b6cb8ed46f Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 02:48:41 +0100 Subject: [PATCH 03/23] =?UTF-8?q?Answer=20stability=20round=201:=202=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20a=20fast-fo?= =?UTF-8?q?rwarded=20feature=20starts=20after=20the=20latest=20earlier=20c?= =?UTF-8?q?hunk=20of=20another=20feature,=20a=20merge=20of=20the=20default?= =?UTF-8?q?=20branch=20into=20a=20feature=20branch=20marks=20no=20start,?= =?UTF-8?q?=20and=20the=20types=20hold?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- bin/task_bench/main.py | 15 ++++++----- bin/task_bench/shipped_features.py | 35 +++++++++++++------------ bin/task_bench/test_shipped_features.py | 31 +++++++++++++++++++--- 4 files changed, 55 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 46dfe067..d08329dd 100644 --- a/README.md +++ b/README.md @@ -228,7 +228,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` sets the filter `settings` on `settings.json`, and Install's `git config` line makes this script that filter. - `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it. - `subagent-rung [--plan] ` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model on the project's routing ladder, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule. -- `task-bench --image --test []` plants bugs that the tests catch, in the Go and Python files that hold the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. With `--tasks features` it has Haiku build each feature in the folder the config names as `bench-tasks` instead, from its spec, and checks the build with acceptance tests Haiku never sees. With `--tasks data-sources` it has Haiku add each data source there: a folder that also holds `generate-register`, the seeded script whose made-up register Haiku imports. With `--tasks shipped-features` it has Haiku rebuild features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of the plan item, and checks the build with the tests that change holds. Where a feature's branch landed by fast-forward, its change runs from the commit after the one that took the previous item out of the plan. With `--record-figures`, a bench that finishes appends its figures over every task to the comprehension history. A scoring run starts the bench that way where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. +- `task-bench --image --test []` plants bugs that the tests catch, in the Go and Python files that hold the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from `claude setup-token`; `task-bench --help` says how it plants, runs and checks. It leaves a digest of why runs failed. With `--tasks features` it has Haiku build each feature in the folder the config names as `bench-tasks` instead, from its spec, and checks the build with acceptance tests Haiku never sees. With `--tasks data-sources` it has Haiku add each data source there: a folder that also holds `generate-register`, the seeded script whose made-up register Haiku imports. With `--tasks shipped-features` it has Haiku rebuild features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of the plan item, and checks the build with the tests that change holds. With `--record-figures`, a bench that finishes appends its figures over every task to the comprehension history. A scoring run starts the bench that way where the project's README documents its `task-bench` command. `task-bench gather` starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams. - `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show ` one item's row and detail; `add …` files an item under the next free ID, `edit …` sets an item's cells or detail, and `move --release ` sets an item's release; `finish ` removes a finished item and adds the bullet passed with `--changelog` to `CHANGELOG.md`, except for a plan kept in Jira. Each change ranks a markdown plan. `todo-item --help` states the flags. - `touch-predictions record ...` appends what a chunk's items were predicted to touch, under `Touches:` in their details, beside the files and parts its branch touched, to the record the config names as `touch-predictions`; `touch-predictions --help` shows the spelling and how a part is named. `chunk-preflight` reads the same predictions to name the items that may start chunks at once. - `wait-for [] [--timeout ]` waits until a file a background job writes holds a line matching the pattern, and prints it. diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index 58e2e1f1..8c7eead8 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -83,19 +83,20 @@ such as QZ, and never XK, which is Kosovo's in practice. The table has a row per --tasks shipped-features benches rebuilding features the project shipped, so nobody writes a task. A shipped feature is a chunk on the base's first-parent history that took an item out of `todo.md`. A chunk is a merge commit with what it merged, or the commits a rebase landed together, which share a commit time. A chunk with a commit whose title opens `Drop item :` took -that item out unbuilt, so it didn't ship it. The bench goes through the shipped features newest first, until --shipped of +that item out unbuilt, so it didn't ship it. Commits fast-forwarded onto the branch keep a commit time each, so each is a chunk +of its own, and the chunk that took the item out holds only the feature's last commit. The feature then starts after the latest +earlier chunk that took an item out or landed by a merge or a rebase, leaving out a merge of the default branch into a feature +branch, titled `Merge ... into `. A commit between two features that belongs to neither joins the later one; it counts +only where its tests fail after the revert and pass with the reference patch, as for any feature. A fast-forwarded feature with +no such chunk before it is passed over. The bench goes through the shipped features newest first, until --shipped of them, 5 by default, count. For each: -- it takes the chunk's change out of a copy of each side's tree, as `git apply -R` does. The plan and the project's records stay +- it takes the feature's change out of a copy of each side's tree, as `git apply -R` does. The plan and the project's records stay as the side holds them, since later chunks added to them. The records are the changelog, the comprehension history, the decisions, the reading cost and the score anchors. So Haiku can read there what the changelog says of the feature; - Haiku is told the tagline of the item, or of each item the chunk shipped; - the acceptance tests are the test files the change touched, and its files under a `testdata` folder, each as the head holds it; - the reference patch is the change itself. -With those, a shipped feature counts, and a build passes, as for a feature. Where its branch landed by fast-forward, its -commits keep a commit time each, so the history doesn't mark the feature's start. Its change then runs from the commit after -the one that took the previous item out of the plan, and a commit between two features that belongs to neither joins the later -one; the acceptance check still holds. The bench also passes over three kinds: -- one whose branch landed by fast-forward, with no feature shipped before it to start from; +With those, a shipped feature counts, and a build passes, as for a feature. The bench also passes over two kinds: - one whose change doesn't come out of both trees cleanly, as where a later chunk rewrote its lines; - one whose change touched no test the head still holds. The report says which and why. The table has a row per shipped feature and side, named by its items, as `item 7`. diff --git a/bin/task_bench/shipped_features.py b/bin/task_bench/shipped_features.py index ac94dcbb..a62f9b4b 100644 --- a/bin/task_bench/shipped_features.py +++ b/bin/task_bench/shipped_features.py @@ -5,6 +5,7 @@ is checked.""" import functools import os import pathlib +import re import shutil import typing @@ -19,10 +20,11 @@ from task_bench.runs import of_tests from project_config.settings import RECORDS from task_bench.figures import Side, SIDES -# Why a feature whose chunk landed by fast-forward and has no earlier feature before it is passed over. Each of its commits is a -# chunk of its own to branch_chunks, so the chunk that took the item out holds the branch's last commit alone, and only the commit -# of the feature shipped before it says where the branch starts. -FAST_FORWARDED = "its branch landed by fast-forward, and no feature shipped before it to say which commits built it" +# Why a feature that landed by fast-forward is passed over where no earlier chunk says where its commits start. +FAST_FORWARDED = "its branch landed by fast-forward, and nothing earlier marks where its commits start" +# What git titles a merge of the default branch into a feature branch. Such a merge sits inside the feature's own commits, so it +# doesn't mark where the feature starts. +SYNC_MERGE = re.compile(r"Merge .* into (?!main$|master$)\S+") # The options that keep the checkout's diff config out of a patch. --no-renames writes a renamed file as one file removed and # one added, so `git apply` doesn't have to detect the rename again. @@ -63,18 +65,17 @@ def read_shipped(home: pathlib.Path, checkout: str, base: str, git: Git) -> Ship return cut branch, shipped = cut found: list[Shipped] = [] - # The oldest chunk first, so each feature knows the commit the one before it shipped at. - shipped_at = None + # The oldest chunk first, so each feature knows the commit that ends the chunk before it. + marked = None for chunk, items in reversed(list(zip(branch.chunks, shipped))): - if not items: - continue - if chunk.before: - # A fast-forwarded branch keeps a commit time per commit, so branch_chunks cuts each commit into a chunk of its own, and - # this chunk holds only the commit that took the item out. The feature is every commit since the last item shipped. - starts = shipped_at if chunk.landing == "push" else chunk.before + if items: + # A fast-forwarded feature's commits are a chunk each, and this chunk holds only the last. The earlier ones follow the + # commit that ends the latest earlier chunk of another feature. + starts = marked if chunk.landing == "push" else chunk.before told = "\n\n".join(tagline_text(item.tagline) for item in items) found.append(Shipped(named(items), told, starts, chunk.tip)) - shipped_at = chunk.tip + if (items or chunk.landing != "push") and not SYNC_MERGE.fullmatch(branch.commits[chunk.tip].title): + marked = chunk.tip found.reverse() if not found: return Failure("No chunk on the base's history took an item out of todo.md, so that history holds no shipped feature to rebuild.") @@ -98,7 +99,7 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned break # A feature passed over leaves no folder, so the next one tried takes the same number. folder = bench.folder / "shipped-features" / str(len(tasks) + 1) - taken_out = FAST_FORWARDED if feature.before is None else on_disk(f"take {feature.name} out of the trees in {folder}", lambda: without(bench, feature, shipped.records, folder)) + taken_out = FAST_FORWARDED if feature.before is None else on_disk(f"take {feature.name} out of the trees in {folder}", functools.partial(without, bench, feature, feature.before, shipped.records, folder)) why = taken_out if not isinstance(taken_out, TakenOut) else why_passed_over(bench, taken_out.trees, taken_out.feature) if isinstance(why, Failure): return why @@ -126,12 +127,12 @@ class TakenOut(typing.NamedTuple): feature: Feature -def without(bench: Bench, shipped: Shipped, records: list[str], folder: pathlib.Path) -> TakenOut | str | Failure: - """shipped taken out of a copy of each side's tree, under folder, where its patch and its acceptance tests go too; or why it +def without(bench: Bench, shipped: Shipped, before: str, records: list[str], folder: pathlib.Path) -> TakenOut | str | Failure: + """shipped, as the commits from before to its tip, taken out of a copy of each side's tree, under folder, where its patch and its acceptance tests go too; or why it cannot be, which ends a sentence that opens with its name. A Failure where git fails. Raises OSError where a file cannot be copied.""" - change = (shipped.before, shipped.tip, "--", ".", *(f":(exclude,literal){path}" for path in records)) + change = (before, shipped.tip, "--", ".", *(f":(exclude,literal){path}" for path in records)) # A name that is not UTF-8 is read with U+FFFD in it. The head's tree holds no file of that name, so the file is left out. names = bench.git("diff", "--name-only", "-z", *change, cwd=bench.checkout, errors="replace") if isinstance(names, Failure): diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index c09e1102..a0fc4d72 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -94,7 +94,7 @@ class ShippedFeaturesCase(BenchOfTasksCase): def fast_forwarded_item_11(self): """Item 11 lands as a fast-forward leaves a branch: a plan commit, the feature and the commit that takes the item out, each - with the time it was written at, so each is a chunk of its own to branch_chunks. The head leaves the default branch after.""" + with the time it was written at, so each is a chunk of its own to branch_chunks. The head branches off after them.""" self.git("checkout", "--quiet", "main") self.plan(11) self.landed(6, "Plan an item", written_then=True) @@ -108,7 +108,7 @@ class ShippedFeaturesCase(BenchOfTasksCase): self.commit("Head") def fast_forwarded_item_11_alone(self): - """Makes the default branch a history of its own, where item 11 is the one item shipped, by fast-forward.""" + """Makes the default branch a history of its own, where item 11 is the one item shipped, and it landed by fast-forward.""" self.git("checkout", "--quiet", "--orphan", "fresh") self.git("rm", "--quiet", "-r", "-f", ".") self.plan(11) @@ -219,7 +219,7 @@ class ShippedFeatureBenchTest(ShippedFeaturesCase): self.commit("Head") report = self.bench(**{"--shipped": "1"}) self.assertEqual(report.reason, "No shipped feature on the base's history counts; the lines above say why.") - self.assertIn("task-bench: passed over the shipped feature item 11: its branch landed by fast-forward, and no feature shipped before it to say which commits built it.", self.progress.getvalue().splitlines()) + self.assertIn("task-bench: passed over the shipped feature item 11: its branch landed by fast-forward, and nothing earlier marks where its commits start.", self.progress.getvalue().splitlines()) def test_fails_before_docker_runs_where_the_history_shipped_no_item(self): self.git("branch", "--quiet", "--force", "main", "main~8") @@ -258,6 +258,31 @@ class ReadShippedTest(ShippedFeaturesCase): self.fast_forwarded_item_11_alone() self.assertEqual([(feature.name, feature.before) for feature in self.read().found], [("item 11", None)]) + def fast_forwarded_item_11_around_a_merge(self, title): + """Item 11's commits, fast-forwarded, with a merge of a commit from a side branch between them under title. Returns the merge's hash.""" + self.git("checkout", "--quiet", "main") + self.git("branch", "--quiet", "side") + self.git("checkout", "--quiet", "side") + (self.repo / "other.go").write_text("package calc\n") + self.landed(5, "Other work") + self.git("checkout", "--quiet", "main") + self.plan(11) + self.landed(6, "Plan an item", written_then=True) + (self.repo / "third.go").write_text("package calc\n") + self.landed(7, "Add Third", written_then=True) + self.git("merge", "--quiet", "--no-ff", "--message", title, "side") + self.plan() + self.landed(9, "Finish item 11 in the plan", written_then=True) + return self.git("rev-parse", "main~1") + + def test_a_fast_forwarded_feature_starts_before_a_merge_of_the_default_branch_into_its_branch(self): + self.fast_forwarded_item_11_around_a_merge("Merge remote-tracking branch 'origin/main' into item-11") + self.assertEqual(self.read().found[0].before, self.git("rev-parse", "main~4")) + + def test_a_fast_forwarded_feature_starts_after_a_chunk_that_landed_by_a_merge_and_shipped_no_item(self): + merge = self.fast_forwarded_item_11_around_a_merge("Merge pull request 'Release review' (#7) from release-review into main") + self.assertEqual(self.read().found[0].before, merge) + def test_a_chunk_that_shipped_two_items_is_one_feature_told_by_both_taglines(self): self.git("checkout", "--quiet", "main") self.plan(7, 8) From 7f4c312021f47cbfa8aed0ff91c27f02e41fe5fb Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 02:48:50 +0100 Subject: [PATCH 04/23] =?UTF-8?q?Answer=20product-owner=20round=201:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20the=20st?= =?UTF-8?q?art=20now=20also=20stops=20at=20a=20merge=20or=20rebase=20chunk?= =?UTF-8?q?=20that=20shipped=20no=20item,=20in=20the=20commit=20before?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 7d58002fdd151078f050b95b18854cd5d2721c47 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 02:48:50 +0100 Subject: [PATCH 05/23] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=206=20=F0=9F=9F=A1=20(0=20misread);=20the=20help,?= =?UTF-8?q?=20README,=20constant,=20comments=20and=20test=20docstrings=20a?= =?UTF-8?q?re=20reworded=20in=20the=20commit=20before?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 767a9e1217e3c121141f4a814f535e722f0035f2 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 03:08:47 +0100 Subject: [PATCH 06/23] Test that a rebased feature starts at its own chunk --- bin/task_bench/test_shipped_features.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index a0fc4d72..b3b5a82f 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -293,6 +293,14 @@ class ReadShippedTest(ShippedFeaturesCase): self.assertEqual((newest.name, newest.told), ("items 7, 8", "Add `Halve`, which halves a whole number.\n\nMultiply in `Twice`.")) self.assertEqual((newest.before, newest.tip), (self.git("rev-parse", "main~3"), self.git("rev-parse", "main"))) + def test_a_feature_that_landed_by_a_rebase_starts_at_its_own_chunk_whatever_was_fast_forwarded_before_it(self): + self.git("checkout", "--quiet", "main") + self.plan(11) + self.landed(6, "Plan an item", written_then=True) + self.plan() + self.landed(7, "Build it", "Finish item 11 in the plan") + self.assertEqual(self.read().found[0].before, self.git("rev-parse", "main~2")) + def test_an_item_a_commit_title_drops_is_not_shipped(self): self.git("checkout", "--quiet", "main") self.plan(8) From a030a8eee9ffbdecb253e1147cf670d2d56b8437 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 24 Nov 2026 03:13:35 +0100 Subject: [PATCH 07/23] Say in the changelog where a fast-forwarded feature starts --- CHANGELOG.md | 2 +- bin/task_bench/main.py | 11 ++++----- bin/task_bench/shipped_features.py | 30 ++++++++++++++++--------- bin/task_bench/test_shipped_features.py | 7 +++--- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b0b1f8c..eaf7597c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- `task-bench --tasks shipped-features` benches rebuilding features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of its plan item, and checks the build with the tests that change holds. `--shipped ` sets how many it takes, and a feature whose branch landed by fast-forward is passed over. +- `task-bench --tasks shipped-features` benches rebuilding features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of its plan item, and checks the build with the tests that change holds. `--shipped ` sets how many it takes, and a feature whose branch landed by fast-forward starts after the latest earlier chunk that shipped an item or landed by a merge or a rebase, and is passed over where none comes before it or its branch merged the default branch into itself. - `task-bench` plants a Python mutant in a file whose lines end in CRLF, which it could not re-apply before, and a Go mutant there keeps applying. - This repo documents its own `task-bench` command in the README → Test, with `task-bench-image/Dockerfile`, an image that holds pytest, git and tmux, so each scoring run in `larv-review` benches claude-config and records its figures. - The stability reviewer now checks a lookup key built by joining path segments, or matched by prefix, for two inputs that give one key, such as a column named like its own table or the namespaces `ns` and `ns.sub`. diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index 8c7eead8..1eec166d 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -85,11 +85,12 @@ on the base's first-parent history that took an item out of `todo.md`. A chunk i commits a rebase landed together, which share a commit time. A chunk with a commit whose title opens `Drop item :` took that item out unbuilt, so it didn't ship it. Commits fast-forwarded onto the branch keep a commit time each, so each is a chunk of its own, and the chunk that took the item out holds only the feature's last commit. The feature then starts after the latest -earlier chunk that took an item out or landed by a merge or a rebase, leaving out a merge of the default branch into a feature -branch, titled `Merge ... into `. A commit between two features that belongs to neither joins the later one; it counts -only where its tests fail after the revert and pass with the reference patch, as for any feature. A fast-forwarded feature with -no such chunk before it is passed over. The bench goes through the shipped features newest first, until --shipped of -them, 5 by default, count. For each: +earlier chunk that took an item out or landed by a merge or a rebase. A commit between two features that belongs to neither +joins the later one; it counts only where its tests fail after the revert and pass with the reference patch, as for any feature. +A fast-forwarded feature is passed over where no such chunk comes before it, and where its branch merged the default branch into +itself, since its commits then hold the changes of the features that merge brought in. A merge titled +`Merge remote-tracking branch '...' into ` is read as that, whatever the branch. The bench goes through the shipped +features newest first, until --shipped of them, 5 by default, count. For each: - it takes the feature's change out of a copy of each side's tree, as `git apply -R` does. The plan and the project's records stay as the side holds them, since later chunks added to them. The records are the changelog, the comprehension history, the decisions, the reading cost and the score anchors. So Haiku can read there what the changelog says of the feature; diff --git a/bin/task_bench/shipped_features.py b/bin/task_bench/shipped_features.py index a62f9b4b..cabefdd4 100644 --- a/bin/task_bench/shipped_features.py +++ b/bin/task_bench/shipped_features.py @@ -20,11 +20,13 @@ from task_bench.runs import of_tests from project_config.settings import RECORDS from task_bench.figures import Side, SIDES -# Why a feature that landed by fast-forward is passed over where no earlier chunk says where its commits start. -FAST_FORWARDED = "its branch landed by fast-forward, and nothing earlier marks where its commits start" -# What git titles a merge of the default branch into a feature branch. Such a merge sits inside the feature's own commits, so it -# doesn't mark where the feature starts. -SYNC_MERGE = re.compile(r"Merge .* into (?!main$|master$)\S+") +# Why a feature that landed by fast-forward is passed over: no earlier chunk says where its commits start, or its branch merged +# the default branch into itself, so its commits hold what other features built. +NO_START = "its branch landed by fast-forward, and nothing earlier marks where its commits start" +MERGED_IN = "its branch landed by fast-forward after merging the default branch into itself, so its commits hold other features' changes" +# What git titles a merge of the default branch into a feature branch, other than into main or master, which git leaves out of +# the title. A person's merge of a branch into another default branch has the same title; its feature is then passed over. +SYNC_MERGE = re.compile(r"Merge (?:remote-tracking )?branch '[^']+' into (?!main$|master$)\S+") # The options that keep the checkout's diff config out of a patch. --no-renames writes a renamed file as one file removed and # one added, so `git apply` doesn't have to detect the rename again. @@ -34,12 +36,13 @@ PLAIN_DIFF = ("--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", "- class Shipped(typing.NamedTuple): """A feature the project shipped: the name the report gives it, such as `item 7`, the tagline of each item its chunk took out of the plan, a paragraph each, and the commits its change runs between. before is None where the history doesn't say where - the change starts.""" + the change starts, and passed_over then says why.""" name: str told: str before: str | None tip: str + passed_over: str = "" class ShippedFeatures(typing.NamedTuple): @@ -67,15 +70,20 @@ def read_shipped(home: pathlib.Path, checkout: str, base: str, git: Git) -> Ship found: list[Shipped] = [] # The oldest chunk first, so each feature knows the commit that ends the chunk before it. marked = None + merged_in = False for chunk, items in reversed(list(zip(branch.chunks, shipped))): if items: # A fast-forwarded feature's commits are a chunk each, and this chunk holds only the last. The earlier ones follow the # commit that ends the latest earlier chunk of another feature. - starts = marked if chunk.landing == "push" else chunk.before + starts, why = chunk.before, "" + if chunk.landing == "push": + starts, why = (None, NO_START) if marked is None else (None, MERGED_IN) if merged_in else (marked, "") told = "\n\n".join(tagline_text(item.tagline) for item in items) - found.append(Shipped(named(items), told, starts, chunk.tip)) - if (items or chunk.landing != "push") and not SYNC_MERGE.fullmatch(branch.commits[chunk.tip].title): - marked = chunk.tip + found.append(Shipped(named(items), told, starts, chunk.tip, why)) + if SYNC_MERGE.fullmatch(branch.commits[chunk.tip].title): + merged_in = True + elif items or chunk.landing != "push": + marked, merged_in = chunk.tip, False found.reverse() if not found: return Failure("No chunk on the base's history took an item out of todo.md, so that history holds no shipped feature to rebuild.") @@ -99,7 +107,7 @@ def shipped_tasks(bench: Bench, shipped: ShippedFeatures, count: int) -> Planned break # A feature passed over leaves no folder, so the next one tried takes the same number. folder = bench.folder / "shipped-features" / str(len(tasks) + 1) - taken_out = FAST_FORWARDED if feature.before is None else on_disk(f"take {feature.name} out of the trees in {folder}", functools.partial(without, bench, feature, feature.before, shipped.records, folder)) + taken_out = feature.passed_over if feature.before is None else on_disk(f"take {feature.name} out of the trees in {folder}", functools.partial(without, bench, feature, feature.before, shipped.records, folder)) why = taken_out if not isinstance(taken_out, TakenOut) else why_passed_over(bench, taken_out.trees, taken_out.feature) if isinstance(why, Failure): return why diff --git a/bin/task_bench/test_shipped_features.py b/bin/task_bench/test_shipped_features.py index b3b5a82f..5e9c0555 100644 --- a/bin/task_bench/test_shipped_features.py +++ b/bin/task_bench/test_shipped_features.py @@ -17,8 +17,8 @@ from task_bench.test_task_bench import BASE_CODE, HEAD_CODE from failure import Failure from git_cli.git_repo import git from task_bench import main +from task_bench.shipped_features import MERGED_IN, read_shipped from branch_chunks.read import READ_AT -from task_bench.shipped_features import read_shipped HEADER = "| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves |\n|---|---|---|---|---|---|---|---|---|---|---|\n" ROWS = { @@ -275,9 +275,10 @@ class ReadShippedTest(ShippedFeaturesCase): self.landed(9, "Finish item 11 in the plan", written_then=True) return self.git("rev-parse", "main~1") - def test_a_fast_forwarded_feature_starts_before_a_merge_of_the_default_branch_into_its_branch(self): + def test_passes_over_a_fast_forwarded_feature_whose_branch_merged_the_default_branch_into_itself(self): self.fast_forwarded_item_11_around_a_merge("Merge remote-tracking branch 'origin/main' into item-11") - self.assertEqual(self.read().found[0].before, self.git("rev-parse", "main~4")) + newest = self.read().found[0] + self.assertEqual((newest.name, newest.before, newest.passed_over), ("item 11", None, MERGED_IN)) def test_a_fast_forwarded_feature_starts_after_a_chunk_that_landed_by_a_merge_and_shipped_no_item(self): merge = self.fast_forwarded_item_11_around_a_merge("Merge pull request 'Release review' (#7) from release-review into main") From 2a9ac974e88d061b3e80b179377e77d92e78fbbd Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 25 Nov 2026 23:21:48 +0100 Subject: [PATCH 08/23] =?UTF-8?q?Answer=20stability=20round=202:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20a=20fast-fo?= =?UTF-8?q?rwarded=20feature=20whose=20branch=20merged=20the=20default=20b?= =?UTF-8?q?ranch=20into=20itself=20is=20passed=20over,=20and=20the=20merge?= =?UTF-8?q?'s=20title=20is=20read=20for=20a=20remote-tracking=20branch=20a?= =?UTF-8?q?lone,=20in=20the=20commit=20before?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From fc05048180610d294b56389c2cf1a9460ba65553 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 25 Nov 2026 23:28:09 +0100 Subject: [PATCH 09/23] File item 539: start a fresh session where its transcript is empty --- todo.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 992c34f4..5095e545 100644 --- a/todo.md +++ b/todo.md @@ -6,12 +6,13 @@ `Bar = 0.1` -`Next ID = 539` +`Next ID = 540` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| +| 539 | 0.16.0 | | defect | **Start a chunk's worker on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find.** | 1 | 2 | 3 | 4 | 2 | 1.5 by 3 | 1.1 | | 531 | 0.16.0 | | | **Bench the shipped features of a branch that landed by fast-forward: take as the feature the commits from the one after the item finished before it, up to the commit that took its item out of the plan.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 | 1.1 | | 524 | 0.16.0 | | owner | **Write fejkdata's first six bench features, each a spec, acceptance tests in Go and a reference patch that builds it, in the `bench-tasks` folder its config names.** | 3 | 2 | 1 | 4 | 6 | 1.1 by 3 | 0.5 | | 532 | 0.16.0 | | | **Leave out of a `task-bench` fix a change Haiku makes to a Rust test that stands in the file of the code it tests.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 1 | 0.4 | @@ -112,6 +113,16 @@ ## Details +### 539. Start a chunk's worker on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find. + +Today `session_open` in `bin/claude_code/session.py` counts a session as open wherever its `.jsonl` exists. On 2026-11-24 a run left item-532's transcript as a 0-byte file, with an archive folder whose transcript and outcomes were empty too. On 2026-11-25 every rerun of item-532 called `claude --resume `. Each got "No conversation found with session ID …" and exited 1. The window stopped after three failures and waited for the human, who had to move the file away by hand. + +Count an empty transcript as no session. Before the worker starts that session with `--session-id`, remove the empty file, so claude doesn't refuse the id. Leave a non-empty transcript to resume as today. The worker's start, in `bin/agent_cycle/run.py` → `worker_start`, and a chunk's start, in `bin/loop_claude/loop/chunk_start.py`, both read `session_open`, so the fix holds for both. + +Touches: +- `bin/claude_code/session.py`: `session_open` (small) +- `bin/claude_code/test_claude_code.py` + ### 531. Bench the shipped features of a branch that landed by fast-forward: take as the feature the commits from the one after the item finished before it, up to the commit that took its item out of the plan. Today `task-bench --tasks shipped-features` passes such a feature over. A fast-forwarded branch's commits keep a commit time each, so `branch_chunks` cuts each commit into a chunk of its own, and the chunk that took the item out of the plan holds only the feature's last commit. This project landed 114 of its 260 shipped features that way, and none of those can be benched. A squash-merged feature whose one commit was authored and committed at the same time would be passed over too; whether a forge writes such commits is not checked. From 88e94d5980b14370242023a951044e622a57d816 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 25 Nov 2026 23:30:01 +0100 Subject: [PATCH 10/23] File item 540: review once more each prose fix that rewrites a checkable claim --- todo.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 992c34f4..d074a0d6 100644 --- a/todo.md +++ b/todo.md @@ -6,12 +6,13 @@ `Bar = 0.1` -`Next ID = 539` +`Next ID = 541` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| +| 540 | 0.16.0 | | | **Review once more each prose fix that rewrites a checkable claim, such as a claim about generated output, a number or a licence term, so no such rewrite reaches the merge unreviewed.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 4 | 1.5 | | 531 | 0.16.0 | | | **Bench the shipped features of a branch that landed by fast-forward: take as the feature the commits from the one after the item finished before it, up to the commit that took its item out of the plan.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 | 1.1 | | 524 | 0.16.0 | | owner | **Write fejkdata's first six bench features, each a spec, acceptance tests in Go and a reference patch that builds it, in the `bench-tasks` folder its config names.** | 3 | 2 | 1 | 4 | 6 | 1.1 by 3 | 0.5 | | 532 | 0.16.0 | | | **Leave out of a `task-bench` fix a change Haiku makes to a Rust test that stands in the file of the code it tests.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 1 | 0.4 | @@ -112,6 +113,20 @@ ## Details +### 540. Review once more each prose fix that rewrites a checkable claim, such as a claim about generated output, a number or a licence term, so no such rewrite reaches the merge unreviewed. + +Today the prose pass runs one round per chunk, and a fix for a prose finding reruns no pass ("Re-entry"). So a rewrite of a factual claim merges unchecked. In one chunk the prose reviewer flagged a doc's claim about generated output as false; the rewrite was still false, and only the outside auto-reviewer caught it, after the PR was marked ready. In the same chunk a credit sentence left out parts the project's licence file lists for that source: a licence link and a notice of changes. + +Two directions; the implementer picks the cheaper that fits what the rounds cost: + +- let the prose pass re-enter once where a round's fix answers a finding that asserts something checkable; +- or have prose-reviewer check each claim a fix rewrites against a concrete counter-example, and against the source it names, such as the licence file's listed credit, before it accepts the rewrite. + +Touches: + +- `skills/larv-review/SKILL.md`: `## 3. Passes` (small), `### Prose` (small) +- `agents/prose-reviewer.md`: `## Checks, in priority order` (small) + ### 531. Bench the shipped features of a branch that landed by fast-forward: take as the feature the commits from the one after the item finished before it, up to the commit that took its item out of the plan. Today `task-bench --tasks shipped-features` passes such a feature over. A fast-forwarded branch's commits keep a commit time each, so `branch_chunks` cuts each commit into a chunk of its own, and the chunk that took the item out of the plan holds only the feature's last commit. This project landed 114 of its 260 shipped features that way, and none of those can be benched. A squash-merged feature whose one commit was authored and committed at the same time would be passed over too; whether a forge writes such commits is not checked. From 5c759f9dee72041b4e7f90837119bb9a3a496dc9 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 25 Nov 2026 23:49:03 +0100 Subject: [PATCH 11/23] Finish item 531 in the plan --- todo.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/todo.md b/todo.md index aef17c4b..a2e401ed 100644 --- a/todo.md +++ b/todo.md @@ -14,7 +14,6 @@ |---|---|---|---|---|---|---|---|---|---|---|---| | 540 | 0.16.0 | | | **Review once more each prose fix that rewrites a checkable claim, such as a claim about generated output, a number or a licence term, so no such rewrite reaches the merge unreviewed.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 4 | 1.5 | | 539 | 0.16.0 | | defect | **Start a chunk's worker on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find.** | 1 | 2 | 3 | 4 | 2 | 1.5 by 3 | 1.1 | -| 531 | 0.16.0 | | | **Bench the shipped features of a branch that landed by fast-forward: take as the feature the commits from the one after the item finished before it, up to the commit that took its item out of the plan.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 3 | 1.1 | | 524 | 0.16.0 | | owner | **Write fejkdata's first six bench features, each a spec, acceptance tests in Go and a reference patch that builds it, in the `bench-tasks` folder its config names.** | 3 | 2 | 1 | 4 | 6 | 1.1 by 3 | 0.5 | | 532 | 0.16.0 | | | **Leave out of a `task-bench` fix a change Haiku makes to a Rust test that stands in the file of the code it tests.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 1 | 0.4 | | 527 | 0.16.0 | | owner | **Plant bugs for `task-bench` in TypeScript, from the mutants Stryker kills.** | 3 | 2 | 1 | 4 | 4 | 1.1 by 1 | 0.3 | @@ -138,19 +137,6 @@ Touches: - `bin/claude_code/session.py`: `session_open` (small) - `bin/claude_code/test_claude_code.py` -### 531. Bench the shipped features of a branch that landed by fast-forward: take as the feature the commits from the one after the item finished before it, up to the commit that took its item out of the plan. - -Today `task-bench --tasks shipped-features` passes such a feature over. A fast-forwarded branch's commits keep a commit time each, so `branch_chunks` cuts each commit into a chunk of its own, and the chunk that took the item out of the plan holds only the feature's last commit. This project landed 114 of its 260 shipped features that way, and none of those can be benched. A squash-merged feature whose one commit was authored and committed at the same time would be passed over too; whether a forge writes such commits is not checked. - -The tagline's rule is a recommendation, not yet checked on a real history: a commit between two chunks that belongs to neither, such as a direct push, would join the later feature. The acceptance check still guards that: a feature counts only where its tests fail after the revert and pass with the reference patch. - -Touches: - -- `bin/task_bench/shipped_features.py`: `read_shipped`, `shipped_tasks` (small), `FAST_FORWARDED` -- `bin/task_bench/test_shipped_features.py` -- `bin/task_bench/main.py`: `(module)` (small) -- `README.md`: `## Tools` (small) - ### 524. Write fejkdata's first six bench features, each a spec, acceptance tests in Go and a reference patch that builds it, in the `bench-tasks` folder its config names. The second part of item 504, which says what a bench feature is and when a run counts. A stronger model than the project's writes the six, once. Each breaks one of fejkdata's goals while it would suit another audience: From 1bc5e67b711640fa1aeb20d0309d4c2852198df5 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 25 Nov 2026 23:49:41 +0100 Subject: [PATCH 12/23] File item 541: find a Gitea pull request however many pull requests are newer --- todo.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/todo.md b/todo.md index aef17c4b..60cd62c0 100644 --- a/todo.md +++ b/todo.md @@ -6,7 +6,7 @@ `Bar = 0.1` -`Next ID = 541` +`Next ID = 542` ## Items @@ -25,6 +25,7 @@ | 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 | | 537 | 0.17.0 | | | **Flag regexes that use `$` to validate a whole input, since `$` also matches before a final newline.** | 1 | 2 | 2 | 3 | 1 | 1.1 by 2 | 0.9 | | 538 | 0.17.0 | | | **Flag validation that checks a value other than the one the code goes on to use, such as before trimming, stripping or converting it.** | 1 | 2 | 2 | 3 | 1 | 1.1 by 2 | 0.9 | +| 541 | 0.17.0 | | | **Find a Gitea pull request by its branch and head however many pull requests are newer, so `chunk-pr clean`, `chunk-pr merge` and `chunk-preflight` see an older one.** | 2 | 2 | 3 | 5 | 2 | 1 by 2 | 0.8 | | 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/`, 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 | @@ -241,6 +242,17 @@ An outside human reviewer found input validation that checked the value the clie Touches: - `agents/stability-reviewer.md`: `### 5. Edge Cases & Input Validation` (small) +### 541. Find a Gitea pull request by its branch and head however many pull requests are newer, so `chunk-pr clean`, `chunk-pr merge` and `chunk-preflight` see an older one. + +Today `pull_at` in `bin/forge/pulls.py` reads only Gitea's first page of 50 pull requests, open or closed, and looks for the branch among them. A pull request with 50 newer ones in that state is missed. PR #652 here merged after 50+ newer PRs had closed, and `chunk-pr clean` then said "no merged pull request from filing-prose-reentry", leaving the worktree and branch to remove by hand. The same lookup serves `open_pull`, so `ready` and `merge` miss an old open one too, and `chunk-preflight` misses a merged chunk's worktree. + +Look the pull request up so its age doesn't matter: page through the list until one matches or a page comes back short, or ask Gitea by base and head (`GET /repos/{owner}/{repo}/pulls/{base}/{head}`) where its version answers that call. Keep matching on the head's label, since Gitea reports a deleted branch's ref as `refs/pull//head`. Test it with a fake forge holding more than 50 newer pull requests. + +Touches: + +- `bin/forge/pulls.py`: `pull_at` +- `bin/forge/test_forge.py` + ### 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. From ee8d788d26671270515966167ba5f07e3e40b00f Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 00:00:08 +0100 Subject: [PATCH 13/23] Rerun the prose pass once where a fix rewrites a checkable claim --- agents/prose-reviewer.md | 2 ++ docs/decisions.md | 4 +++- docs/reading-cost.md | 14 ++++++++++++++ skills/larv-review/SKILL.md | 9 +++++---- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/agents/prose-reviewer.md b/agents/prose-reviewer.md index 7c5fc921..9fb34471 100644 --- a/agents/prose-reviewer.md +++ b/agents/prose-reviewer.md @@ -28,6 +28,8 @@ Run them in this order. A fix for a later check never breaks an earlier one. Also report a list whose order carries no meaning and is not sorted (the technical principles' "Deterministic order", in the folder your prompt's `Technical principles:` line names; without one, open your report by saying so), a sentence contradicting another, a claim the code shows false, and a word used against `CLAUDE.md` → "Vocabulary". +Where the prompt hands you claims a fix rewrote, treat each as new: look for one case it gets wrong, such as an input whose output differs, and check it against every term of the source it names, such as each credit and notice a licence file lists. A claim you can't check is a ❓ naming what would. + Where your prompt has a `Claimed output:` line, that file holds the command and real output of each changed line that says what a command prints. Report a claim its output doesn't bear out, and name the missing words. A claim marked `not run` is a ❓ naming the command that would run it. ## Growth diff --git a/docs/decisions.md b/docs/decisions.md index 5cdd53b6..4b0f2d6b 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -364,7 +364,7 @@ Valid while no published standard sets either number, the reading-cost window st 2026-10-08, lilleman. Serves goal 1.4: run beside the full scan, `/security-review` started seconds apart from it each round and returned a near-identical report. Valid while the full scan covers what `/security-review` reports. -## review: a fix for a 🔴 reruns the pass that found it, unless that pass is at its cap, and each pass whose row in `larv-review` §3's re-entry table the fix meets; from round 2 a pass reviews only the answers to its last round's findings and any other pass's fix that re-entered it; a fix for a 🟢, a ❓ or a prose finding doesn't rerun any pass, and a fix for a 🟡 reruns the pass that raised it only when the fix weakens, skips or guards a test; the stability pass doesn't rerun on a round's fixes where every 🔴 and 🟡 of that round asked only that a named mutant be killed or a named failing test pass, and the tests and the mutation command run clean on the fixes +## review: a fix for a 🔴 reruns the pass that found it, unless that pass is at its cap, and each pass whose row in `larv-review` §3's re-entry table the fix meets; from round 2 a pass reviews only the answers to its last round's findings and any other pass's fix that re-entered it; a fix for a 🟢 or a ❓ doesn't rerun any pass, nor does one for a prose finding unless it rewrites a claim a command or a source file can check, which reruns prose once, and a fix for a 🟡 reruns the pass that raised it only when the fix weakens, skips or guards a test; the stability pass doesn't rerun on a round's fixes where every 🔴 and 🟡 of that round asked only that a named mutant be killed or a named failing test pass, and the tests and the mutation command run clean on the fixes 2026-10-08, lilleman. Serves goal 1.4. An audit of the four costliest archived chunks found nearly every finding that mattered in a pass's first round; when every fix, a nit's included, re-entered review, later rounds mostly re-checked the last fix, reworded what an earlier round wrote, or contradicted another round on the same line. A round 2 caught real bugs only where a fix changed behaviour, so stability still reruns on every fix that does, and security on every fix that opens an untrusted-input boundary or touches authn/authz, secrets or crypto. Valid while round-2 reviews of nit and prose fixes change only what a user wouldn't notice. @@ -376,6 +376,8 @@ Valid while no published standard sets either number, the reading-cost window st 2026-11-18, lilleman through todo item 399. Serves goals 1.1 and 1.4. The 2026-10-29 entry's validity condition broke once. In a client project's pull request, stability round 1 raised a 🟡: an end-to-end payroll test passes on a used database. It proposed asserting the created row counts. The answer commit added that assertion behind a `test.skip` that runs when every count is zero. A broken payroll also creates zero rows, so a regression became a skip. The gate and the mutation run don't catch it, since a skipped test counts as passing; only the forge's auto-reviewer did. So a 🟡 fix that removes or loosens an assertion, changes an expected value, or skips, deletes or guards a test or assertion reruns the pass that raised it, as a 🔴 fix does. A 🟡 fix that only kills a named mutant or makes a named failing test pass doesn't, since the tests and the mutation command check it, and a skipped test kills no mutant. Every other 🟡 fix keeps the 2026-10-29 rule: the 2026-10-08 audit found that reruns of fixes to minor findings mostly re-checked wording. The rerun reviews only the answers, and the cap of two rounds still ends the pass. Valid while fixes of this kind are a small share of 🟡 fixes, so the extra round stays cheap. +2026-11-25, lilleman through todo item 540. Serves goals 1.1 and 1.4. The 2026-10-08 entry's validity condition broke once: a prose reviewer flagged a doc's claim about generated output as false, the rewrite was still false, and only the outside auto-reviewer caught it, after the PR was ready; another sentence credited a source but left out the licence link and notice of changes its licence file lists. So a prose fix that rewrites a checkable claim, such as generated output, a number or a licence term, reruns the prose pass as its second and last round, with the rewritten claims handed over so the reviewer checks each against a counter-example and the source it names. Rewording a claim's prose still reruns nothing. The other direction, having the reviewer test each rewrite before accepting it, needs a round that sees the rewrite anyway. Valid while a second prose round finds a false rewrite in more than a few of the chunks it runs in. + ## review: a comment is prose in any file; a branch changing only Markdown no agent follows runs only the prose pass and, for README or docs an outside reader lands on, the product-owner pass; plan rows a chunk files from a finding, re-scores or moves get no review 2026-10-29, lilleman. Serves goals 1.4 and 1.5. One project's chunk on 2026-10-29 changed a README paragraph, `todo.md` and three lines of `gate.yml`, and the principles, security and stability passes all ran on it, each twice: 6 of the chunk's 10 rounds. A change to config is one that changes what runs, so a comment in it fires only the prose pass, as a comment in code already did. A branch that changes only Markdown no agent follows changes no code, config or tests, so no pass that reads those runs on it. A plan row a chunk files from a finding, re-scores or moves is read by the chunk that ships it, so reviewing it at filing reviewed it twice: that chunk spent a prose round of 4 minutes on its plan change. Markdown an agent follows, such as a skill, is config, since a change there changes what agents do. Valid while defects in prose-only chunks stay rare in later chunks' fixes. diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 9bce7b73..c2a30e9b 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -3587,3 +3587,17 @@ Read most (opens and searches): - `bin/task_bench/plant.py` 1 - `bin/task_bench/planted_mutant.py` 1 - `bin/task_bench/python_bugs.py` 1 + +## Reading cost, chunk ba67f0a271e0, finished 2026-11-25T22:59:03Z + +77868 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/task_bench/test_shipped_features.py` 5 +- `bin/branch_chunks/cut.py` 4 +- `README.md` 2 +- `bin/task_bench/main.py` 2 +- `bin/task_bench/shipped_features.py` 2 +- `bin/branch_chunks/read.py` 1 +- `docs/decisions.md` 1 diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index 7c025386..afaced6b 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -52,7 +52,7 @@ A pass is one kind of review, a row of the table, named by its first column. Its | Overrides | override-reviewer | `~/.claude/bin/rule-hook overrides`, run in the chunk's worktree, prints a line no round of this pass has ruled on | | Stability | stability-reviewer | changes code, config or tests | | Product-owner | product-owner-reviewer | changes an external surface or contract: API routes and request/response shapes, events, webhooks, published file formats, CLI flags and exit codes, UI, error or deprecation text a consumer reads, README and docs an outside reader lands on | -| Prose | prose-reviewer | changes prose a reader reads, such as docs, comments, help or error text, or the plan's text for an item the chunk ships, splits or answers; one round | +| Prose | prose-reviewer | changes prose a reader reads, such as docs, comments, help or error text, or the plan's text for an item the chunk ships, splits or answers; one round, and a second where a fix rewrites a checkable claim ("Re-entry") | The table's first two columns are also code: `PASS_AGENTS` in `bin/review_rules/review_passes.py`, which `bin/repo_checks/test_reviewer_launches.py` holds to the table. Change a row in both. @@ -99,7 +99,7 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h - **Done.** A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings", or settled in the PR summary per "Comprehension check" → "Places", or, for the prose pass and a pass at its cap, fixed. A stability pass whose round's fixes skip the next round per "Re-entry" → "Mechanical answers" is done once that rule's run is clean. Resolve that round's 🟢s and ❓s per "Findings" too. - **Cap.** A pass takes at most two rounds per chunk, and the release review's architecture and principles passes five; don't ask the user for more. Answer its last round's findings per "Findings": those fixes merge once the gate passes, unreviewed by that pass. rule-hook's `round-cap` refuses a round commit that would take a pass past its cap, and no override waives it. A review the auto-reviewer posts after its second isn't a round: fix none of it and rerun no pass for it, but file a security finding it raises per `~/.claude/CLAUDE.md` → "Working loop", and any other 🔴 in `todo.md`. -**Re-entry.** A fix is a change no pass has seen. A fix for a 🟢, a ❓ or a prose finding doesn't rerun any pass, whatever it changes. A fix for a 🟡 meets only the 🟡 row below. A round's fixes for 🔴 findings, and its 🟡 fixes that meet that row, re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then §4; "Mechanical answers" below names the one exception. A pass at its cap doesn't run again ("Round cap" → "Cap"). +**Re-entry.** A fix is a change no pass has seen. A fix for a 🟢 or a ❓, or for a prose finding unless the last row below fits, doesn't rerun any pass, whatever it changes. A fix for a 🟡 meets only the 🟡 row below. A round's fixes for 🔴 findings, its 🟡 fixes that meet that row, and its prose fixes that meet the last row, re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then §4; "Mechanical answers" below names the one exception. A pass at its cap doesn't run again ("Round cap" → "Cap"). | The fix | Reruns | |---------|--------| @@ -110,8 +110,9 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h | opens an untrusted-input boundary or touches authn/authz, secrets or crypto | Security, unless the full scan reruns on it | | made rule-hook log an override | Overrides | | changes behaviour: what the code or its tests do | Stability | +| answers a prose finding of any severity by rewriting a claim that a command or a source file can check, such as what generated output holds, a number or a licence term | Prose, as its second and last round | -A fix meets every row it fits, except that a fix for a 🟡 meets only the 🟡 row. Such a fix meets no row once §2's tests and mutation command run clean on it and the named failing test is unedited ("Mechanical answers"); a skipped test kills no mutant. Prose has no row, so a comment or doc edit inside a fix doesn't rerun any pass. Example: a fix for a stability 🔴 that changes code and a comment reruns Principles and Stability. +A fix meets every row it fits, except that a fix for a 🟡 of a pass other than prose meets only the 🟡 row. Such a fix meets no row once §2's tests and mutation command run clean on it and the named failing test is unedited ("Mechanical answers"); a skipped test kills no mutant. Prose's only row is the last, so any other comment or doc edit inside a fix doesn't rerun any pass. Example: a fix for a stability 🔴 that changes code and a comment reruns Principles and Stability. **Mechanical answers.** A stability round's fixes may skip the next stability round. That holds where the round reported a 🔴, and each of its 🔴 and 🟡 findings asked only that a named mutant be killed or a named failing test pass. Run §2's tests and mutation command on the fixes, and fix again per §2 until they leave no failing test and no surviving mutant that changes behaviour. Each named failing test must pass as the round found it, not edited or deleted. Then the stability pass doesn't run again, and the round's answer commit title ends `; tests and mutants clean at `. The fixes still rerun each other pass whose row they meet. Where the run can't be made clean, or a fix edits a named failing test, the stability pass runs again as the table says. @@ -207,7 +208,7 @@ Launch the reviewer with the change — stability-reviewer also with the places ### Prose -Launch prose-reviewer with what the diff touched and every section this review cited — a reviewer's finding, your decline or the implementer's decision quoted it — each with the code it governs, and say whether the chunk is a release review. Fix what the chunk touched. A finding on a cited section the chunk did not touch, or on any other prose file, is outside the chunk. A split or index bigger than the chunk is filed as a `todo.md` item naming the section and how long a reader searches it. +Launch prose-reviewer with what the diff touched and every section this review cited — a reviewer's finding, your decline or the implementer's decision quoted it — each with the code it governs, and say whether the chunk is a release review. In round 2, hand it each claim the round's fixes rewrote, with the source it names, such as a licence file: it checks the rewrite against that source and a counter-example, not only the finding it answers. Fix what the chunk touched. A finding on a cited section the chunk did not touch, or on any other prose file, is outside the chunk. A split or index bigger than the chunk is filed as a `todo.md` item naming the section and how long a reader searches it. ## 4. Gate From 66524cbd6637625751314fc2c766dd449f8bbd24 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 00:08:33 +0100 Subject: [PATCH 14/23] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=207=20=F0=9F=9F=A1=20(0=20misread);=20settle=20wh?= =?UTF-8?q?ich=20fixes=20rerun=20prose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agents/prose-reviewer.md | 2 +- docs/decisions.md | 2 +- skills/larv-review/SKILL.md | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/agents/prose-reviewer.md b/agents/prose-reviewer.md index 9fb34471..0da6bcb9 100644 --- a/agents/prose-reviewer.md +++ b/agents/prose-reviewer.md @@ -28,7 +28,7 @@ Run them in this order. A fix for a later check never breaks an earlier one. Also report a list whose order carries no meaning and is not sorted (the technical principles' "Deterministic order", in the folder your prompt's `Technical principles:` line names; without one, open your report by saying so), a sentence contradicting another, a claim the code shows false, and a word used against `CLAUDE.md` → "Vocabulary". -Where the prompt hands you claims a fix rewrote, treat each as new: look for one case it gets wrong, such as an input whose output differs, and check it against every term of the source it names, such as each credit and notice a licence file lists. A claim you can't check is a ❓ naming what would. +Where your prompt hands you claims a fix rewrote, judge each claim afresh, not only the finding it answered. Look for a counter-example: one input or case where it is false. Then check it against every term of the source it names, such as each credit and notice a licence file lists. Report a claim you can't check as a ❓ naming what would check it. Where your prompt has a `Claimed output:` line, that file holds the command and real output of each changed line that says what a command prints. Report a claim its output doesn't bear out, and name the missing words. A claim marked `not run` is a ❓ naming the command that would run it. diff --git a/docs/decisions.md b/docs/decisions.md index 4b0f2d6b..03c1d12d 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -376,7 +376,7 @@ Valid while no published standard sets either number, the reading-cost window st 2026-11-18, lilleman through todo item 399. Serves goals 1.1 and 1.4. The 2026-10-29 entry's validity condition broke once. In a client project's pull request, stability round 1 raised a 🟡: an end-to-end payroll test passes on a used database. It proposed asserting the created row counts. The answer commit added that assertion behind a `test.skip` that runs when every count is zero. A broken payroll also creates zero rows, so a regression became a skip. The gate and the mutation run don't catch it, since a skipped test counts as passing; only the forge's auto-reviewer did. So a 🟡 fix that removes or loosens an assertion, changes an expected value, or skips, deletes or guards a test or assertion reruns the pass that raised it, as a 🔴 fix does. A 🟡 fix that only kills a named mutant or makes a named failing test pass doesn't, since the tests and the mutation command check it, and a skipped test kills no mutant. Every other 🟡 fix keeps the 2026-10-29 rule: the 2026-10-08 audit found that reruns of fixes to minor findings mostly re-checked wording. The rerun reviews only the answers, and the cap of two rounds still ends the pass. Valid while fixes of this kind are a small share of 🟡 fixes, so the extra round stays cheap. -2026-11-25, lilleman through todo item 540. Serves goals 1.1 and 1.4. The 2026-10-08 entry's validity condition broke once: a prose reviewer flagged a doc's claim about generated output as false, the rewrite was still false, and only the outside auto-reviewer caught it, after the PR was ready; another sentence credited a source but left out the licence link and notice of changes its licence file lists. So a prose fix that rewrites a checkable claim, such as generated output, a number or a licence term, reruns the prose pass as its second and last round, with the rewritten claims handed over so the reviewer checks each against a counter-example and the source it names. Rewording a claim's prose still reruns nothing. The other direction, having the reviewer test each rewrite before accepting it, needs a round that sees the rewrite anyway. Valid while a second prose round finds a false rewrite in more than a few of the chunks it runs in. +2026-11-25, lilleman through todo item 540. Serves goals 1.1 and 1.4. The 2026-10-08 entry's validity condition broke once, in one chunk. A prose reviewer flagged a doc's claim about generated output as false, the rewrite was still false, and only the outside auto-reviewer caught it, after the PR was ready. A credit sentence also left out the licence link and the notice of changes that the source's licence file lists. So a prose fix that rewrites a checkable claim, such as generated output, a number or a licence term, reruns the prose pass as its second and last round. The reviewer gets each rewritten claim and looks for a counter-example, then checks it against the source the claim names. A fix that rewords a claim without changing what it says reruns no pass. The other direction, having the reviewer test each rewrite before accepting it, needs a round that sees the rewrite anyway. Valid while a second prose round finds a false rewrite in more than a few of the chunks it runs in. ## review: a comment is prose in any file; a branch changing only Markdown no agent follows runs only the prose pass and, for README or docs an outside reader lands on, the product-owner pass; plan rows a chunk files from a finding, re-scores or moves get no review diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index afaced6b..b935960e 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -52,7 +52,7 @@ A pass is one kind of review, a row of the table, named by its first column. Its | Overrides | override-reviewer | `~/.claude/bin/rule-hook overrides`, run in the chunk's worktree, prints a line no round of this pass has ruled on | | Stability | stability-reviewer | changes code, config or tests | | Product-owner | product-owner-reviewer | changes an external surface or contract: API routes and request/response shapes, events, webhooks, published file formats, CLI flags and exit codes, UI, error or deprecation text a consumer reads, README and docs an outside reader lands on | -| Prose | prose-reviewer | changes prose a reader reads, such as docs, comments, help or error text, or the plan's text for an item the chunk ships, splits or answers; one round, and a second where a fix rewrites a checkable claim ("Re-entry") | +| Prose | prose-reviewer | changes prose a reader reads, such as docs, comments, help or error text, or the plan's text for an item the chunk ships, splits or answers; one round, and a second after a fix for a prose finding that rewrites a claim a command or a source file can check ("Re-entry") | The table's first two columns are also code: `PASS_AGENTS` in `bin/review_rules/review_passes.py`, which `bin/repo_checks/test_reviewer_launches.py` holds to the table. Change a row in both. @@ -99,7 +99,7 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h - **Done.** A pass is done when its latest round leaves no 🔴 or 🟡 standing: none was reported, or each was shown factually wrong, declined, filed, or named under the bar per "Findings", or settled in the PR summary per "Comprehension check" → "Places", or, for the prose pass and a pass at its cap, fixed. A stability pass whose round's fixes skip the next round per "Re-entry" → "Mechanical answers" is done once that rule's run is clean. Resolve that round's 🟢s and ❓s per "Findings" too. - **Cap.** A pass takes at most two rounds per chunk, and the release review's architecture and principles passes five; don't ask the user for more. Answer its last round's findings per "Findings": those fixes merge once the gate passes, unreviewed by that pass. rule-hook's `round-cap` refuses a round commit that would take a pass past its cap, and no override waives it. A review the auto-reviewer posts after its second isn't a round: fix none of it and rerun no pass for it, but file a security finding it raises per `~/.claude/CLAUDE.md` → "Working loop", and any other 🔴 in `todo.md`. -**Re-entry.** A fix is a change no pass has seen. A fix for a 🟢 or a ❓, or for a prose finding unless the last row below fits, doesn't rerun any pass, whatever it changes. A fix for a 🟡 meets only the 🟡 row below. A round's fixes for 🔴 findings, its 🟡 fixes that meet that row, and its prose fixes that meet the last row, re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then §4; "Mechanical answers" below names the one exception. A pass at its cap doesn't run again ("Round cap" → "Cap"). +**Re-entry.** A fix is a change no pass has seen. A fix for a 🟢 or a ❓ doesn't rerun any pass, whatever it changes. A fix for a 🟡 of a pass other than prose meets only the 🟡 row below, and a fix for a prose finding, of any severity, only the last row. A round's fixes for 🔴 findings, its 🟡 fixes that meet that row, and its prose fixes that meet the last row, re-enter together: run every pass that a row below names for any of them, a done pass included, in the waves of "Waves", then §4; "Mechanical answers" below names the one exception. A pass at its cap doesn't run again ("Round cap" → "Cap"). | The fix | Reruns | |---------|--------| @@ -110,9 +110,9 @@ Give a reviewer without Bash `git ls-files`'s output in its prompt, since some h | opens an untrusted-input boundary or touches authn/authz, secrets or crypto | Security, unless the full scan reruns on it | | made rule-hook log an override | Overrides | | changes behaviour: what the code or its tests do | Stability | -| answers a prose finding of any severity by rewriting a claim that a command or a source file can check, such as what generated output holds, a number or a licence term | Prose, as its second and last round | +| answers a prose finding by rewriting what a claim says, where a command or a source file can check the claim, such as what generated output holds, a number or a licence term; rewording that keeps what it says doesn't count | Prose, as its second and last round | -A fix meets every row it fits, except that a fix for a 🟡 of a pass other than prose meets only the 🟡 row. Such a fix meets no row once §2's tests and mutation command run clean on it and the named failing test is unedited ("Mechanical answers"); a skipped test kills no mutant. Prose's only row is the last, so any other comment or doc edit inside a fix doesn't rerun any pass. Example: a fix for a stability 🔴 that changes code and a comment reruns Principles and Stability. +A fix meets every row it fits, except the two fixes named above, each of which meets only its one row. Such a fix meets no row once §2's tests and mutation command run clean on it and the named failing test is unedited ("Mechanical answers"); a skipped test kills no mutant. A comment or doc edit inside a fix for another pass's finding doesn't rerun any pass. Example: a fix for a stability 🔴 that changes code and a comment reruns Principles and Stability. **Mechanical answers.** A stability round's fixes may skip the next stability round. That holds where the round reported a 🔴, and each of its 🔴 and 🟡 findings asked only that a named mutant be killed or a named failing test pass. Run §2's tests and mutation command on the fixes, and fix again per §2 until they leave no failing test and no surviving mutant that changes behaviour. Each named failing test must pass as the round found it, not edited or deleted. Then the stability pass doesn't run again, and the round's answer commit title ends `; tests and mutants clean at `. The fixes still rerun each other pass whose row they meet. Where the run can't be made clean, or a fix edits a named failing test, the stability pass runs again as the table says. @@ -208,7 +208,7 @@ Launch the reviewer with the change — stability-reviewer also with the places ### Prose -Launch prose-reviewer with what the diff touched and every section this review cited — a reviewer's finding, your decline or the implementer's decision quoted it — each with the code it governs, and say whether the chunk is a release review. In round 2, hand it each claim the round's fixes rewrote, with the source it names, such as a licence file: it checks the rewrite against that source and a counter-example, not only the finding it answers. Fix what the chunk touched. A finding on a cited section the chunk did not touch, or on any other prose file, is outside the chunk. A split or index bigger than the chunk is filed as a `todo.md` item naming the section and how long a reader searches it. +Launch prose-reviewer with what the diff touched and every section this review cited — a reviewer's finding, your decline or the implementer's decision quoted it — each with the code it governs, and say whether the chunk is a release review. In round 2, hand it each claim that round 1's fixes rewrote, with the source the claim names, such as a licence file. Fix what the chunk touched. A finding on a cited section the chunk did not touch, or on any other prose file, is outside the chunk. A split or index bigger than the chunk is filed as a `todo.md` item naming the section and how long a reader searches it. ## 4. Gate From 95d8d201cfc61a00b3762112cf7fbf3ce8a4f717 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 00:08:43 +0100 Subject: [PATCH 15/23] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20settle=20wh?= =?UTF-8?q?ich=20fixes=20rerun=20prose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 53ce873cc2a5392cc7bce14d5f5b2e82e044f049 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 00:13:13 +0100 Subject: [PATCH 16/23] Finish item 540 in the plan --- CHANGELOG.md | 1 + todo.md | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfe61659..9fbdb3d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- larv-review's prose pass takes a second round after a fix that rewrites a claim a command or a source file can check, such as generated output, a number or a licence term. - `deploy-release --cut-patch ` cuts the newest tag's next patch release, such as 0.15.2 after v0.15.1, holding only the commits named, for a fix that must ship before main's other unreleased work. It runs `ci.sh` on the patch, tags and pushes it, merges the tag back into main through a pull request, and moves `~/.claude` to it. Plain `--cut` now refuses a patch release, and a release review counts only for a release later than the last cut. - `task-bench` plants bugs in Rust files too, from the mutants cargo-mutants catches, and tells Haiku the panic message `cargo test` prints. - `task-bench --tasks shipped-features` benches rebuilding features the project shipped: it takes each one's change out of the code, tells Haiku the tagline of its plan item, and checks the build with the tests that change holds. `--shipped ` sets how many it takes, and a feature whose branch landed by fast-forward starts after the latest earlier chunk that shipped an item or landed by a merge or a rebase, and is passed over where none comes before it or its branch merged the default branch into itself. diff --git a/todo.md b/todo.md index 8b301d75..9e38cd2e 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 540 | 0.16.0 | | | **Review once more each prose fix that rewrites a checkable claim, such as a claim about generated output, a number or a licence term, so no such rewrite reaches the merge unreviewed.** | 2 | 2 | 3 | 5 | 3 | 1.1 by 4 | 1.5 | | 539 | 0.16.0 | | defect | **Start a chunk's worker on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find.** | 1 | 2 | 3 | 4 | 2 | 1.5 by 3 | 1.1 | | 524 | 0.16.0 | | owner | **Write fejkdata's first six bench features, each a spec, acceptance tests in Go and a reference patch that builds it, in the `bench-tasks` folder its config names.** | 3 | 2 | 1 | 4 | 6 | 1.1 by 3 | 0.5 | | 532 | 0.16.0 | | | **Leave out of a `task-bench` fix a change Haiku makes to a Rust test that stands in the file of the code it tests.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 1 | 0.4 | @@ -114,20 +113,6 @@ ## Details -### 540. Review once more each prose fix that rewrites a checkable claim, such as a claim about generated output, a number or a licence term, so no such rewrite reaches the merge unreviewed. - -Today the prose pass runs one round per chunk, and a fix for a prose finding reruns no pass ("Re-entry"). So a rewrite of a factual claim merges unchecked. In one chunk the prose reviewer flagged a doc's claim about generated output as false; the rewrite was still false, and only the outside auto-reviewer caught it, after the PR was marked ready. In the same chunk a credit sentence left out parts the project's licence file lists for that source: a licence link and a notice of changes. - -Two directions; the implementer picks the cheaper that fits what the rounds cost: - -- let the prose pass re-enter once where a round's fix answers a finding that asserts something checkable; -- or have prose-reviewer check each claim a fix rewrites against a concrete counter-example, and against the source it names, such as the licence file's listed credit, before it accepts the rewrite. - -Touches: - -- `skills/larv-review/SKILL.md`: `## 3. Passes` (small), `### Prose` (small) -- `agents/prose-reviewer.md`: `## Checks, in priority order` (small) - ### 539. Start a chunk's worker on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find. Today `session_open` in `bin/claude_code/session.py` counts a session as open wherever its `.jsonl` exists. On 2026-11-24 a run left item-532's transcript as a 0-byte file, with an archive folder whose transcript and outcomes were empty too. On 2026-11-25 every rerun of item-532 called `claude --resume `. Each got "No conversation found with session ID …" and exited 1. The window stopped after three failures and waited for the human, who had to move the file away by hand. From 0bf477c630da1ee63a5fec5c209fa26b565eda0c Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 00:34:22 +0100 Subject: [PATCH 17/23] Start a fresh session where its transcript is empty --- bin/agent_cycle/run.py | 18 +++++++++--- bin/agent_cycle/test_run.py | 10 +++++++ bin/claude_code/session.py | 17 +++++++++-- bin/claude_code/test_claude_code.py | 37 +++++++++++++++++++++++- bin/loop_claude/loop/test_chunk_start.py | 4 +-- docs/reading-cost.md | 14 +++++++++ 6 files changed, 91 insertions(+), 9 deletions(-) diff --git a/bin/agent_cycle/run.py b/bin/agent_cycle/run.py index 84205b86..57bb10bc 100644 --- a/bin/agent_cycle/run.py +++ b/bin/agent_cycle/run.py @@ -7,9 +7,10 @@ from transcript_archive.write import archive from agent_cycle.worker import AUTO_COMPACT_WINDOW, COMPACT_WINDOW, run_worker, worker_args from claude_code.output_limits import BASH_CEILING, BASH_CEILING_CHARACTERS from agent_cycle.judge import Brief, judge, Rejected -from claude_code.session import delete_session, Session, session_open, transcript_file +from claude_code.session import delete_session, discard_empty_transcript, Session, session_open, transcript_file from loop_effects.effects import Effects, say from claude_code.entries import Entry +from claude_code.reply import Limited from failure import Failure from agent_cycle.verdicts import Finished, Interrupt, Judged, QuotedAnswer, TakenIn, Unfinished, Verdict from agent_cycle.interrupt import interrupt, Talked, WorkerSession @@ -121,8 +122,7 @@ def step(cycle: Cycle, state: Active) -> Event | Stop: def work(cycle: Cycle, answered: QuotedAnswer | TypedAnswer | None, stepped: bool) -> WorkerRan | Stop: if isinstance(answered, QuotedAnswer): say(f"\n=== {cycle.prompts.quote_sources} answered: {answered.question} ===\n{answered.answer}", cycle.effects, stdout=True) - # worker_start runs inside the lambda: a failed attempt may have opened the session. - if stop := retried("worker", lambda: run_worker(cycle.root, worker_start(cycle, answered, stepped), worker_environment(cycle), cycle.project_archive, cycle.project.rung if cycle.project else cycle.route.rung, cycle.effects), cycle.effects): + if stop := retried("worker", lambda: started_worker(cycle, answered, stepped), cycle.effects): return stop path = transcript_file(cycle.session) return WorkerRan(path) if path is not None else Stop(1, f"claude left no transcript for session {cycle.session.id}") @@ -137,13 +137,23 @@ def worker_session(cycle: Cycle, transcript_path: str, stepped_from: Rung | None return WorkerSession(cycle.root, cycle.session.id, cycle.route.rung, stepped_from or cycle.route.rung, transcript_path, worker_environment(cycle)) -def worker_start(cycle: Cycle, answered: QuotedAnswer | TypedAnswer | None, stepped: bool) -> list[str]: +def started_worker(cycle: Cycle, answered: QuotedAnswer | TypedAnswer | None, stepped: bool) -> Failure | Limited | None: + """One run of the worker. worker_start runs on each attempt: a failed one may have opened the session, or left it empty.""" + args = worker_start(cycle, answered, stepped) + if isinstance(args, Failure): + return args + return run_worker(cycle.root, args, worker_environment(cycle), cycle.project_archive, cycle.project.rung if cycle.project else cycle.route.rung, cycle.effects) + + +def worker_start(cycle: Cycle, answered: QuotedAnswer | TypedAnswer | None, stepped: bool) -> list[str] | Failure: if isinstance(answered, QuotedAnswer): return worker_args(cycle.session, cycle.route.rung, cycle.prompts.answered(answered.question, answered.answer, cycle.route, cycle.project, stepped), resume=True) if isinstance(answered, TypedAnswer): return worker_args(cycle.session, cycle.route.rung, cycle.prompts.typed(answered.question, answered.answer, cycle.route, cycle.project, stepped), resume=True) if session_open(cycle.session): return worker_args(cycle.session, cycle.route.rung, cycle.prompts.resumed(cycle.unfinished_evidence, cycle.route, cycle.project), resume=True) + if failure := discard_empty_transcript(cycle.session): + return failure return worker_args(cycle.session, cycle.route.rung, cycle.prompts.fresh(cycle.task, cycle.premises, cycle.route, cycle.project, cycle.facts), resume=False) diff --git a/bin/agent_cycle/test_run.py b/bin/agent_cycle/test_run.py index e8be0e83..e9007ed2 100644 --- a/bin/agent_cycle/test_run.py +++ b/bin/agent_cycle/test_run.py @@ -172,6 +172,16 @@ Worker: {OFF_LADDER} self.assertEqual(workers[1][workers[1].index("-p") + 1], "Resumed: working") self.assertEqual(self.archived_outcomes(), [f"Task: Do it.\n\n2026-09-21T14:13:20Z Verdict: unfinished\n\nEvidence:\n> working\n\nConfig: {CONFIG}\nJudge: judge-model\nWorker: {OFF_LADDER}\n"] * 2) + def test_a_session_whose_transcript_is_empty_starts_fresh_with_its_session_id_where_claude_cannot_resume_it(self): + path = self.paths.claude_code_transcripts / "-fake" / f"{self.session.id}.jsonl" + path.parent.mkdir(parents=True) + path.touch() + fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("finished")]) + self.assertEqual(run.run_cycle(self.cycle(fake)).verdict, Finished("working")) + worker, = fake.made("stream_claude") + self.assertIn("--session-id", worker) + self.assertNotIn("--resume", worker) + def test_a_cycle_stopped_by_a_failure_or_ctrl_c_archives_what_its_session_holds(self): fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[ran(code=1)] * 3) self.assertEqual(run.run_cycle(self.cycle(fake)).code, 1) diff --git a/bin/claude_code/session.py b/bin/claude_code/session.py index 075cba9b..6a8fe190 100644 --- a/bin/claude_code/session.py +++ b/bin/claude_code/session.py @@ -12,7 +12,7 @@ NAMESPACE = uuid.UUID("64fb586b-d926-4bb3-a44c-c903e86d3eec") @dataclasses.dataclass(frozen=True) class Session: - """Exists while its transcript does.""" + """Open while its transcript holds something: claude cannot resume an empty one.""" id: uuid.UUID claude_code_transcripts: pathlib.Path name: str @@ -29,7 +29,20 @@ def transcript_file(session: Session) -> str | None: def session_open(session: Session) -> bool: - return transcript_file(session) is not None + path = transcript_file(session) + return path is not None and os.path.getsize(path) > 0 + + +def discard_empty_transcript(session: Session) -> Failure | None: + """Removes a 0-byte transcript, which a run that died early leaves: claude refuses `--session-id` for an id whose file exists, and cannot `--resume` it.""" + path = transcript_file(session) + if path is None or os.path.getsize(path) > 0: + return None + try: + os.remove(path) + except OSError as failure: + return Failure(f"could not remove the empty transcript {path}: {failure.strerror or failure}; remove it, then run it again") + return None # .jsonl, /subagents/, and from older Claude Code versions .superseded-*/ and .orphaned-*.jsonl diff --git a/bin/claude_code/test_claude_code.py b/bin/claude_code/test_claude_code.py index 7ce0780e..7e249e43 100644 --- a/bin/claude_code/test_claude_code.py +++ b/bin/claude_code/test_claude_code.py @@ -2,12 +2,14 @@ import json import pathlib import subprocess import sys +import tempfile import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from claude_code import entries, reply, transcript +from claude_code import entries, reply, session, transcript from failure import Failure +from test_env import assert_not_root def assistant(*parts): @@ -226,3 +228,36 @@ class ClaudeReply(unittest.TestCase): if __name__ == "__main__": unittest.main() + + +class EmptyTranscript(unittest.TestCase): + def setUp(self): + temp = tempfile.TemporaryDirectory() + self.addCleanup(temp.cleanup) + self.session = session.session_named("A proj a-driver", pathlib.Path(temp.name)) + self.path = pathlib.Path(temp.name) / "-home-me-code-log" / f"{self.session.id}.jsonl" + self.path.parent.mkdir() + + def test_a_session_is_open_only_where_its_transcript_holds_something(self): + self.assertFalse(session.session_open(self.session)) + self.path.touch() + self.assertFalse(session.session_open(self.session)) + self.path.write_text("{}\n") + self.assertTrue(session.session_open(self.session)) + + def test_discarding_removes_an_empty_transcript_and_keeps_one_that_holds_something(self): + self.path.touch() + self.assertIsNone(session.discard_empty_transcript(self.session)) + self.assertFalse(self.path.exists()) + self.path.write_text("{}\n") + self.assertIsNone(session.discard_empty_transcript(self.session)) + self.assertEqual(self.path.read_text(), "{}\n") + + def test_discarding_says_where_it_could_not_remove_the_file(self): + assert_not_root(self) + self.path.touch() + self.path.parent.chmod(0o500) + self.addCleanup(self.path.parent.chmod, 0o700) + failure = session.discard_empty_transcript(self.session) + self.assertIsInstance(failure, Failure) + self.assertIn(str(self.path), failure.reason) diff --git a/bin/loop_claude/loop/test_chunk_start.py b/bin/loop_claude/loop/test_chunk_start.py index 69b09b2c..f103e9d6 100644 --- a/bin/loop_claude/loop/test_chunk_start.py +++ b/bin/loop_claude/loop/test_chunk_start.py @@ -46,7 +46,7 @@ class RouteSources(unittest.TestCase): opened = session.session_named("A proj loop-claude", pathlib.Path(root, "projects")) transcript = pathlib.Path(root, "projects", "-fake", f"{opened.id}.jsonl") transcript.parent.mkdir(parents=True) - transcript.write_text("") + transcript.write_text("{}\n") unread = Failure("no git") fake = FakeEffects(git=[*ON_MAIN, unread, unread, unread, unread]) with contextlib.redirect_stderr(io.StringIO()) as stderr: @@ -176,7 +176,7 @@ class ChunkFacts(unittest.TestCase): self.assertEqual((fresh.made("python"), "- A fact." in facts), ([(["/b/chunk-preflight", "--worktree", "--item", "7"], "/r")], True)) transcript = pathlib.Path(home, "projects", "-fake", f"{opened.id}.jsonl") transcript.parent.mkdir(parents=True) - transcript.write_text("") + transcript.write_text("{}\n") resumed = FakeEffects() facts, _ = chunk_start.chunk_start(a_loop(resumed.effects(), session=opened, launcher=self.LAUNCHER)) self.assertEqual((resumed.made("python"), facts), ([], "")) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 9bce7b73..c2a30e9b 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -3587,3 +3587,17 @@ Read most (opens and searches): - `bin/task_bench/plant.py` 1 - `bin/task_bench/planted_mutant.py` 1 - `bin/task_bench/python_bugs.py` 1 + +## Reading cost, chunk ba67f0a271e0, finished 2026-11-25T22:59:03Z + +77868 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/task_bench/test_shipped_features.py` 5 +- `bin/branch_chunks/cut.py` 4 +- `README.md` 2 +- `bin/task_bench/main.py` 2 +- `bin/task_bench/shipped_features.py` 2 +- `bin/branch_chunks/read.py` 1 +- `docs/decisions.md` 1 From bb57b68090c554117cba0cf2e120d0a3f3347beb Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 00:44:45 +0100 Subject: [PATCH 18/23] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20nothing=20t?= =?UTF-8?q?o=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 61f901a2c94e22ee1d74caa6a3b0238a5782a7f6 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 00:51:46 +0100 Subject: [PATCH 19/23] Kill the surviving mutants of the empty-transcript change --- bin/agent_cycle/test_run.py | 14 ++++++++++++++ bin/claude_code/test_claude_code.py | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/agent_cycle/test_run.py b/bin/agent_cycle/test_run.py index e9007ed2..36845aa7 100644 --- a/bin/agent_cycle/test_run.py +++ b/bin/agent_cycle/test_run.py @@ -182,6 +182,20 @@ Worker: {OFF_LADDER} self.assertIn("--session-id", worker) self.assertNotIn("--resume", worker) + def test_a_worker_that_fails_leaving_an_empty_transcript_is_retried_with_a_fresh_session(self): + path = self.paths.claude_code_transcripts / "-fake" / f"{self.session.id}.jsonl" + + def fails_leaving_it_empty(args): + path.parent.mkdir(parents=True, exist_ok=True) + path.touch() + return Streamed(1) + + fake = FakeEffects(streams=[fails_leaving_it_empty, Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("finished")]) + with contextlib.redirect_stderr(io.StringIO()) as said: + self.assertEqual(run.run_cycle(self.cycle(fake)).verdict, Finished("working")) + self.assertIn("retrying the worker in a minute", said.getvalue()) + self.assertEqual(["--session-id" in worker and "--resume" not in worker for worker in fake.made("stream_claude")], [True, True]) + def test_a_cycle_stopped_by_a_failure_or_ctrl_c_archives_what_its_session_holds(self): fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[ran(code=1)] * 3) self.assertEqual(run.run_cycle(self.cycle(fake)).code, 1) diff --git a/bin/claude_code/test_claude_code.py b/bin/claude_code/test_claude_code.py index 7e249e43..bb82917e 100644 --- a/bin/claude_code/test_claude_code.py +++ b/bin/claude_code/test_claude_code.py @@ -242,16 +242,16 @@ class EmptyTranscript(unittest.TestCase): self.assertFalse(session.session_open(self.session)) self.path.touch() self.assertFalse(session.session_open(self.session)) - self.path.write_text("{}\n") + self.path.write_text("{") self.assertTrue(session.session_open(self.session)) def test_discarding_removes_an_empty_transcript_and_keeps_one_that_holds_something(self): self.path.touch() self.assertIsNone(session.discard_empty_transcript(self.session)) self.assertFalse(self.path.exists()) - self.path.write_text("{}\n") + self.path.write_text("{") self.assertIsNone(session.discard_empty_transcript(self.session)) - self.assertEqual(self.path.read_text(), "{}\n") + self.assertEqual(self.path.read_text(), "{") def test_discarding_says_where_it_could_not_remove_the_file(self): assert_not_root(self) @@ -260,4 +260,4 @@ class EmptyTranscript(unittest.TestCase): self.addCleanup(self.path.parent.chmod, 0o700) failure = session.discard_empty_transcript(self.session) self.assertIsInstance(failure, Failure) - self.assertIn(str(self.path), failure.reason) + self.assertEqual(failure.reason, f"could not remove the empty transcript {self.path}: Permission denied; remove it, then run it again") From 05a195a09e3097952f60a4ae722b570e77389891 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 01:09:58 +0100 Subject: [PATCH 20/23] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20test=20the?= =?UTF-8?q?=20failed=20removal,=20run=20the=20new=20tests=20under=20the=20?= =?UTF-8?q?guard,=20and=20reword=20the=20prose=20round's=20finding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/agent_cycle/test_run.py | 15 ++++++++++++++- bin/claude_code/session.py | 4 ++-- bin/claude_code/test_claude_code.py | 12 ++++++------ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/bin/agent_cycle/test_run.py b/bin/agent_cycle/test_run.py index 36845aa7..1c5267b2 100644 --- a/bin/agent_cycle/test_run.py +++ b/bin/agent_cycle/test_run.py @@ -172,7 +172,7 @@ Worker: {OFF_LADDER} self.assertEqual(workers[1][workers[1].index("-p") + 1], "Resumed: working") self.assertEqual(self.archived_outcomes(), [f"Task: Do it.\n\n2026-09-21T14:13:20Z Verdict: unfinished\n\nEvidence:\n> working\n\nConfig: {CONFIG}\nJudge: judge-model\nWorker: {OFF_LADDER}\n"] * 2) - def test_a_session_whose_transcript_is_empty_starts_fresh_with_its_session_id_where_claude_cannot_resume_it(self): + def test_a_session_whose_transcript_is_empty_starts_fresh_with_its_session_id(self): path = self.paths.claude_code_transcripts / "-fake" / f"{self.session.id}.jsonl" path.parent.mkdir(parents=True) path.touch() @@ -196,6 +196,19 @@ Worker: {OFF_LADDER} self.assertIn("retrying the worker in a minute", said.getvalue()) self.assertEqual(["--session-id" in worker and "--resume" not in worker for worker in fake.made("stream_claude")], [True, True]) + def test_a_worker_stops_where_it_cannot_remove_the_empty_transcript_of_its_session(self): + assert_not_root(self) + path = self.paths.claude_code_transcripts / "-fake" / f"{self.session.id}.jsonl" + path.parent.mkdir(parents=True) + path.touch() + path.parent.chmod(0o500) + self.addCleanup(path.parent.chmod, 0o700) + fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)]) + with contextlib.redirect_stderr(io.StringIO()): + stop = run.run_cycle(self.cycle(fake)) + self.assertEqual(stop, Stop(1, f"the worker failed three times running: could not remove the empty transcript {path}: Permission denied; claude refuses to start the session while that file stands")) + self.assertEqual(fake.made("stream_claude"), []) + def test_a_cycle_stopped_by_a_failure_or_ctrl_c_archives_what_its_session_holds(self): fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[ran(code=1)] * 3) self.assertEqual(run.run_cycle(self.cycle(fake)).code, 1) diff --git a/bin/claude_code/session.py b/bin/claude_code/session.py index 6a8fe190..450a752e 100644 --- a/bin/claude_code/session.py +++ b/bin/claude_code/session.py @@ -34,14 +34,14 @@ def session_open(session: Session) -> bool: def discard_empty_transcript(session: Session) -> Failure | None: - """Removes a 0-byte transcript, which a run that died early leaves: claude refuses `--session-id` for an id whose file exists, and cannot `--resume` it.""" + """Removes the 0-byte transcript a failed run can leave: claude refuses `--session-id` for an id whose file stands, and cannot `--resume` it.""" path = transcript_file(session) if path is None or os.path.getsize(path) > 0: return None try: os.remove(path) except OSError as failure: - return Failure(f"could not remove the empty transcript {path}: {failure.strerror or failure}; remove it, then run it again") + return Failure(f"could not remove the empty transcript {path}: {failure.strerror or failure}; claude refuses to start the session while that file stands") return None diff --git a/bin/claude_code/test_claude_code.py b/bin/claude_code/test_claude_code.py index bb82917e..103b55cd 100644 --- a/bin/claude_code/test_claude_code.py +++ b/bin/claude_code/test_claude_code.py @@ -226,10 +226,6 @@ class ClaudeReply(unittest.TestCase): self.assertEqual(reply.claude_reply(self.claude(FileNotFoundError(2, "No such file or directory")), [], "/r", "p", "claude"), Failure("could not start claude: No such file or directory")) -if __name__ == "__main__": - unittest.main() - - class EmptyTranscript(unittest.TestCase): def setUp(self): temp = tempfile.TemporaryDirectory() @@ -253,11 +249,15 @@ class EmptyTranscript(unittest.TestCase): self.assertIsNone(session.discard_empty_transcript(self.session)) self.assertEqual(self.path.read_text(), "{") - def test_discarding_says_where_it_could_not_remove_the_file(self): + def test_discarding_fails_naming_the_file_it_could_not_remove(self): assert_not_root(self) self.path.touch() self.path.parent.chmod(0o500) self.addCleanup(self.path.parent.chmod, 0o700) failure = session.discard_empty_transcript(self.session) self.assertIsInstance(failure, Failure) - self.assertEqual(failure.reason, f"could not remove the empty transcript {self.path}: Permission denied; remove it, then run it again") + self.assertEqual(failure.reason, f"could not remove the empty transcript {self.path}: Permission denied; claude refuses to start the session while that file stands") + + +if __name__ == "__main__": + unittest.main() From 4d4cecfecb81915f94b0d773396a79b3d426cdb2 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 01:09:58 +0100 Subject: [PATCH 21/23] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20fixed=20in?= =?UTF-8?q?=20the=20stability=20round's=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 4e9efb4946bbbb2c8c6334854d8f18117bf8db7e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 01:10:20 +0100 Subject: [PATCH 22/23] Finish item 539 in the plan --- CHANGELOG.md | 1 + todo.md | 11 ----------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fbdb3d2..c4d42d46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- loop-claude starts a chunk on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find, which failed three times and waited for the human. - larv-review's prose pass takes a second round after a fix that rewrites a claim a command or a source file can check, such as generated output, a number or a licence term. - `deploy-release --cut-patch ` cuts the newest tag's next patch release, such as 0.15.2 after v0.15.1, holding only the commits named, for a fix that must ship before main's other unreleased work. It runs `ci.sh` on the patch, tags and pushes it, merges the tag back into main through a pull request, and moves `~/.claude` to it. Plain `--cut` now refuses a patch release, and a release review counts only for a release later than the last cut. - `task-bench` plants bugs in Rust files too, from the mutants cargo-mutants catches, and tells Haiku the panic message `cargo test` prints. diff --git a/todo.md b/todo.md index 9e38cd2e..f8213299 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 539 | 0.16.0 | | defect | **Start a chunk's worker on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find.** | 1 | 2 | 3 | 4 | 2 | 1.5 by 3 | 1.1 | | 524 | 0.16.0 | | owner | **Write fejkdata's first six bench features, each a spec, acceptance tests in Go and a reference patch that builds it, in the `bench-tasks` folder its config names.** | 3 | 2 | 1 | 4 | 6 | 1.1 by 3 | 0.5 | | 532 | 0.16.0 | | | **Leave out of a `task-bench` fix a change Haiku makes to a Rust test that stands in the file of the code it tests.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 1 | 0.4 | | 527 | 0.16.0 | | owner | **Plant bugs for `task-bench` in TypeScript, from the mutants Stryker kills.** | 3 | 2 | 1 | 4 | 4 | 1.1 by 1 | 0.3 | @@ -113,16 +112,6 @@ ## Details -### 539. Start a chunk's worker on a fresh session where its session's transcript is empty, in place of resuming a session claude cannot find. - -Today `session_open` in `bin/claude_code/session.py` counts a session as open wherever its `.jsonl` exists. On 2026-11-24 a run left item-532's transcript as a 0-byte file, with an archive folder whose transcript and outcomes were empty too. On 2026-11-25 every rerun of item-532 called `claude --resume `. Each got "No conversation found with session ID …" and exited 1. The window stopped after three failures and waited for the human, who had to move the file away by hand. - -Count an empty transcript as no session. Before the worker starts that session with `--session-id`, remove the empty file, so claude doesn't refuse the id. Leave a non-empty transcript to resume as today. The worker's start, in `bin/agent_cycle/run.py` → `worker_start`, and a chunk's start, in `bin/loop_claude/loop/chunk_start.py`, both read `session_open`, so the fix holds for both. - -Touches: -- `bin/claude_code/session.py`: `session_open` (small) -- `bin/claude_code/test_claude_code.py` - ### 524. Write fejkdata's first six bench features, each a spec, acceptance tests in Go and a reference patch that builds it, in the `bench-tasks` folder its config names. The second part of item 504, which says what a bench feature is and when a run counts. A stronger model than the project's writes the six, once. Each breaks one of fejkdata's goals while it would suit another audience: From bf27992fbcfd74f6acf1cc17143dfa9c3f7bed32 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 26 Nov 2026 01:29:53 +0100 Subject: [PATCH 23/23] Sort the imports the empty-transcript change added --- bin/agent_cycle/run.py | 2 +- bin/claude_code/test_claude_code.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/agent_cycle/run.py b/bin/agent_cycle/run.py index 57bb10bc..037ffb58 100644 --- a/bin/agent_cycle/run.py +++ b/bin/agent_cycle/run.py @@ -10,12 +10,12 @@ from agent_cycle.judge import Brief, judge, Rejected from claude_code.session import delete_session, discard_empty_transcript, Session, session_open, transcript_file from loop_effects.effects import Effects, say from claude_code.entries import Entry -from claude_code.reply import Limited from failure import Failure from agent_cycle.verdicts import Finished, Interrupt, Judged, QuotedAnswer, TakenIn, Unfinished, Verdict from agent_cycle.interrupt import interrupt, Talked, WorkerSession from transcript_archive.judge_run import JudgeRun from transcript_archive.read import last_spent +from claude_code.reply import Limited from agent_cycle.routing import next_route, step_up, StepUp from transcript_archive import outcomes from model_routing.ladder import ProjectRung, Rung diff --git a/bin/claude_code/test_claude_code.py b/bin/claude_code/test_claude_code.py index 103b55cd..6a14392b 100644 --- a/bin/claude_code/test_claude_code.py +++ b/bin/claude_code/test_claude_code.py @@ -7,9 +7,9 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) +from test_env import assert_not_root from claude_code import entries, reply, session, transcript from failure import Failure -from test_env import assert_not_root def assistant(*parts):