mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-20 18:26:40 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Native agent runs execute in a managed sandbox with a fixed disk size > - After a server restart, Paperclip reconnects to the running agent. The reconnect opens a new process session in the sandbox through the sandbox provider plugin > - When the agent filled the sandbox disk, the provider refuses that call with "no space left on device" > - The setup failure path did not recognize this refusal. The run failed as the generic `setup_failed`, and the task showed no useful explanation > - #22239 names `sandbox_disk_full` when the runner reports a full disk during a turn. It does not cover a refusal that reaches the setup failure path > - This pull request names that refusal `sandbox_disk_full` in the setup failure path, and keeps continuation recovery from repeating such a run > - The benefit is that the task tells the user what to do in plain language, and Paperclip does not repeat work that fills the same disk again ## Linked Issues or Issue Description Refs #22239 (names a full sandbox disk during a turn). This PR covers the setup failure path. **What happened?** A native agent ran a large dependency installation in its Daytona sandbox. A server restart then happened. The reconnect could not open a process session. The Daytona plugin returned `JsonRpcCallError` (-32002): `internal server error: failed to create session config directory: mkdir /home/daytona/.daytona/sessions/...: no space left on device`. The run failed with `setup_failed` in the `setup` phase. The Sentry report grouped it with unrelated `setup_failed` plugin errors. **Expected behavior** The run failure names `sandbox_disk_full`. The task shows the existing plain-language action (free disk space through the agent, then press Retry). Automatic retry and generic continuation recovery do not repeat the work on a sandbox of the same size. A full disk on the Paperclip host keeps its own code. **Steps to reproduce** 1. Start a native run in a managed sandbox. 2. Let the agent fill the sandbox disk. 3. Restart the server while the run is active. 4. See the reconnect fail with "no space left on device" and the run fail as `setup_failed`. ## What Changed - `native-sandbox-disk-full.ts`: add `isSandboxProviderDiskFullError`. It is true for the runner's named `sandbox_disk_full` failure, or for a plugin worker error (`JsonRpcCallError`, code `WORKER_ERROR`) whose message reports a full disk. It reads the error, its causes and the first entries of an `AggregateError`. - `run-completion.ts`: the setup failure ladder uses `sandbox_disk_full` for that error before the generic `setup_failed` fallback. Named setup codes and `storage_unavailable` keep their precedence. - `recovery/service.ts`: add `sandbox_disk_full` to the codes that generic continuation recovery does not repeat. `setup_failed` was already in this set, so the new code does not open a new automatic path. This also applies to the turn failures that #22239 names. - Tests for the helper, the setup ladder (with a real database) and the continuation classification. ## Verification - In `server/`: `pnpm vitest run src/services/heartbeat/run-completion.test.ts src/services/native-runtime/native-sandbox-disk-full.test.ts src/services/recovery/provider-failure-classification.test.ts src/__tests__/failed-continuation-continues-again.test.ts src/__tests__/heartbeat-retry-scheduling.test.ts`: 5 files, 312 tests pass. - Red check: without the `run-completion.ts` change, the new setup test fails with `errorCode: "setup_failed"`, the same code as the observed failure. Without the helper and recovery change, the helper and continuation tests fail. - The local layered typecheck could not finish: the sandbox memory limit stopped its largest layer. CI runs the typecheck. ## Risks - Low to medium. The change only renames a setup failure that was already terminal and not retried. It uses an existing code that already has retry and UI handling. - A plugin worker error that reports a full disk on the Paperclip host (not in the sandbox) gets `sandbox_disk_full`. This is unlikely: host storage failures use `storage_unavailable`, which keeps precedence. - Generic continuation recovery no longer repeats a turn failure named `sandbox_disk_full`. This matches the intent of #22239. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), with tool use and code execution. ## 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 - [ ] 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: paperclipbugbot <356415228+paperclipbugbot@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>