Keep the rule for which commands reach run-heavy's docker beside that docker in capped_docker.py #420

Merged
lilleman merged 3 commits from item-229 into main 2026-11-08 11:14:35 +01:00
5 changed files with 35 additions and 17 deletions
+3 -10
View File
@@ -5,8 +5,9 @@ import typing
from round_titles import CAP, lacks_counts, RELEASE_REVIEW_CAP
from git_command import commits
from run_heavy.capped_docker import finds_this_docker
from rule_hook.heavy_command import heavy
from shell_command import launched, Simple, tool_name
from shell_command import launched, Simple
from review_folder import REPORTS
from docker_command import unlimited
@@ -162,15 +163,7 @@ def unlimited_container(words: list[str]) -> bool:
docker = launched(words, {"docker"})
if docker is None or not unlimited(docker.arguments):
return False
# On Linux, run-heavy's docker adds the limits a container lacks, where PATH finds it: docker named bare, with PATH left as run-heavy set it.
before = words[:len(words) - len(docker.arguments) - 1]
capped = "run-heavy" in docker.launchers and words[len(before)] == "docker" and not any(resets_path(word) for word in before)
return not capped
def resets_path(word: str) -> bool:
"""Whether a word before docker drops the PATH run-heavy set: a PATH= of its own, env's -i or -u, or sudo or doas, which reset it."""
return word.startswith(("PATH=", "--unset")) or word in ("-i", "--ignore-environment", "-u") or tool_name(word) in ("doas", "sudo")
return not ("run-heavy" in docker.launchers and finds_this_docker(docker.word, docker.before))
def file_breaches(path: str, before: str, added: str, after: str) -> list[Breach]:
+11
View File
@@ -6,6 +6,7 @@ import sys
import typing
from docker_command import capped
from shell_command import tool_name
# The folder run-heavy puts first on its command's PATH, holding the docker that runs main.
PATH_ENTRY = pathlib.Path(__file__).resolve().parent / "path_entry"
@@ -33,3 +34,13 @@ def main(argv: list[str], env: typing.Mapping[str, str]) -> int:
def without_path_entry(path: str) -> str:
"""path less PATH_ENTRY, so the real docker is the one found."""
return os.pathsep.join(entry for entry in path.split(os.pathsep) if pathlib.Path(entry).resolve() != PATH_ENTRY)
def finds_this_docker(word: str, before: list[str]) -> bool:
"""Whether a command's docker is this one, given the word that names docker and the words before it, assuming run-heavy put this docker first on PATH, as it does on Linux. It is where docker is named bare, since a path names a different docker, and no word before it may reset PATH."""
return word == "docker" and not any(resets_path(earlier) for earlier in before)
def resets_path(word: str) -> bool:
"""Whether a word before docker may drop the PATH run-heavy set. It errs towards yes, so that a command it matches must set its own memory limits: it matches a PATH= assignment, -i, --ignore-environment, -u or --unset whichever variable and launcher they belong to, and sudo or doas, which reset PATH."""
return word.startswith(("PATH=", "--unset")) or word in ("-i", "--ignore-environment", "-u") or tool_name(word) in ("doas", "sudo")
+4 -2
View File
@@ -18,9 +18,11 @@ PIECE = re.compile(r"""'[^']*'|"(?:\\.|[^"\\])*"|\\.|(?<![^\s;&|()])#[^\n]*""",
@dataclasses.dataclass(frozen=True)
class Launch:
"""A tool a simple command runs: the launchers it runs through, such as nice and run-heavy, and the words it is given."""
"""A tool a simple command runs: the launchers it runs through, such as nice and run-heavy; the word that names the tool, as written; the words before that word; and the tool's arguments."""
launchers: frozenset[str]
tool: str
word: str
before: list[str]
arguments: list[str]
@@ -107,4 +109,4 @@ def launched(words: list[str], tools: typing.Collection[str]) -> Launch | None:
at = next((i for i, name in enumerate(reachable) if name in tools), None)
if at is None:
return None
return Launch(frozenset(LAUNCHERS.intersection(names[:at])), names[at], words[at + 1:])
return Launch(frozenset(LAUNCHERS.intersection(names[:at])), names[at], words[at], words[:at], words[at + 1:])
+17
View File
@@ -974,3 +974,20 @@ Read most (opens and searches):
- `AGENTS.md` 1
- `CHANGELOG.md` 1
- `bin/claude_code/__init__.py` 1
## Reading cost, chunk 65835030caa6, finished 2026-11-08T10:06:31Z
168681 new input tokens before the first commit.
Read most (opens and searches):
- `bin/chunk_preflight/test_chunk_preflight.py` 6
- `bin/loop_claude/loop/main.py` 5
- `AGENTS.md` 2
- `README.md` 2
- `todo.md` 2
- `CHANGELOG.md` 1
- `bin/chunk_preflight/facts.py` 1
- `bin/chunk_preflight/gathered.py` 1
- `bin/chunk_preflight/main.py` 1
- `bin/loop_claude/cycle/prompts.py` 1
-5
View File
@@ -13,7 +13,6 @@
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 0.7.0 | | question | **Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.** | 1 | 2 | 1 | 2 | 1 | | 0.0 |
| 229 | 0.7.0 | | | **Keep the rule for which commands reach run-heavy's docker beside that docker in `bin/run_heavy/capped_docker.py`, so rule-hook's `docker-run-memory` asks it instead of repeating run-heavy's PATH rules.** | 2 | 1 | 3 | 4 | 2 | code health by 3 | 18.0 |
| 170 | 0.7.0 | | decision | **Re-tune `WORKER_STEPS` and `REVIEW_STEPS` once 50 chunks have shipped under them, from how well L, E and I order their review rounds and 🔴 findings.** | 2 | 2 | 3 | 5 | 2 | 1.1 by 3, 1.4 by 5 | 10.9 |
| 218 | 0.7.0 | 170 | | **Drop `LEGACY_WORKER` from `bin/model_routing/route.py`, so `route_from` reads only JSON worker lines.** | 1 | 2 | 1 | 2 | 1 | code health by 2 | 14.4 |
| 219 | 0.7.0 | | | **Name the project's rung `project` in `bin/judge_replay/main.py`, `bin/subagent_rung/main.py` and `bin/review_replay/main.py`, in place of `anchor`, as `bin/model_routing/ladder.py` and `bin/loop_claude` name it.** | 1 | 1 | 3 | 3 | 2 | code health by 2 | 12.0 |
@@ -87,10 +86,6 @@ It lives under `~/.claude`, which `.gitignore` keeps from the remote, so a lost
The README line covers the bench's transcripts in `workflow-bench/logs/` too (goal 3).
### 229. Keep the rule for which commands reach run-heavy's docker beside that docker in `bin/run_heavy/capped_docker.py`, so rule-hook's `docker-run-memory` asks it instead of repeating run-heavy's PATH rules.
The paired ruling of PR #373 found Locality worse with all four seats, and named `bin/rule_hook/rules.py` `unlimited_container` and `resets_path` first. rule-hook exempts a `docker run` under run-heavy only where run-heavy's docker will run it: docker named bare, with PATH left as run-heavy set it. That knowledge of how `run_heavy/main.py` `capping` puts `PATH_ENTRY` first lives in rule-hook, so a change to run-heavy silently changes what the rule lets through. Move the predicate, with its words-before-docker index arithmetic made plain, next to `PATH_ENTRY`, and have the rule call it. Make the two places easier to read, as the seats named them.
### 170. Re-tune `WORKER_STEPS` and `REVIEW_STEPS` once 50 chunks have shipped under them, from how well L, E and I order their review rounds and 🔴 findings.
`docs/decisions.md` → `routing: one ladder…` calls the steps a first guess. Start this item once 50 chunks have merged since PR #339 set today's steps, each shipping one item scored with L, E and I. By 2026-10-23, 15 had: those of items 117, 126, 122, 207, 130, 154, 186, 66, 121, 213, 137, 212, 214, 210 and 216. Then read `score-outcomes`' rank correlations for L, E and I and the routed-chunks table of `routing-figures.md`, and propose new steps to lilleman, whose call they are.