Test the digest's cuts, the median pick and gather's refusals, and drop project_rung's checkout parameter

This commit is contained in:
2026-11-21 04:24:52 +01:00
parent 7a568f80af
commit b474ec2f5a
6 changed files with 48 additions and 15 deletions
+11 -11
View File
@@ -7,17 +7,17 @@ import shutil
import subprocess
import typing
from chunk_driver.project.model_choice import read_models_file
from claude_code.reply import Claude, claude_reply, Limited
from failure import Failure
from git_cli import git_repo
from git_cli.git_repo import Git, top
from loop_state.paths import paths_from
from model_routing.ladder import Rung
from model_routing.ladder_file import project_ladder
from review_rules.review_folder import review_folder
from git_cli import git_repo
from task_bench.bench_folder import held
from loop_state.paths import paths_from
from transcript_archive.project_key import project_key
from model_routing.ladder_file import project_ladder
from chunk_driver.project.model_choice import read_models_file
from review_rules.review_folder import review_folder
from model_routing.ladder import Rung
DIGEST = "digest.md"
PROMPT = pathlib.Path(__file__).with_name("gather-prompt.md")
@@ -30,7 +30,7 @@ def gather(env: typing.Mapping[str, str], home: pathlib.Path, claude: Claude) ->
checkout = top(git)
if isinstance(checkout, Failure):
return checkout
rung = project_rung(checkout, home, git)
rung = project_rung(home, git)
if isinstance(rung, Failure):
return rung
with held(pathlib.Path(review_folder(str(home), checkout))) as folder:
@@ -56,9 +56,9 @@ def run_claude(args: list[str], cwd: str, prompt: str) -> subprocess.CompletedPr
return subprocess.run(["claude", *args], capture_output=True, cwd=cwd, input=prompt, text=True)
def project_rung(checkout: str, home: pathlib.Path, git: Git) -> Rung | Failure:
"""The cheapest rung of the model loop-claude runs the project on, on the project's routing ladder."""
common = git("rev-parse", "--path-format=absolute", "--git-common-dir", cwd=checkout)
def project_rung(home: pathlib.Path, git: Git) -> Rung | Failure:
"""The cheapest rung of the model loop-claude runs the project on, on the routing ladder of the project the process runs in."""
common = git("rev-parse", "--path-format=absolute", "--git-common-dir")
if isinstance(common, Failure):
return common
# A worktree's project is its main checkout's, which holds the folder every worktree shares.
@@ -69,7 +69,7 @@ def project_rung(checkout: str, home: pathlib.Path, git: Git) -> Rung | Failure:
return models
if key not in models:
return Failure(f"{saved} names no model for {key}: run loop-claude in the project once, which asks for it.")
ladder = project_ladder(checkout, home)
ladder = project_ladder(None, home)
if isinstance(ladder, Failure):
return ladder
project = ladder.project_rung(models[key])