Files
PaperClipAI/packages/adapter-utils
Ethereal49 2e99edf825 fix(adapter-utils): allow summary slot callbacks from sandboxes (#16535)
## Thinking Path

> - Paperclip manages work for companies of AI agents.
> - Remote agents use the sandbox callback bridge to reach the
controller.
> - The built-in Summarizer reads and writes summary slots through that
bridge.
> - The server and bundled skill already provide these routes.
> - The default bridge allowlist rejects all three documented requests.
> - This change admits the exact methods and paths, so remote summaries
can reach the existing server checks.

## Linked Issues or Issue Description

- Fixes:
[#16481](https://github.com/paperclipai/paperclip/issues/16481).
- Related: [#16534](https://github.com/paperclipai/paperclip/pull/16534)
adds a labels read route in the same allowlist.
[#14533](https://github.com/paperclipai/paperclip/pull/14533) changes
SSH attachment queue reads. Neither adds summary-slot routes.
- Related: [#11682](https://github.com/paperclipai/paperclip/pull/11682)
adds routine refresh behavior on the server. This change does not
include that work.

## What Changed

- Add only GET slot, GET slot revisions, and PUT slot to the shared
default allowlist. Each pattern matches the full path.
- Test all three requests through the file queue. Check that the method,
path, query, and JSON body reach the handler. Check that a controller
403 response stays a 403 response.
- Add allowlist checks for both transports and rejection checks for
wrong methods, missing or extra path segments, similar resource names,
and the board-only generate action.

## Verification

- On base `185483e0909246b4609980a0e6e7ad3b8dbad1ba`, the new
regressions fail: all three queue requests return 403 instead of 200.
The allowlist assertion also fails (4 failed).
- PASS: `pnpm exec vitest run
packages/adapter-utils/src/sandbox-callback-bridge.test.ts
packages/adapter-utils/src/http2-bridge-server.test.ts
packages/adapter-utils/src/sandbox-callback-bridge-body.test.ts
packages/adapter-utils/src/execution-target.test.ts` (162 passed).
- PASS: `PAPERCLIP_ENABLE_DARWIN_SSH_ENV_LAB=1 pnpm exec vitest run
packages/adapter-utils/src/ssh-fixture.test.ts` (25 passed, no skips).
- PASS: `pnpm exec vitest run
server/src/__tests__/summary-slot-routes.test.ts
server/src/__tests__/summary-slots.test.ts` (31 passed, no skips). These
tests use the existing routes and an isolated PostgreSQL database. They
cover company access, board write denial, non-Summarizer denial, and
generation task/run checks.
- PASS: `pnpm --filter @paperclipai/adapter-utils typecheck`, `pnpm
--filter @paperclipai/adapter-utils build`, and `git diff --check`.
- Local environment: macOS ARM64, Node 26.11.1, pnpm 9.15.4. The first
server test attempt could not load the plugin SDK. Building the existing
shared/plugin SDK packages resolved that setup failure. One new
mock-call assertion also needed correction because the handler receives
a second context argument; the tests then passed.
- BLOCKED: `pnpm -r typecheck` stops at missing Node types in an
uninstalled workspace. `pnpm test:run` and `pnpm build` stop in
preflight because the CLI workspace's `tsx` is not installed. Their full
test/build bodies did not run. Only the server dependency closure was
installed in this isolated worktree. Disk space was limited and
Rust/cargo was unavailable.
- NOT_RUN: a model-driven SSH Summarizer run against a real Paperclip
instance, full repository gates, PR CI, and Greptile. The queue
handler's test 403 proves response forwarding; it does not prove
controller authorization. The server tests provide separate
authorization evidence.

## Risks

- The bridge now admits three existing summary-slot operations. Server
company access, the summaries feature flag, and the Summarizer task/run
write checks remain in force.
- No schema or request contract changes. POST generate and unrelated
routes stay denied. A real SSH Summarizer run and full CI remain
acceptance limits.

## Model Used

- OpenAI Codex, `gpt-6.1-sol`, `xhigh` reasoning, for implementation and
validation. Read-only assistants used OpenAI `gpt-6-luna` with `max`
reasoning for upstream checks, source inspection, and independent
review. A browser assistant used OpenAI `gpt-6.1-sol` with `medium`
reasoning to prepare the review page. Tools included shell execution,
Git/GitHub APIs, Vitest, TypeScript, and browser interaction. The
context window size is not exposed by this session.

## 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 linked existing issues or described the issue in-PR
- [x] I have not referenced internal/instance-local Paperclip issues or
links
- [x] My branch name describes the change and contains no internal
Paperclip ticket id
- [x] I have run the listed targeted tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have checked the existing API/skill documentation; no request
contract changed
- [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
2026-12-04 23:45:21 -08:00
..

@paperclipai/adapter-utils

Shared utilities for Paperclip adapters: process spawning, environment injection, sandbox/SSH transport, workspace sync, and the round-trip helpers that move code between the local execution-workspace cwd and wherever the agent actually runs.

For the adapter-author guide see docs/adapters/creating-an-adapter.md and the in-repo notes at packages/adapters/AUTHORING.md.

Sandbox bridge deadlines

Command-managed bridge control operations (queue reads, input delivery, setup, and cleanup) have a host-enforced deadline of at most 30 seconds per shell command. A shorter configured timeout still applies. These operations cannot inherit the agent run's hours-long lifetime or wait forever on a provider that ignores its timeout. Long-lived agent session commands keep their own limits.

A control timeout reports a transport failure. It does not prove that the remote command stopped and does not replay an uncertain write. The process session closes failed input delivery and uses its existing shutdown path; normal execution settlement must still verify termination.

Native archive transfer deadlines

Native syncIn and syncOut calls accept an optional minimumTimeoutMs budget. The server validates this budget and extends the worker RPC deadline. Providers can honor this field for file transfers without changing their configuration. Daytona uses the larger of this minimum and its configured timeout. Other providers keep their existing behavior. The minimum is limited to 30 minutes and does not change sandbox lifetimes, stored settings or the timeout for other commands.

The remote-workspace archive path uses the verified capture size for downloads and the local archive size for uploads. Large archives get one second per MiB plus 60 seconds, capped at 30 minutes. Small archives keep the existing provider timeout when that calculation is no greater than five minutes. Archive size, checksum, confinement and host space checks still apply.

An exact retained-sandbox resume keeps its recorded provider timeout and RPC overhead. It uses the normal one-minute fallback only when no timeout was recorded. A five-minute cold restore must not be cut off by that fallback. Resume still targets the recorded allocation and does not acquire a replacement.

No-remote-git contract

The local execution-workspace cwd is the only persistence boundary across runs. No adapter may depend on a git remote for cross-run state.

Adapters that run the agent on a different host should use the SSH round-trip helpers in src/ssh.ts:

  • prepareWorkspaceForSshExecution({ spec, localDir, remoteDir }) — bundles the local cwd (tracked files, dirty edits, untracked additions, and the git history needed to reconstruct it) to remoteDir before the run starts. Runs with no git remote configured.
  • restoreWorkspaceFromSshExecution({ spec, localDir, remoteDir, ... }) — syncs the remote cwd back into localDir after the run, including any new commits the agent created. Also runs with no git remote configured.

prepareRemoteManagedRuntime in src/remote-managed-runtime.ts wraps both calls for adapters that want a per-run remote workspace and an automatic restoreWorkspace() finally hook.

The invariant is pinned by the no-remote-git contract case in src/ssh-fixture.test.ts, which asserts that a remote-only commit propagates to the local worktree through the prepare → restore round-trip with no git remote configured at any point. Do not regress that test.