Files
PaperClipAI/packages
Nicky LeachandClaude Opus 5.5 5371c83152 fix(runner): bundle the Copilot metadata probe as a standalone entrypoint (#22436)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The Paperclip Runner ships a provider pack with pinned provider
runtimes and small entrypoints
> - Most provider entrypoints, such as the Kimi metadata probe and the
ACPX sidecar, are esbuild bundles that run as one file
> - The Copilot metadata probe is plain `tsc` output that imports
sibling driver modules
> - So an environment that installs only selected provider-pack files
cannot run the Copilot probe
> - This pull request makes the Copilot metadata probe a standalone
verified entrypoint, like the Kimi probe
> - The benefit is that every metadata probe has the same self-contained
shape, and a consumer can ship the probe as one file

## Linked Issues or Issue Description

No public issue exists. This is an enhancement.

**What existing behavior does this improve?**
The Copilot metadata probe entrypoint
(`dist/cli/copilot-metadata-probe.js`, the
`paperclip-runner-copilot-metadata-probe` bin and provider-pack shim).

**Subsystem affected**
Paperclip Runner provider pack build (`packages/paperclip-runner`).

**Current behavior**
The probe is plain `tsc` output. It imports
`../drivers/copilot-metadata-probe.js` and more modules. It fails when a
consumer installs only selected provider-pack artifacts. The Kimi probe
does not have this problem because
`scripts/build-verified-provider-entrypoints.mjs` bundles it.

**Proposed behavior**
The build bundles the Copilot probe into one self-contained file, like
the Kimi probe. The bundle still finds the pinned Copilot assets when it
runs from `dist/cli/`.

**Reason and benefit**
Every metadata probe has the same standalone shape. A consumer can ship
the probe as one file. An alternative was to ship the full
`dist/drivers` tree with the probe, but that keeps the multi-file shape.

**Breaking changes**
None. The bin name, the output path and the probe output do not change.

## What Changed

- `scripts/build-verified-provider-entrypoints.mjs`: add
`copilot-metadata-probe` (source `src/cli/copilot-metadata-probe.ts`,
outputs `dist/cli/copilot-metadata-probe.js` and `.cjs`) with the same
format and flags as `kimi-metadata-probe`. The bundler asserts one
output and only `node:` imports.
- `src/cli/copilot-metadata-probe.ts`: move the top-level `await` into
`main()`. esbuild cannot emit top-level `await` in the CommonJS bundle.
Output and exit codes do not change.
- `src/drivers/acpx/provider-assets-root.ts`: when no package root is
bound, accept the bundled `dist/cli/copilot-metadata-probe.(js|cjs)`
module URL for the `copilot` provider only. This is the same rule the
bundled ACPX sidecar uses. Before this change, the bundle's
`import.meta.url` is the `dist/cli` file, not
`dist/drivers/acpx/copilot-installation.js`, so the module-URL lookup
failed. The bound `PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT` path does not
change.
- Tests: a bundler test that runs both bundles alone in a temporary pack
layout, and an asset-root test for the bundled probe path that also
proves other providers do not get the new path.

## Verification

- `node --test scripts/build-verified-provider-entrypoints.test.mjs` (44
tests, includes the new standalone-run test)
- `pnpm exec vitest run src/drivers/acpx/provider-assets-root.test.ts
src/drivers/copilot-metadata-probe.test.ts
src/drivers/acpx/copilot-installation.test.ts`
- `node --test scripts/kimi-metadata-probe.test.mjs
scripts/provider-pack-executable-shims.test.mjs
test/acpx-codex-package-contract.test.mjs`
- `pnpm exec vitest run
server/src/__tests__/copilot-connection-probe.test.ts`
- `pnpm --filter @paperclipai/paperclip-runner run typecheck:typescript`
- Manual check on darwin-arm64 with the pinned Copilot closure
installed, child process spawn denied by a preload:
- Bundled `.js` and `.cjs`, no bound root: installation verification
passes and the probe reaches the spawn step.
- Same run without the `provider-assets-root.ts` change:
`COPILOT_INSTALLATION_INVALID`.
- Bundled `.js` with `PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT` bound:
installation verification passes.
- `pnpm verify` requires broader coverage (the bundler is a broad
input), so CI supplies it.

## Risks

- Low risk. The bin name, output path and shim do not change. The probe
output and exit codes do not change.
- The new module-URL rule accepts only
`/dist/cli/copilot-metadata-probe.(js|cjs)` and only for `copilot`. It
resolves to the package that holds `dist/cli`, the same as the sidecar
rule.
- The build now also writes `dist/cli/copilot-metadata-probe.cjs`.
Nothing reads it yet.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- Provider: Anthropic Claude
- Model: Claude Opus 5.5 (`claude-opus-5-5`)
- Mode: agentic coding with tool use (shell, file edits, test runs)

## 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
- [x] 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

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

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:09:31 -08:00
..