Skip to content

evals: prune kept plugin-eval sandboxes under the eval temp root by age #15112

Description

@kyle-sexton

Problem

Kept claude plugin eval sandboxes are never cleaned up. On one WSL2 host, the run directory the plugin-eval skill uses for TMPDIR ($HOME/.ev, per plugins/evals/skills/plugin-eval/reference/sandboxes.md) had built up 8,180 claude-eval-* sandboxes by 2026-11-10. The oldest was from 2026-11-06, and together they took about 11 GB at the top level alone. Most were nested under per-lane and per-issue subdirectories (lane-1/kept, lane-1/<issue>/<arm>, l3). They were removed by hand.

Each run with --keep-temp (the plugin-eval skill's run command passes it so the validity gate can read traces) leaves a sealed sandbox. The skill's read action removes the sandboxes of the run it reads (sandboxes.md#removing-a-reads-sandboxes). A run that is never read, such as a lane's batch run, an interrupted run, or a run read by hand, leaves its sandboxes indefinitely. The preflight reports leftover_sandboxes only for the temp dir it inspects and removes nothing.

Done when

  • Kept sandboxes under the eval TMPDIR tree have a cleanup rule. For example, a run's start, or the preflight, removes sandboxes older than a set age that no live run holds, recursively under the TMPDIR root it uses.
  • The preflight's leftover_sandboxes counts nested sandboxes too, not only the top level.
  • The rule is stated once in sandboxes.md and reused by any lane that runs evals.

Notes

  • A sandbox's sealed/ directory is mode 000, so removal needs the chmod 700 step sandboxes.md documents; a bare rm -rf fails.
  • No live run held any of the removed sandboxes (none had been modified in the previous two hours, and no plugin eval process was running).

Activity

  1. added
    needs-triage
    on Nov 10, 2026
  2. github-actions commented on Nov 10, 2026

    @github-actions
    Contributor

    Size: Medium
    Complexity: Medium
    Uncertainty: Knowable
    Flags: none
    Blocked by: none
    Blast radius: the plugin-eval skill's sandboxes.md and preflight, plus any lane that runs evals; it deletes local sandboxes under the eval TMPDIR root.
    Reversible: partly; the code change reverts, but deleted sandboxes are not recoverable.
    Open questions: none

    Decision comment (#15112 (comment)):

    Decision recorded.

    Cost decided: none. On 2026-11-23 at about 01:4xZ, the owner cleared this issue's cost hold in the hub session. The hub showed the hold and its options first. The owner's words, verbatim: "Go with recommendations." The recommendation was to reword the two lines with the owner's OK. The charge word "retention" was the only reason for the hold. The work deletes local eval sandboxes under $HOME/.ev to free disk space, and nothing it does bills anyone.

    Admission reads only the title and body, so the body now uses different words with the same meaning. "have no retention" became "are never cleaned up", and "have a retention rule" became "have a cleanup rule". The owner's decision above authorizes that edit.

    Acceptance criteria (unchanged from the body):

    • Kept sandboxes under the eval TMPDIR tree have a cleanup rule: a run's start, or the preflight, removes sandboxes older than a set age that no live run holds, recursively under the TMPDIR root it uses.
    • The preflight's leftover_sandboxes counts nested sandboxes too, not only the top level.
    • The rule is stated once in sandboxes.md and reused by any lane that runs evals.

    This decision settles the open questions. I understood the request as a bounded change: add an age-based cleanup rule for kept eval sandboxes, count nested sandboxes in the preflight, and state the rule once in sandboxes.md. I found no duplicate among the open issues.

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triage
    on Nov 10, 2026
  4. melodic-automation-lanes commented on Nov 10, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: Add one age-based retention rule to sandboxes.md that removes stale kept sandboxes recursively under the eval TMPDIR root, and make preflight's leftover_sandboxes count nested sandboxes.

    Related work

    Open questions

    1. Is the owner reversing the documented rule that age cannot tell a live or kept sandbox from a stale one, so that an age-based removal is allowed?
      RECOMMENDED: Yes, but only for sandboxes under the run's own TMPDIR root (the short run directory such as $HOME/.ev), never a shared /tmp or shared $TMPDIR. Basis: plugins/evals/skills/plugin-eval/reference/sandboxes.md:17-23
    2. Where does removal run: at a run's start, in the preflight, or in a separate explicit step?
      RECOMMENDED: A separate explicit prune step that the run start calls. The preflight keeps its read-only contract and only reports the count. Basis: plugins/evals/skills/plugin-eval/SKILL.md:61
    3. What age threshold, and what test shows that no live run holds a sandbox?
      RECOMMENDED: 24 hours since the last modification anywhere in the sandbox, plus no running claude plugin eval process. The issue's own evidence used 2 hours as the live-run check. Basis: judgment
    4. How is removal confined to safe paths when sandboxes are nested (lane-N/kept, lane-N/<issue>/<arm>)?
      RECOMMENDED: Walk only the eval TMPDIR root with find -type d -name 'claude-eval-*', without following symlinks. Reuse the removal loop's symlink, name and out/ plus sealed/ layout checks and its chmod 700 on sealed/. Replace its direct-child-of-tmp check with a realpath-under-root check. Basis: plugins/evals/skills/plugin-eval/reference/sandboxes.md:36-54
    5. Should the retention rule be a script with a test, or only documented commands in sandboxes.md?
      RECOMMENDED: A small script in plugins/evals/skills/plugin-eval/scripts with a test, so lanes call one command and the rule is stated once in sandboxes.md. Basis: judgment

    Sources read

    • plugins/evals/skills/plugin-eval/reference/sandboxes.md:3-23: the preflight probe uses find -maxdepth 1 and removes nothing. Age and process absence are stated not to tell live runs from kept ones.
    • plugins/evals/skills/plugin-eval/reference/sandboxes.md:25-71: the read action's removal loop accepts only direct children of the tmp realpath, and chmod 700 on sealed/ precedes rm -rf.
    • plugins/evals/skills/plugin-eval/SKILL.md:61: preflight blocks on nothing, removes nothing and prints no removal command.
    • plugins/evals/CHANGELOG.md:7: the preflight cleanup loop was removed because it deleted another session's sandboxes.

    To answer, post a comment that starts with this line:

    **Decision recorded.** <answer>
    

    Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.

  5. changed the title [-]evals: kept plugin-eval sandboxes have no retention and pile up under TMPDIR[/-] [+]evals: prune kept plugin-eval sandboxes under the eval temp root by age[/+] on Nov 17, 2026
  6. kyle-sexton commented on Nov 17, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded. Kept eval sandboxes are pruned by age, only under the run's own eval temp root (option A).

    Question as put to the owner (Q33): "Kept eval sandboxes pile up."

    • A (recommended): age-based pruning under the eval temp root only. It bills nothing.

    No other option was shown. Chosen: A. The owner answered the batch on 2026-11-17, typed in an agent session, verbatim: "Go with recommendations."

    This change bills nothing: it deletes local files on the host that runs the evals and uses no paid service.

    This answers refinement question 1 (yes, age may decide removal, under the run's own eval temp root such as $HOME/.ev, never a shared /tmp or shared $TMPDIR), and adopts the refinement's recommendations for questions 2 to 5.

    Acceptance criteria (superseded 2026-11-22 by the narrowed criteria in the latest done-check comment; kept as history, not checklist items)

    • A prune script in plugins/evals/skills/plugin-eval/scripts/ removes a claude-eval-* sandbox only when nothing in it has changed for 24 hours and no claude plugin eval process is running.
    • The script acts only under the eval temp root it is given: it walks nested directories (lane-N/kept, lane-N/<issue>/<arm> and the like) without following symlinks, refuses any path whose realpath is outside that root, and refuses a root that is /tmp or the shared system temp directory.
    • It reuses the read action's layout checks (name, out/ plus sealed/) and runs chmod 700 on sealed/ before removing.
    • The plugin-eval run start calls the prune script; the preflight stays read-only and removes nothing.
    • The preflight's leftover_sandboxes count includes nested sandboxes, not only find -maxdepth 1.
    • plugins/evals/skills/plugin-eval/reference/sandboxes.md states the age rule once, replacing the line that says age cannot tell kept sandboxes from stale ones, and any lane that runs evals points to it.
    • Tests cover: an old sandbox is removed, a recent one is kept, a symlink out of the root is not followed, a path outside the root is refused, and a nested sandbox is counted by the preflight. CI passes.

    Posted by an agent session.

  7. github-actions commented on Nov 17, 2026

    @github-actions
    Contributor

    A listed human released the issue's Work status hold, so it goes back to intake triage.

  8. github-actions commented on Nov 17, 2026

    @github-actions
    Contributor

    The triage sweep dispatched intake triage for this issue (dispatch 1; 2 runs that reach intake, or 6 dispatches, hand it to a maintainer).

  9. melodic-automation-lanes commented on Nov 17, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane: its title or stated work names a charge (retention), which needs an owner decision. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).

    Reason: cost

  10. 19 remaining items

  11. github-actions commented on Nov 22, 2026

    @github-actions
    Contributor

    A listed human released the issue's Work status hold, so it goes back to intake triage.

  12. kyle-sexton commented on Nov 23, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded.

    Cost decided: none. On 2026-11-23 at about 01:4xZ, the owner cleared this issue's cost hold in the hub session. The hub showed the hold and its options first. The owner's words, verbatim: "Go with recommendations." The recommendation was to reword the two lines with the owner's OK. The charge word "retention" was the only reason for the hold. The work deletes local eval sandboxes under $HOME/.ev to free disk space, and nothing it does bills anyone.

    Admission reads only the title and body, so the body now uses different words with the same meaning. "have no retention" became "are never cleaned up", and "have a retention rule" became "have a cleanup rule". The owner's decision above authorizes that edit.

    Acceptance criteria (unchanged from the body):

    • Kept sandboxes under the eval TMPDIR tree have a cleanup rule: a run's start, or the preflight, removes sandboxes older than a set age that no live run holds, recursively under the TMPDIR root it uses.
    • The preflight's leftover_sandboxes counts nested sandboxes too, not only the top level.
    • The rule is stated once in sandboxes.md and reused by any lane that runs evals.
  13. github-actions commented on Nov 23, 2026

    @github-actions
    Contributor

    A listed human released the issue's Work status hold, so it goes back to intake triage.

  14. melodic-automation-lanes commented on Nov 23, 2026

    @melodic-automation-lanes
    Contributor

    {"v":1,"actor_id":337595936,"title_sha256":"dd179653eb5ac22071e335b6f15365363e3f8efb4b1aef8b99cfddc0d37cd1e4","body_sha256":"44c632a4b00a4cfa1f8baeaaf1c70c70ab5d88cd7d5d67bf26601b8c97f44d20"}

  15. melodic-automation-lanes commented on Nov 23, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: Add a prune script that removes run roots under $HOME/.ev older than 3 days when no process holds them, have the plugin-eval run start call it, and state the 3-day rule once in sandboxes.md beside Stale run roots; the per-run roots, nested leftover counting and run-end removal already shipped in #​17822, so this issue does not redo them.

    Acceptance criteria

    • A prune script exists in plugins/evals/skills/plugin-eval/scripts/ and removes a run root only when it is a real directory (not a symlink) whose realpath is a direct child of realpath $HOME/.ev, it holds at least one claude-eval-* child, nothing in it has changed for 3 days, and no process has a file open under it.
    • The script refuses any other root, including /tmp and the shared system temp directory, printing a skipped line with the reason and removing nothing.
    • The script runs chmod 700 on each sealed/ directory before removing, matching the loop at plugins/evals/skills/plugin-eval/reference/sandboxes.md:121.
    • plugins/evals/skills/plugin-eval/SKILL.md Run step 3 or 5 (SKILL.md:255-279) makes the run start call the prune script, and the preflight section stays read-only and removes nothing.
    • plugins/evals/skills/plugin-eval/reference/sandboxes.md states the 3-day removal rule once, beside the Stale run roots section (sandboxes.md:25), and SKILL.md points to it.
    • A test file next to the script (in the .test.sh or test_.py style used in that directory) passes and shows an old run root is removed.
    • The same test shows a run root newer than 3 days is kept.
    • The same test shows a symlinked run root is not followed and its target is left intact.
    • The same test shows a path outside $HOME/.ev is refused and left intact.
    • The same test shows a run root with a process holding a file open under it is kept.
    • plugins/evals/CHANGELOG.md has an entry for the prune script, and CI passes.

    External state: none

    Sources read

    • plugins/evals/skills/plugin-eval/reference/sandboxes.md:25-45: Stale run roots probe lists roots older than 3 days (-mmin +4320) and nested claude-eval-* counts; preflight removes nothing
    • plugins/evals/skills/plugin-eval/reference/sandboxes.md:101-130: Removing a run root loop with realpath, symlink and claude-eval-* checks plus chmod 700 on sealed/
    • plugins/evals/skills/plugin-eval/SKILL.md:255: run start creates $HOME/.ev/<short-run-id> via mktemp and sets TMPDIR to it
    • plugins/evals/skills/plugin-eval/SKILL.md:279: Run step 5 removes the run root at run end; nothing prunes roots left by a run that died
    • plugins/evals/skills/plugin-eval/scripts: no prune script or prune test exists yet
    • plugins/evals/CHANGELOG.md:13: stale_run_roots already shipped in preflight
    • refine-data/context.json comments 2026-11-22T21:51:51Z: owner's narrowed acceptance criteria (3-day rule, $HOME/.ev only) supersede the earlier ones

    Automated refinement by the lanes App. Admission counts only criteria a listed human wrote: to confirm these, post them as your own comment whose first line is **Decision recorded.**, which sends the issue back through intake.

  16. github-actions commented on Nov 23, 2026

    @github-actions
    Contributor
    No description provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Work status

    needs-triage

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions