Repository navigation
Closed
Labels
priority/p1-highPriority P1: high-impact work for the next planned milestonescope/reviewMulti-persona code review engine, verification, and findingstype/bugType bug: the code does not do what it must
Milestone
Description
Problem
Since #972 (PR #1063, merged 2026-10-03 06:14Z) every review scanner runs from a fresh temporary working directory (security/base.py:405-412, called for Semgrep from ai/review/pipeline.py:1229). Semgrep 1.178.0 takes its fast path only for a target that is a regular file under its working directory (target_manager.py:716-727 in Semgrep). Every other target starts its own semgrep-core -rpc process (rpc.py:323-345), and that process walks the whole checkout, nested worktrees and repos/ included.
Measured (.data/review-evaluation-20261003-loop-s12-s21.md, section 7):
- Semgrep returned nothing in 11 of 11 reviews since fix(security): a review takes no config, data, contracts, scanner config or probe suppressions from a tree it does not own (#972) #1063: review sessions
20261003-065531…20261003-115921(10 runs at e3ff98c) and20261003-133420(321ecda). Each was killed at 300.07–300.31 s. The last review before fix(security): a review takes no config, data, contracts, scanner config or probe suppressions from a tree it does not own (#972) #1063 (20261003-060647, cwd at the repo root, 328 paths) finished in 284.9 s. - Offline replay with the same Semgrep: 20 files took 4.96 s from the repo root and 242.8 s from outside it; 40 files took 4.03 s against a timeout. With the network cut off: about 5.1 s extra per file. strace shows
semgrep-coremaking 192,577getdents64calls in 100 s. - Not host load: it also timed out at load1 1.65 (session
20261003-112847). Not the file count: the 11 files added since then are 3.4% of the paths. - Lost findings: runAsNonRoot and allowPrivilegeEscalation on the Ollama DaemonSets (2 of the 3 strictly valid defects in session
20261003-060647, fix(k8s): the ollama tier DaemonSets drop privilege escalation and capabilities, use RuntimeDefault seccomp and a read-only root filesystem, and run as non-root where the model directory allows #1060) and config.py:514 (refactor(review): one rulebook for known false positives #770, fix(config): the secrets audit never prints a config line it cannot parse, and an unparsable file is not reported clean #1022). No other producer makes them. - The cause is invisible: review.md and the profile show the scanner as failed with a reason cut at
Command '['semgrep', 'scan', ….
Acceptance criteria
- An isolated Semgrep run names only targets that lie under its working directory, so no per-target
get_targetsRPC runs. A test with a fake runner captures the argv and cwd for a 333-path review and asserts every target is a relative path under the cwd. - fix(security): reviews take config, data, contracts, scanner config and probe suppressions from the tree under review #972 still holds: the working directory contains no config, ignore or rule file from the reviewed tree. A test puts a
.semgrepignore, a.semgrep.ymland a.semgrep/rule in the reviewed tree and shows none reaches the scan; the existing fix(security): reviews take config, data, contracts, scanner config and probe suppressions from the tree under review #972 tests pass unchanged. - No symlink in the reviewed tree makes the scan read outside it.
- Findings carry the reviewed tree's paths and line numbers (mapped back from the working directory), pinned by a test.
- A scanner timeout reads "timed out after N s" in review.md and the profile, not a truncated command.
- Measured on this tree (recorded in the task file): Semgrep's time for a full branch review's targets with the fix, and whether Bandit, kube-linter, Pluto, Trivy and gitleaks pay any per-target cost from the temporary working directory. If the Semgrep run takes more than half its timeout at the measured host load, the targets are split into batches with their own timeout, so one timeout loses only its batch (the D16 concern from session
20261003-060647); otherwise the measurement is recorded and batching is left out. - Tests are offline and run no real scanner; new tests take well under 1 s together;
uv run devops cipasses. - Pending a person: a branch review of release/v0.2.25 reports Semgrep as ran, with its runtime in the profile and its findings in candidates.json.
Key questions
- How does the scan keep fix(security): reviews take config, data, contracts, scanner config and probe suppressions from the tree under review #972's isolation with targets under its working directory? Proposed: materialize the selected target files into the temporary working directory under their relative paths (hard links on the same filesystem, else copies;
shutil/os.link, never following a symlink out of the tree), run Semgrep there with devops-cli's own config and ignore files as today, and map result paths back. Only the targets are materialized, so no config or ignore file from the tree can be read. - Why not run from the reviewed tree's root with flags that ignore its config? Proposed: rejected; it reopens the tree's
.semgrepignoreand rule discovery that fix(security): reviews take config, data, contracts, scanner config and probe suppressions from the tree under review #972 closed, and depends on flags that change between Semgrep releases. - Does the fix belong in the shared scanner base? Proposed: yes, if the measurement shows another isolated scanner pays a per-target cost; otherwise in the Semgrep wrapper only, with the base keeping one helper for materialized targets so a second scanner can opt in.
- Is this a release fix? Proposed: yes. fix(security): reviews take config, data, contracts, scanner config and probe suppressions from the tree under review #972 shipped the regression in v0.2.25, and it removes a scanner from every review, as fix(k8s): ollama-48gib-slow keeps its embedding model and qwen3-coder loaded and leaves every interactive pool, so a review no longer evicts the embedder #1064 fixed fix(k8s): every ollama tier keeps one model loaded and serves one request at a time, so its kv cache holds one context #1061's regression in the same release.
Strategic alignment
- Milestone v0.2.25, P1 (regression of fix(security): reviews take config, data, contracts, scanner config and probe suppressions from the tree under review #972 in this release).
- Related: fix(review): a review scans a worktree of the reviewed commit, never hands a deleted file to a tool, and reports which files each tool scanned #1047 (a branch review reads the commit it reviews; a materialized commit tree would also satisfy this), fix(review): review.md says why each finding is unverified and what severity it was raised with, and the profile counts the findings the report holds #1046 (truncated reasons in review.md), fix(k8s): the ollama tier DaemonSets drop privilege escalation and capabilities, use RuntimeDefault seccomp and a read-only root filesystem, and run as non-root where the model directory allows #1060, refactor(review): one rulebook for known false positives #770.
- The review redesign keeps the scanner layer, so this fix carries over.
Metadata
Metadata
Assignees
Labels
priority/p1-highPriority P1: high-impact work for the next planned milestonescope/reviewMulti-persona code review engine, verification, and findingstype/bugType bug: the code does not do what it must
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(security): a review's isolated Semgrep scan hands Semgrep only ta…
dan-petty commentedon Oct 3, 2026
Closed by #1091, merged into
release/v0.2.25.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.25 (#1089)
fix(security): the agent scan tools run the scanner adapters and repo…