Skip to content

fix(evals): stop preflight printing a sandbox glob that deletes other runs - #14807

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/plugin-eval-sandbox-cleanup-scope
Nov 9, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/plugin-eval-sandbox-cleanup-scope

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

No related issue: hub lessons-ledger finding L473 (preflight cleanup glob deletes other runs' sandboxes in a shared TMPDIR)

session: GitHub Support

Summary

/evals:plugin-eval preflight printed for d in <tmp>/claude-eval-*; do chmod 700 "$d" "$d/sealed"; chmod -R u+rwx "$d"; rm -rf "$d"; done whenever leftover sandboxes existed. That loop assumes the temp directory holds only one run's sandboxes. When two sessions shared one TMPDIR, a peer ran the printed loop and deleted the other session's kept sandboxes. Two of them belonged to a run whose validity check had not finished, so that run went INVALID.

Fix

Preflight now prints no removal command. It still reports the leftover count and size from the unchanged read-only probe, and points at the existing "Removing a read's sandboxes" section. That section removes only the sandboxes one results file's tracePaths name, by literal path, through the guarded per-path loop. No second removal mechanism is added.

  • plugins/evals/skills/plugin-eval/reference/sandboxes.md: the glob loop is replaced with why it is unsafe in a shared TMPDIR and a pointer to the per-results-file removal. A run that wrote no results file keeps its sandboxes until the owning session names them by literal path. The Record note no longer says "the per-sandbox loop above".
  • plugins/evals/skills/plugin-eval/SKILL.md: the preflight paragraph that repeated the glob loop now matches.
  • .changes/evals/: a patch fragment.

Rejected option: printing a removal only for sandboxes with no matching claude plugin eval process that are older than a stated age. A --keep-temp sandbox has no process by design while it waits for its read, so that test selects exactly the kept sandboxes that must survive. It also adds a process scan and an age threshold.

Verification

  • markdownlint-cli2 on the three changed files: 0 issues.
  • grep -rln -e 'claude-eval-\*; do' -e 'chmod 700 "$d"' over the repository finds no remaining copy of the glob loop.
  • No case sample or grader asserts the removed text (grep -rn -e 'for d in' -e leftover_sandboxes plugins/evals/evals finds nothing).

Before/after eval (docs/review/skills-and-agents.md:6-8)

Cases: the 16 cases whose prompt names evals:plugin-eval or whose Skill grader's input_match includes plugin-eval, plus the suite's control case. Before is main 7e4d9081, after is this head df95a607; the two plugin trees differ only in skills/plugin-eval/SKILL.md and reference/sandboxes.md. Run locally with claude plugin eval --scaffold --keep-temp --allow-tools Bash Edit Write, sonnet-5-5 judged by opus-5-5, Claude Code 2.1.319.

  • Full set, runs 1: both sides INVALID. On both sides pe-spot-read-before-promote had a with-arm Read of the skill's own reference/iterating.md denied (a harness reach limit inside the plugin dir). main also had a denied ls in va-unknown-timeout-key, and trigger-wsl2-missing-socat where the skill did not fire. None of these is caused by this change.
  • Same remaining case set on both sides, with those 3 cases dropped from both: main VALID, head VALID (run-validity --runs 1 --scaffolded; warnings only: no skill-fired grader on the control case, and 3 cases already at 1.00 without the plugin). With-arm delta per case, head minus main: pe-scaffold-flag +0.33, va-typo-check-trigger -0.50 at runs 1, every other case 0.00.
  • va-typo-check-trigger re-run with --runs 3: main VALID, scores 1.00, 1.00, 0.50 (mean 0.833); head VALID, scores 1.00, 1.00, 1.00 (mean 1.000). Mean delta +0.167. The runs-1 drop was the findings-by-tier judge's noise, which recurred on main.

Result: no case scores lower on this head. Eval cost $8.25 in total.

Related

  • plugins/evals/skills/plugin-eval/reference/sandboxes.md, "Removing a read's sandboxes": the removal preflight now points at. It already forbade a glob over <tmp>/claude-eval-* for this reason.

🤖 Generated with Claude Code

… runs

Preflight printed a cleanup loop over every <tmp>/claude-eval-*
directory. Two sessions sharing one TMPDIR each keep sandboxes there,
so the loop deleted the other run's live or kept sandboxes. Preflight
now reports count and size only and points at the removal by results
file, which removes one run's sandboxes by literal path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 9, 2026 19:06
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-09T19:06:43.031805Z
We couldn’t complete this review. Comment @codex review to try again.
df95a60 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed df95a607962e1051a92b9f082b4bd4af7763e37d: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14807 (head df95a60)

No security issues found.

I read every hunk of all 3 changed files: .changes/evals/fix-plugin-eval-sandbox-cleanup-scope-d804730c.md, plugins/evals/skills/plugin-eval/SKILL.md and plugins/evals/skills/plugin-eval/reference/sandboxes.md. I also read the head copy of sandboxes.md (lines 1-75) to see the section the change now points to.

What changed. Preflight in /evals:plugin-eval no longer prints for d in <tmp>/claude-eval-*; do ... rm -rf "$d"; done for the user to run. When two sessions share a TMPDIR, that glob deleted the other session's sandboxes, both running and kept. Preflight now reports only the leftover count and size, and points at "Removing a read's sandboxes". That section (sandboxes.md#L25-L67) is unchanged. It removes only sandboxes named by one results file's tracePaths, single-quoted by literal path, and checks each one first: not a symlink, a direct child of <tmp> by realpath, named claude-eval-*, and holding out/ and sealed/.

Instruction-surface lens. The diff deletes standing skill text, so I checked it against the register at docs/contracts/instruction-exception-register/README.md, which uses the six Gate 0 classes. The deleted text was not a guardrail. It was the thing that caused the irreversible deletion: a broad rm -rf glob. Removing it narrows what the skill can delete, and nothing in the protected classes loses its check. The removed preflight note that "a directory chmod cannot enter still needs sudo rm -rf" still appears where removal happens (sandboxes.md#L62-L64). The rule "never a glob over <tmp>/claude-eval-*" stays at L59-L60.

Out of scope for this lens. No changed file matches a trusted-path glob. The change touches no trust control, plugin manifest, workflow, token or secret.

Spend, not a finding. The PR description reports $8.25 of eval spend for the before/after runs. That came from prepaid API credit and the change adds no recurring cost.

The PR context contains no embedded instructions aimed at this lane. This was the first review of this PR, so it was not limited to blocking findings.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed df95a607962e1051a92b9f082b4bd4af7763e37d: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every hunk of the 3 changed files: .changes/evals/fix-plugin-eval-sandbox-cleanup-scope-d804730c.md, plugins/evals/skills/plugin-eval/SKILL.md and plugins/evals/skills/plugin-eval/reference/sandboxes.md. I also read the head copy of sandboxes.md and the path-scoped rules whose globs match the changed files.

What changed. Preflight used to print a removal loop over <tmp>/claude-eval-*. It no longer prints any removal command. Instead it reports the count and size and points at "Removing a read's sandboxes", which removes only the sandboxes one results file names, by literal path (sandboxes.md#L17-L23).

Checks:

  • Links and references: the in-file link #removing-a-reads-sandboxes matches the H2 at L25. SKILL.md's #leftover-sandboxes matches the file's H1. "The loop above" at L67 refers to the guarded per-path loop at L53, which is correct.
  • Wording consistency: the Record note no longer calls the deleted glob loop "the loop above". It now cites the per-sandbox chmod 700 in the per-path loop, which matches what that loop does.
  • Leftover copies: I grepped plugins/evals for leftover copies of the glob loop or the old "print the cleanup command" rule. None are left in the skill or its references. The old wording survives only in a historical CHANGELOG.md entry, which is expected.
  • Version bump: the fragment's bump: patch fits a docs and behaviour fix in a skill. No plugin.json or marketplace.json changes, so there are no manifest lines.
  • .claude/rules: skill-bodies-state-current-rules.md and cost-claims.md match the skill files. The new text gives the repository's own sandbox design as its reasoning and restates no volatile upstream detail, and it makes no cost claims. Nothing to report.
  • Closing issue: the PR closes no issue; it cites hub lessons-ledger finding L473. There are no acceptance criteria to check.
  • Trade-off (not a finding): sandboxes from a run that never wrote a results file now have no automatic cleanup path in preflight. The PR states this choice, and its reason, on purpose (sandboxes.md#L65-L67).

Not verified by me. The PR description's markdownlint result, its greps and its before/after eval (VALID on both sides, $8.25 of eval spend) are the author's claims. I had no shell, so I ran none of them.

Prior findings: none; this is the lane's first review of this PR. The PR context contained no embedded instructions aimed at this lane.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 602b134 Nov 9, 2026
92 checks passed
@kyle-sexton
kyle-sexton deleted the fix/plugin-eval-sandbox-cleanup-scope branch November 9, 2026 19:46
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant