Files
PaperClipAI/tests
7838a12f5c fix(runner): upgrade Pi to 1.7.0 for the undici and minimatch security fixes (#23430)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The experimental Paperclip Runner runs Pi from a pinned,
hash-verified distribution.
> - That distribution pins Pi 1.0.0, which installs undici 8.10.2.
> - undici 8.12.4 fixes six advisories, including GHSA-mqg3-3v4r-cm32
(high).
> - Dependabot cannot do this upgrade. The pins feed
`PI_DISTRIBUTION_PINS`, the closure pins and the ACPX `commandDigest`,
so a Dependabot change fails CI (#22711, #18998).
> - This pull request upgrades Pi to 1.7.0 by hand under
`rules/acpx-profile-identity.mdc`.
> - The benefit is a Pi runtime with the undici security fixes and an
unchanged trust model.

## Linked Issues or Issue Description

Supersedes #22711. Supersedes #18998.

**What is the problem?**
The Runner Pi distribution installs undici 8.10.2. undici 8.12.4 fixes
GHSA-mqg3-3v4r-cm32, GHSA-7xg3-fphp-28hg, GHSA-5rm8-gv32-r954,
GHSA-9v6h-8rgp-m69f, GHSA-3g9m-rv3r-w5w2 and GHSA-r4pc-4jcp-7pqc.

**Why can Dependabot not fix it?**
`.github/dependabot.yml` excludes `pi-distribution` on purpose. The
lock, the closure pins and the profile digest must change together.

**What is the fix?**
Upgrade `@earendil-works/pi-coding-agent` from 1.0.0 to 1.7.0, which
pins undici 8.12.4.

## What Changed

- Pin `@earendil-works/pi-coding-agent` 1.7.0. Regenerate
`package-lock.json` with the pinned Node 24.21.0 and its npm 11.19.0.
The lock now has 126 packages and no os/cpu-specific packages.
- Pi 1.6.0 and later do not ship `npm-shrinkwrap.json`. Pi pins
`brace-expansion` 5.0.12 itself. So:
- Remove `patches/brace-expansion@5.0.9.patch` and its setup and build
plumbing.
- Replace the shrinkwrap check in `verifyLockedPiPackageGraph`. Each
dependency that Pi declares must install at exactly that version. Each
`undici` and `brace-expansion` copy in the lock must be the reviewed
release (`PI_DISTRIBUTION_PINS.undici` 8.12.4, `braceExpansion` 5.0.12).
- Pi 1.7.0 (the newest Pi) pins minimatch 11.0.3. That version has
GHSA-cf2h-pxjq-68xw (high), GHSA-hqmv-qgp3-jx75 and GHSA-c859-jr93-m5j4.
Add an npm override to minimatch 11.0.8, the first fixed release.
`PI_SECURITY_OVERRIDES` lets the verifier accept only this override, and
only while Pi pins 11.0.3. A later Pi pin change fails closed and forces
a new review.
- Update the three `PI_DISTRIBUTION_CLOSURE_SHA256` pins. Then
regenerate the ACPX profiles (TypeScript and Rust) with
`generate:acpx-profiles`.
- Keep profile version 37. The `commandDigest` changes with the upstream
release, so saved Pi sessions start fresh. This follows the rule.
- Update the version checks in `pi-installation.ts`, the Rust fixtures
(`PI_ACPX_DIGEST`), the installation-integrity fixtures (the 1.0.0
digest is now the refused prior digest), the tests, the e2e
qualification ID (`pi:0.0.33:1.7.0:openrouter`) and its suite-definition
hashes, and `runner-pi-capabilities.md`.

## Verification

- `node scripts/materialize-pi-distribution.mjs /tmp/out` passes on
linux-x64. It uses the official pinned Node archive and verifies all 126
locked packages and the new closure pin.
- Darwin closure pins: the lock has no platform-specific packages. So
each darwin closure is the linux-x64 closure with that target's pinned
Node executable. I checked this method first: it reproduces all three Pi
1.0.0 pins exactly from a linux-x64 build of master.
- `PAPERCLIP_TEST_PI_RUNTIME_ROOT=<materialized runtime> node --test
test/pi-native-package-contract.test.mjs`: 15/15 pass. The test runs
real Pi 1.7.0 RPC through the owned ACP/MCP bridge (hello, interleaved
tools, provider errors, thinking modes, warm recovery, pending cancel,
path admission, aliased MCP tools).
- `node --test` for the materialize, provision, build-inputs and
attestation scripts: 39/39 pass.
- Vitest: `pi-installation`, `pi-provision`, `native-execution`: 132
pass, 1 skipped. `tests/runner-e2e/pi-controls-evidence.test.ts`: 72/72
pass.
- `generate-acpx-profiles.mjs --check` passes.
- Static review against 1.0.0: `dist/core/tools/path-utils.js` is
byte-identical, the tool `path` schemas are unchanged, and the extension
events that we use still exist. Unknown tools still fail closed.
- Not run locally: Rust tests (no cargo here) and paid live-model
qualification. CI covers Rust. Pi stays a candidate profile.

## Risks

- Saved Pi Runner sessions start fresh after deploy because the
`commandDigest` changes. This is the expected result of an upstream
upgrade.
- Pi 1.0 → 1.7 has upstream behavior changes (for example, the Azure
provider rename to `azure`, and new default models). The Paperclip Pi
bindings do not use `azure-openai-responses`.
- A darwin closure pin can be wrong only if npm installs different bytes
on macOS for a platform-neutral graph. The macOS build checks the pin
and fails closed.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), with tool use and code execution,
in Claude Code.

## 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
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: devinfoley <139239+devinfoley@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 12:09:53 -08:00
..
…