Repository navigation
Description
Tracking issue
This issue tracks the later parts in the section "Status after v0.2.39". One pull request closes each child issue. No pull request closes this issue. This issue closes when every later part is delivered.
- Part 1, refactor(security): mypy and the review canary start their tools through a ToolExecutor #1978: mypy and the review canary start their tools through a
ToolExecutor. - Part 2, refactor(review): the review orchestrator and the scanners take the reviewed workspace from their caller, and no review or scanner module reads Path.cwd() #2098: the orchestrator takes its workspace through its constructor, and no review or scanner module reads
Path.cwd(). - Part 3, test(review): scanner_fake answers the review scanners through the ToolExecutor fake, not through patched subprocess calls #1982:
scanner_fakeanswers the review scanners through theToolExecutorfake. It waits for fix(security): the agent scan tools run the scanner adapters and report a missing or failed scan as such, not as clean #1435, which moves the agent scan tools onto the scanner adapters and so onto theToolExecutor. - Part 4 (Part D), feat(review): a review runs its tools in the network-less sandbox by default #2096: the review runs its tools in the network-less sandbox by default.
- Part 5, feat(review): the SARIF export of a review carries the ToolRun of each scan under its SARIF 2.1.0 names #1983: the SARIF export carries the
ToolRunof each scan under its SARIF 2.1.0 names. - Part 6, fix(review): the binary digest of a Python review tool names its package, not its launcher script #1984: the binary digest of a Python review tool names its package, not its launcher script.
Order (2026-10-24): #1983, #1984 and #1435 first, as they change no file in common. Then #1982 and #1978, then #2098, then #2096. This issue closes when all of its child issues close.
Problem
Re-scoped on 2026-10-03 as phase P1a of the evidence-first review (#1137). The original scope is kept: the orchestrator takes its workspace, scanners and enrichers instead of reaching for Path.cwd(), so tests inject a temporary workspace and fakes (the slowest review tests spent about 12 of 18 s in stat calls on the real checkout). The executor below is the injection point for tools. The persona-loop engine removal that was part of this item moved to #995 on 2026-10-02.
- Scanners run as plain subprocesses with the parent's environment and network [code: security/base.py:319-325, :357].
- Tests cannot inject scanners, because the orchestrator reads the working directory (feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772).
- HostSandbox has no resource limits. cgroups are not writable in the devcontainer, and kube-linter dies under a 512 MiB address-space limit but runs at 1 GiB [measured: c-feasibility].
Acceptance criteria
- One
ToolExecutorprotocol.- Production uses HostSandbox:
--unshare-all --clearenv, the worktree read-only, a temporary HOME, and databases and rules bound read-only. - Tests inject a fake, and the bwrap argv is asserted.
- Production uses HostSandbox:
- The executor starts processes only through
core/process, building on refactor(cli): one process runner owns execution, process groups and dry-run #775's first stage (fix(security): the async process runner redacts telemetry and kills the process group on timeout #780). It adds no fifth kill-and-timeout implementation. - The orchestrator receives the reviewed workspace (root, listing, reading, sibling and manifest discovery), its scanners and its enrichers through its constructor, and no review module probes
Path.cwd().tests/test_review_pipeline.py::test_review_pipeline_stages,tests/test_review_repos.py::TestReviewReposSubdirectories::test_review_path_summary_in_repos_directoryandtests/test_review_security_tools.py::test_pipeline_multi_scanner_aggregationpass a temporary workspace and fakes, and each runs in under 5 s. - Limits:
- RLIMIT_CPU and a wall-clock timeout for every tool;
- an address-space limit of at least 2 GiB, with
GOMEMLIMITset for Go tools. - No process-count limit (RLIMIT_NPROC counts the user's other processes); this is documented.
- Each ToolRun records: tool, version, binary sha256, config and ruleset digests, the argv template, a digest of the targets, and the commit.
- (person-run) Every pinned tool runs in the sandbox on the loop input with no network.
- Tests run offline with fakes and recorded tool output: no network, no real scanner, no model; each new test runs under 1 s (the three existing pipeline tests named above have the 5 s bound).
-
uv run devops cipasses.
Key questions
- Network for databases? (proposed) Only the separate fetch steps of fix(review): Semgrep runs pinned and offline with metrics off, from a cached registry ruleset plus devops-cli's tested rule pack #1144 and feat(review): dependency advisories and the package inventory come from osv-scanner over the lockfiles, offline, with each advisory's own severity #1146, outside the tool sandbox.
Strategic alignment
- Depends on: feat(review): review tools install from a tools lock with exact versions, binary checksums and hashed Python requirements, and every review records them #1142. Blocks: feat(review): review tools run at the project's declared language and platform versions, and count only after their output on a canary matches the recorded expected output #1143. Related: refactor(cli): one process runner owns execution, process groups and dry-run #775 and fix(security): the async process runner redacts telemetry and kills the process group on timeout #780 (one process runner).
- Parent: feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137 (phase P1a).
- Evidence tags ([measured: …], [code: path:line], [sourced: …], [estimate], [inference]; "S11" is the single review run of 2026-10-03 and "the loop" the ten runs S12–S21; c-feasibility and c-fidelity are the two design critiques) are explained in feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137.
Test design: the review-tool fake (2026-10-07)
The owner decided on 2026-10-07, in the test design #1307, that tests double only process edges, each through one seam, and that every fake ships with a contract suite. This item's ToolExecutor is the seam for the review-tool edge. The fake its tests inject becomes that edge's shared fake.
Acceptance criteria (added).
- Ships the edge's fake under
tests/support/fakes/and its contract suite (fake and real side, the real side against recorded responses or a local tool, never a live service), per the ADR "Tests double only process edges, through seams" that docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308 delivers.
Strategic alignment (added).
- Parent: test(cli): tests double only process edges and mirror the source tree #1307 (phase D), alongside feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137 (phase P1a).
- Depends on (added): test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312. Blocks (added): test(ai): devops review, devops analyze and the devops ai commands are thin adapters tested over the model seam and edge fakes #1326, test(cli): the infra commands are thin adapters tested over edge fakes, with no internal patches or private imports #1327, test(review): ai/review and review/ are tested through one public interface over the model, tool-executor and process fakes, with no mock detection in src #1328, test(mcp): mcp, agent and tool tests run on edge fakes #1330, test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332.
Proposed design
Problem statement
The review pipeline's security scanners run as plain subprocesses with the parent's environment and network access, tests cannot inject scanners because the orchestrator reads the working directory, and the HostSandbox imposes no resource limits. This issue introduces a single ToolExecutor protocol as the injection point for all review tools, runs them inside a network-less bubblewrap sandbox with CPU, memory, and wall-clock limits, and refactors the orchestrator to receive its workspace, scanners, and enrichers through its constructor so tests can substitute fakes and a temporary workspace.
Acceptance criteria
- Criterion 1: A ToolExecutor protocol exists; production uses HostSandbox with --unshare-all --clearenv, the worktree read-only, a temporary HOME, and databases and rules bound read-only; tests inject a fake and assert the bwrap argv.
Verification: A test constructs the production executor, inspects the bwrap argv it would pass, and asserts the flags --unshare-all, --clearenv, read-only bind of the worktree, a tmp HOME, and read-only binds for databases and rules; a separate test injects a fake executor and confirms the orchestrator calls it. - Criterion 2: The executor starts processes only through core/process (building on refactor(cli): one process runner owns execution, process groups and dry-run #775/fix(security): the async process runner redacts telemetry and kills the process group on timeout #780) and adds no fifth kill-and-timeout implementation.
Verification: grep -r 'subprocess.' src/devops_cli/ai/review/ shows no direct subprocess calls outside core/process; a test asserts the executor delegates to the core/process runner and that no new timeout/kill logic is introduced. - Criterion 3: The orchestrator receives the reviewed workspace (root, listing, reading, sibling and manifest discovery), its scanners, and its enrichers through its constructor; no review module probes Path.cwd().
Verification: grep -rn 'Path.cwd()' src/devops_cli/ai/review/ returns no matches; the three named tests (test_review_pipeline_stages, test_review_path_summary_in_repos_directory, test_pipeline_multi_scanner_aggregation) pass a temporary workspace and fakes and each completes in under 5 s. - Criterion 4: RLIMIT_CPU and a wall-clock timeout are applied to every tool; an address-space limit of at least 2 GiB is set with GOMEMLIMIT for Go tools; no RLIMIT_NPROC is applied and this is documented.
Verification: A test asserts the executor sets RLIMIT_CPU, RLIMIT_AS >= 2 GiB, and GOMEMLIMIT in the environment for Go tools; a test asserts RLIMIT_NPROC is not set; the documentation or code comment explains why no process-count limit is used. - Criterion 5: Each ToolRun records: tool name, version, binary sha256, config and ruleset digests, the argv template, a digest of the targets, and the commit.
Verification: A test runs a fake tool through the executor and asserts the returned ToolRun object carries all seven fields with non-empty values. - Criterion 6: Every pinned tool runs in the sandbox on the loop input with no network (person-run verification).
Verification: A person runs each pinned tool (trivy, kube-linter, pluto, popeye, bandit, semgrep, gitleaks, osv-scanner) inside the sandbox against the loop input and confirms no network egress occurs and the tool completes. - Criterion 7: Tests run offline with fakes and recorded tool output: no network, no real scanner, no model; each new test runs under 1 s and the three existing pipeline tests run under 5 s.
Verification: Run the new and modified tests with network disabled (e.g., unshare -n) and assert each new test completes in under 1 s and the three named existing tests complete in under 5 s. - Criterion 8: changelog.d/.md records the change; CHANGELOG.md and docs/ROADMAP.md are not edited.
Verification: git diff --name-only shows changelog.d/772.md added and no changes to CHANGELOG.md or docs/ROADMAP.md. - Criterion 9: uv run devops ci passes.
Verification: Run uv run devops ci in a clean checkout with the change applied and confirm exit code 0. - Criterion 10: The edge's fake ships under tests/support/fakes/ with its contract suite (fake and real side, the real side against recorded responses or a local tool, never a live service), per the ADR 'Tests double only process edges, through seams' that docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308 delivers.
Verification: tests/support/fakes/ contains the ToolExecutor fake; a contract test file exercises both the fake and the real executor against recorded responses; no test in the suite makes a live network call or invokes a real scanner binary.
Key questions
- Network for databases?: Only the separate fetch steps of fix(review): Semgrep runs pinned and offline with metrics off, from a cached registry ruleset plus devops-cli's tested rule pack #1144 and feat(review): dependency advisories and the package inventory come from osv-scanner over the lockfiles, offline, with each advisory's own severity #1146, outside the tool sandbox. (proposed)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Decisions for the last part D (owner, 2026-10-22: follow best practices)
Part D switches the sandboxed executor on as the production default. The survey of 2026-10-22 left two policies open. They are decided here:
- Hosts without bubblewrap fail closed. A review tool that needs the sandbox does not run on a host that cannot make a user namespace. The review reports a coverage gap for that tool with the reason, as it does for files Semgrep did not scan. There is no opt-out flag and no unsandboxed fallback, because an escape that makes a check pass is not a check (the rule "skip checks, do not build escapes"). GitHub-hosted runners that refuse unprivileged user namespaces therefore report the gap.
- popeye runs with the network that it needs and nothing else. popeye reads the cluster API, so it cannot run in a network-less sandbox. The executor has one named profile with the network allowed. Only popeye uses it, and the recorded ToolRun says
network: allowed. Every other tool keeps the network-less profile.
Part D also needs the OSV database and the Trivy database or checks to be fetched before the sandboxed run, because neither tool can fetch them inside the sandbox. That fetch step is part of D. Part D needs its own child issue, as each of the other remaining parts has (see "Tracking issue").
Status after v0.2.39 (owner decision 2026-10-23: the remaining parts come later)
Three parts are merged in v0.2.39:
- Part A (feat(review): add the tool executor seam, its sandbox executor and its fake #1914): the
ToolExecutorseam,SandboxToolExecutor,ToolExecutorFakeand the contract suite. - Part B (feat(review): start the scanners and the review pipeline through the tool executor #1941): the scanners and the review pipeline start their tools through an executor.
DirectToolExecutoris the default. - Part C (feat(review): record each tool run in the review profile and the report #1944): the review keeps the
ToolRunof every scan, shows it in the profile and inreview.md, and names the config and ruleset files of each scan.
The later parts follow. The section "Tracking issue" lists the child issue of each part. One pull request closes each child issue:
- (refactor(security): mypy and the review canary start their tools through a ToolExecutor #1978) mypy and the canary runner take a
ToolExecutor. A request must first name a program that is not a tool of the lock. - (no child issue yet) No review or scanner module probes
Path.cwd(). The three named pipeline tests pass a temporary workspace and fakes and run under 5 s. - (test(review): scanner_fake answers the review scanners through the ToolExecutor fake, not through patched subprocess calls #1982)
scanner_fakeis rebuilt over the executor fake. - (no child issue yet) Part D: the sandboxed executor becomes the production default. The decisions of the section above apply: a host without bubblewrap fails closed, popeye has one named profile with the network, and the fetch step for the OSV and Trivy databases belongs here. Ruff gets a cache directory outside the tree. The sandbox binds the Trivy cache and the osv-scanner database. The ruleset digest of osv-scanner and the Ruff config digest are settled here.
- (feat(review): the SARIF export of a review carries the ToolRun of each scan under its SARIF 2.1.0 names #1983) The SARIF export lists the records with the names of SARIF 2.1.0. A person first decides whether a clean tool gets a run. A record also needs the exit code of the run.
- (fix(review): the binary digest of a Python review tool names its package, not its launcher script #1984) The binary digest of a Python tool names the package and not its launcher script.
Checks only a person can run stay open: every pinned tool in the sandbox on the loop input with no network, and a devops review path comparison of review.md before and after Part C. The Gitleaks command needs --report-path - to print its report. A person decides that point (see the Part B task file).
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]refactor(review): review orchestrator takes its workspace, scanners and enrichers instead of the cwd[/-][+]feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits[/+]23 remaining items
refactor(review): the review orchestrator and the scanners take the r…
feat(review): a review runs its tools in the network-less sandbox by …
feat(review): a review runs its tools in the network-less sandbox by …
feat(review): a review runs its tools in the network-less sandbox by …
dan-petty commentedon Oct 25, 2026
Status, 2026-10-25.
Every child issue of this tracking issue is closed as completed: #1978, #2098, #1982, #2096, #1983 and #1984, and the dependency #1435.
The open points of the section "Status after v0.2.39":
gitleaks dir --report-format json --report-path - --redact <path>. Without--report-path, Gitleaks 8.30.1 writes no report on stdout, so a leak (exit 1) read as a failed scan:devops scan secretson a directory with a GitHub token said "Gitleaks was not run" and exited 0. fix(security): the pluto, popeye and gitleaks adapters read what those tools actually write #1434 already held this defect, and PR fix(security): the pluto, popeye and gitleaks adapters read what those tools actually write #2220 fixes it, with the Popeye and Pluto adapters.devops review path <dir> --static-scan-onlywith the default sandbox and no model. Onsrc/devops_cli/security(37 Python files), Bandit, Semgrep and Gitleaks ran (3 min 10 s). Onk8s/gitea(3 manifests), kube-linter, Pluto, Semgrep and Gitleaks ran (19 s). These inputs did not reach osv-scanner, Trivy, Ruff, mypy, zizmor, golangci-lint or Popeye, and with the reporting stage off no session was kept to read thenetworkfield of each ToolRun. So this check stays with a person. A static-scan-only review of the whole tree (1514 files) did not finish in 30 minutes; about 1.8 s of each Python file goes to a sandboxed Gitleaks run for each file.review.mdcomparison before and after Part C (person-run). Not run.This issue can close when #2220 merges, with the two person-run checks above as the only open points.
dan-petty commentedon Oct 25, 2026
Closed as completed. PR #2220 merged and fixed the last open point that an agent can do, the Gitleaks command. Every child issue is closed.
The two checks that only a person can run stay as written in the comment of 2026-10-25 above: every pinned tool in the sandbox, and the
review.mdcomparison before and after Part C. The cost of one sandboxed Gitleaks run for each file is a separate item.feat(security): devops k8s audit runs Popeye in the tool sandbox with…