Skip to content

feat(evals): swap Docker Desktop's store links for copies per eval run - #11274

Merged
kyle-sexton merged 9 commits into
mainfrom
feat/8378-docker-link-swap
Oct 30, 2026
Merged

kyle-sexton merged 9 commits into
mainfrom
feat/8378-docker-link-swap

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Refs: #8378

Summary

On WSL2, Docker Desktop links entries of ~/.docker into /mnt/c, and claude plugin eval then refuses every Bash-granting pass, so /evals:plugin-eval marks the sandbox not-ready and refuses before spending anything. This adds the owner-chosen "swap and restore per run" route as slice 1 of #8378: when the only not-ready cause is those links, preflight offers to run the CLI through a wrapper. The wrapper replaces the links with real copies for the run and puts them back afterwards.

Fix

  • New plugins/evals/skills/plugin-eval/scripts/docker-links.py with two commands: run -- <command> and restore.
    • It swaps every link the preflight's find lists, and the store itself when ~/.docker is a link. It does not use a list of exempt names, because the reading of which names the CLI exempts came from one binary and failed independent verification.
    • Before touching anything, it writes each link's literal value to the manifest ~/.docker-link-swap.json. The manifest also lists the live runs holding the copies, and every change to it happens under an flock on ~/.docker-link-swap.lock.
    • Overlapping runs share one swap: the first run swaps, later runs join, and the last to exit restores. A holder whose pid is gone or was reused is pruned, checked against its /proc start time.
    • It restores the links on exit, on failure, and on SIGINT, SIGTERM or SIGHUP, which it forwards to the child first. After a SIGKILL, a forced stop or a machine sleep, the next run's start restores what was left, and so does restore, which refuses while a live run still holds the copies.
    • It refuses on a dangling link and changes nothing. It never reads or sets DOCKER_CONFIG.
  • SKILL.md: the not-ready route makes the offer, asking first, on WSL2 when the links point under /mnt/. The detail is in reference/sandboxes.md#docker-link-swap, and reference/records.md carries the pointer, as-of date and recheck record.
  • Changelog fragment .changes/evals/ (minor).

Verification

  • The fixture suite docker-links.test.sh ran red first: 7 of 7 failed before the script existed, and 5 of 10 failed before the holder count and the leftover recovery were added. All 10 pass now. Every test uses a temporary HOME, so no real ~/.docker is touched. The tests cover a successful run, a failed run (exit 3 passed through), a SIGTERM interrupt, a killed run followed by the next run's start, a killed run followed by restore, and two overlapping runs that keep the copies until the second exits. They also cover restore refusing under a live run, a dangling link, a linked store root, and a link that Docker Desktop recreated mid-run.
  • Four sabotage checks, each making the named test fail:
    • symlink re-creation removed: 7 tests fail
    • run's restore skipped: 4 tests fail
    • holders ignored at release: the overlap test fails
    • a leftover joined instead of restored: the killed-run test fails
  • scripts/run-ruff.sh check and format --check pass, and pyright reports 0 errors. shellcheck passes on the wrapper, as do check-changelog-fragments.sh --check, check-spoke-plugin-root.sh --check and /skill-quality:check on plugin-eval (PASS at 499 lines). The pre-push check-affected also ran.
  • Left out: a real eval against a host ~/.docker with Docker Desktop's links. That is slice 3's recorded run.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 6 commits October 30, 2026 09:51
On WSL2, Docker Desktop links entries of ~/.docker into /mnt/c, and the
CLI then refuses every Bash-granting eval pass. docker-links.py run
replaces every link the preflight's find lists, or the store itself when
it is a link, with a dereferenced copy of its target, runs the eval, and
restores the links on exit, failure, SIGINT, SIGTERM or SIGHUP. A record
in $HOME lets `restore` recover a killed run, and `swap` refuses while it
exists. DOCKER_CONFIG is never read or set.

The fixture suite runs against a temporary HOME and checks the swap and
restore after a successful run, a failed run, an interrupted run, a
killed run, a dangling link, a linked store root, and a link Docker
Desktop recreated mid-run.

Refs: #8378

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A spoke cannot expand the plugin-root token, so sandboxes.md names
<skill-dir> and the hub renders it. The fixture suite gets its exec bit.

Refs: #8378

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…killed ones

The manifest in $HOME now lists the live runs holding the copies, and
every change to it happens under an flock. The first run swaps, later
runs join, and the last to leave restores. A holder whose pid is gone,
or reused (checked against its /proc start time), is pruned, so the next
run's start restores what a killed run left. `restore` puts the links
back from the manifest and refuses while a live run holds the copies.
The standalone `swap` command is gone.

