Files
PaperClipAI/server
Eduardo Vasconcelosandcommitperclip[bot] 3346a95af8 fix(adapters): mount skill sources in the local workspace sandbox (#14340)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - `claude_local` and `codex_local` can confine a run with the local
bwrap sandbox (`filesystemScope: "workspace"`)
> - The adapters give the agent its skills as symlinks (in the prompt
bundle, or in `CODEX_HOME/skills`) to the skill source under the
Paperclip instance skills directory
> - The sandbox mounts the bundle and `CODEX_HOME`, but not the link
targets, so every link dangles
> - The agent sees no skill, not even the built-in `paperclip` skill,
and the run gives no warning
> - This pull request mounts each linked skill source read-only in the
sandbox
> - The benefit is that confined agents get the skills that the board
assigned to them

## Linked Issues or Issue Description

No issue exists. Description:

**What happened?**
A `claude_local` agent with `filesystemScope: "workspace"` and assigned
skills ran without skills. Inside the sandbox, `.claude/skills/<skill>`
in the `--add-dir` bundle was a dangling symlink to
`~/.paperclip/instances/default/skills/<company>/__runtime_cache_v1__/…`
(company skills) and to `…/@paperclipai/server/skills` (built-in
skills). `codex_local` had the same problem with `CODEX_HOME/skills`.

**Expected behavior**
The agent reads every desired skill inside the sandbox.

**Steps to reproduce**
1. Create a `claude_local` or `codex_local` agent with `filesystemScope:
"workspace"` and one company skill.
2. Run it and ask it to list its skills, or run `ls -L` on the skills
directory inside the run.
3. The links do not resolve. The workaround is to add both directories
to `filesystemExtraPaths` by hand.

**Paperclip version or commit**
Seen on 2026.916.1, reproduced on `master` at 0f14d2612.

## What Changed

- `claude_local`: adds each mounted skill source to `managedPaths` as
`ro`.
- `codex_local`: mounts, read-only, the Paperclip source of each desired
skill. It does not mount what a `CODEX_HOME/skills/<name>` link resolves
to, because `CODEX_HOME` is writable in the sandbox and that target is
agent-controlled. When injection keeps a live link that resolves
elsewhere, the run logs a warning naming the skill.
- Tests in `claude-local-execute.test.ts` and
`codex-local-execute.test.ts` use a fake `bwrap` that records its argv
and check that each link target has a `--ro-bind`.
- A Bubblewrap confinement test reads the Claude bundle link from inside
a real sandbox. Like the adapter-utils sandbox integration test, it runs
when `PAPERCLIP_TEST_BWRAP` is set.
- `codex-local-execute.test.ts` checks the `bwrap` argv: a preserved
link to a host directory is not bound, a warning is logged, and the
Paperclip source is still bound. It runs in CI.

## Verification

- `cd server && npx vitest run
src/__tests__/claude-local-execute.test.ts
src/__tests__/codex-local-execute.test.ts
src/__tests__/codex-local-skill-injection.test.ts` passes (57 tests, 1
skipped without `PAPERCLIP_TEST_BWRAP`). With `PAPERCLIP_TEST_BWRAP`
set, all 58 pass.
- The argv test fails without the change (the host directory got a
`--ro-bind`). The Claude confinement test fails when the source mount is
removed.
- `tsc --noEmit` is clean for both adapter packages.
- Manual: on Ubuntu with bwrap, Claude and Codex agents loaded their
skills after I added the same paths through `filesystemExtraPaths`. This
change mounts those paths automatically.

## Risks

- Low risk. The mounts are read-only, and they contain only the skills
that the agent already gets through the links.
- Runs without a sandbox do not change.
- A custom link that an operator keeps in `CODEX_HOME/skills` and that
points outside the Paperclip skill sources is not readable inside a
workspace sandbox. The run logs a warning; add the directory through
`filesystemExtraPaths` if that link must work.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`, Anthropic), in Claude Code with
tool use (shell, file edit). A human reviewed the change.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com>
2026-12-04 17:48:01 -08:00
..