Tests: a killed run followed by the next run's start, a killed run
followed by `restore`, two overlapping runs keeping the copies until the
second exits, and `restore` refusing under a live run.

Refs: #8378

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the real WSL2 host, features.json links to a /mnt/c file that does
not exist, so the swap refused with exit 2. A dangling link is now
recorded in the manifest with its exact target and `dangling: true`,
removed for the run, and recreated byte-identically at restore. Crash
recovery and the holder count cover it like any other link.

Refs: #8378

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 30, 2026 16:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T16:05:43.974007Z dd50193 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.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 78ed152d423f6d4065438779997b49695f417069: 0 finding(s), 0 as inline comments.

Security review of the incremental change (22d3dff..78ed152) to docker-links.py and test_docker_links.py. I found no security issues.

What changed. The GATE bootstrap now resets SIGPIPE and SIGXFSZ to SIG_DFL just before os.execvp. Python ignores both signals at startup, and an ignored signal survives exec, so the wrapped command would otherwise inherit that. The new test reads SigIgn from /proc/self/status inside the wrapped command and checks that both bits are clear.

Why this carries no security risk.

  • The change only restores default signal dispositions in the child before exec. It adds no new input, path, command construction or privilege change.
  • The manifest handling, flock and link-swap logic are untouched. They were reviewed at 22d3dff.
  • The gate still execs sys.argv[2:] directly, with no shell, so no injection surface is added.
  • The test writes only to the temporary HOME that the suite already uses.

Minor, not security. The GATE signal tuple lists "SIGXFZ", which is not a real signal name. The hasattr guard makes it a harmless no-op, and SIGXFSZ is also listed correctly, so behavior is correct. It looks like a typo that could be dropped.

No trusted-path files are in this incremental change. No manifest items were hit. The owner-threat-model section had no hold removals to name. The pull request description contained no embedded instructions.

critical-findings: 0

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd5019396e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 78ed152d423f6d4065438779997b49695f417069: 0 finding(s), 0 as inline comments.

Incremental review of 78ed152, covering docker-links.py and test_docker_links.py since 22d3dff. I found nothing to flag. I read both files and traced the logic; I did not run the tests.

  • Gate fix (docker-links.py:55-62): Python ignores SIGPIPE and SIGXFSZ at startup, and an ignored signal survives exec. Without the fix, the Docker CLI would inherit both as ignored. The gate now resets them to default just before os.execvp. SIGXFZ is not a real signal name on Linux. It mirrors the list CPython's own restore_signals uses, and the hasattr guard makes it harmless. The gate runs as python -I -c, so import signal is unaffected by the working directory.
  • Test (test_docker_links.py:109-118): the test reads SigIgn from /proc/self/status inside the wrapped command and checks bit sig - 1 for SIGPIPE and SIGXFSZ. The mask arithmetic is right, and signal is already imported. The Path("/proc/self/status") skip guard is appropriate. The test would fail without the gate change, because the gate's own interpreter re-ignores both signals after Popen has restored them.
  • Handled signals: the wrapper's SIGINT, SIGTERM and SIGHUP handlers are Python-level handlers, so exec resets them to default on its own.

The PR's Verification section lists test and lint results that I did not run, so they are author-claimed and unverified. Closing-issue criteria: the PR only references #8378 (Refs:) and does not close it, so I checked no criteria. This change adds no cost and no hold.

The link-swap manifest now records each run's command pid beside the
wrapper's, and a holder stays live while either runs, so restore or a
later run no longer removes the copies under a command whose wrapper
alone was killed. The plugin-eval swap offer now also requires
DOCKER_CONFIG unset, since the swap changes only ~/.docker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 06a5aaadb63da9c235dc89ebf7b299a461501f94; the summary is in this lane's pull request comment.

claude-lane: claude-review

The wrapper recorded the command's pid in the manifest only after Popen
returned, so a wrapper SIGKILLed in that window left a running command
untracked and restore freed the copies under it. The command now starts
behind a small Python gate that waits on a pipe for the wrapper's go
byte, sent only after track(), then execs the command in place, keeping
the recorded pid and start time. EOF (wrapper gone or signalled first)
exits unrun. This also closes the test race where start() could kill
the wrapper before track() ran.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 22d3dff87bdd5650dee69db70e28e1542097c4e6; the summary is in this lane's pull request comment.

claude-lane: claude-review

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM6yGR3j
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

pr-unblock / address-feedback finished round 1 of max 4 on 78ed152.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 5b54fc8 Oct 30, 2026
47 checks passed
@kyle-sexton
kyle-sexton deleted the feat/8378-docker-link-swap branch October 30, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant