mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 11:47:42 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Paperclip can keep a task's workspace in remote storage. Only a Paperclip Runner agent in a sandbox environment, or a supported agent in an SSH environment, can restore and save that workspace. > - An agent can move to another environment, for example from a sandbox to a plugin computer. Its tasks keep their saved remote workspaces. > - When such a task woke, workspace preparation threw a bare 409: "This workspace requires a supported remote execution environment." The run ended `setup_failed`. The task offered Retry, and each Retry failed the same way. Sentry received each refusal as an unexpected run failure. > - This is a known configuration state that only an owner can repair, like the project-storage mismatch from #22398. > - This pull request refuses that run as `configuration_incomplete` with a named reason, and it tells the owner what to do. > - The benefit is an actionable task notice, no Retry loop, and no Sentry noise for this state. ## Linked Issues or Issue Description Refs #22398 (the same treatment for a source project's storage that the environment cannot serve). Refs #23568 (that change gave this refusal its own run-failure group, so it became visible as a separate error). **What happened?** A task's workspace was saved in remote storage by an agent in a Daytona sandbox. The agent was later moved to a plugin computer environment. An automatic wake on the task failed setup with "This workspace requires a supported remote execution environment." The run ended `setup_failed`. The task notice said to press Retry. Retry cannot help, because the agent's environment still cannot use the saved workspace. Sentry received the refusal as an unexpected run failure. **Expected behavior** The refusal names the cause: the saved workspace is in remote storage, and the agent's environment cannot use it. The run fails `configuration_incomplete`. The task notice tells the owner to assign the task to an agent that can use the saved workspace, or to change the agent's environment. Sentry does not receive this known configuration state. The saved workspace stays unchanged. **Steps to reproduce** 1. Save a task workspace in remote storage with a Paperclip Runner agent in a sandbox environment. 2. Change the agent's environment to a plugin computer (or assign the task to an agent in another environment). 3. Wake the agent on the task. The run fails `setup_failed` with the bare 409 message. **Paperclip version or commit** Seen on hosted staging. The new regression tests fail on `master` atfc09515c7eand pass with this change. ## What Changed - `remote-workspaces.ts`: extract `supportsRemoteWorkspaceExecution(adapterType, driver)`. `shouldUseRemoteWorkspaces` uses it. Its own behavior is unchanged. - `workspace-preparation.ts`: when the task's existing workspace has remote authority and the selected executor cannot use it, preparation throws `ConfigurationIncompleteFailure` with reason `remote_workspace_environment_incompatible`. This happens before workspace resolution and environment acquisition. The payload records the workspace, environment, driver, adapter, a stable fingerprint, and the agent runtime action URL. Controller-only runs keep their existing path. - `run-failure-report.ts`: the exact pre-dispatch outcome is skipped, together with `project_storage_environment_incompatible`. A marker after provider work started, during execution, under another error code, or outside the setup report is still reported. `PAPERCLIP_SENTRY_RUN_FAILURES=all` still reports it. - `stranded-notice.ts` and `recovery/service.ts`: the task notice and the recovery next action name the owner action. Before this change, the unknown reason fell back to the "missing secret" text. - `doc/workspace-storage.md`: describe the new outcome. ## Verification - Red before the fix, green after (red captured onfc09515c7ewith only the tests applied): - `server/src/services/heartbeat/workspace-preparation.test.ts` › "names a remote-storage workspace that the agent's environment cannot use as an owner configuration gap". Before: the run failed with the bare 409 "This workspace requires a supported remote execution environment." After: `configuration_incomplete` with the named reason and payload. The test also confirms that no workspace is resolved, no environment is acquired, the saved remote authority is unchanged, and the task keeps its workspace binding. - `server/src/services/__tests__/run-failure-report-remote-workspace-environment.test.ts` › "keeps a remote workspace the agent's environment cannot use on the task before dispatch". Before: Sentry received the run. - `server/src/services/recovery/stranded-notice-remote-workspace-environment.test.ts`. Before: the notice said that a secret was missing. - Safety cases (pass before and after): 11 marker variants are still reported (other status, `setup_failed`, executing stage, exit code, signal, no bootstrap marker, provider work started, other reason, no setup phase, execute phase, `all` mode). The existing remote-workspaces integration cases "preserves enrolled workspaces after disabling enrollment and rejects a legacy writer" and "keeps enrollment conditional…" pass. The full `workspace-preparation.test.ts` (161 tests) passes, including the sandbox enrollment paths. - Commands (local, Node 24.23, embedded Postgres): - `pnpm exec vitest run src/services/recovery/stranded-notice-remote-workspace-environment.test.ts src/services/__tests__/run-failure-report-remote-workspace-environment.test.ts src/services/__tests__/run-failure-report-project-access.test.ts src/services/heartbeat/workspace-preparation.test.ts src/__tests__/run-failure-sentry.test.ts` (server) - `pnpm exec vitest run src/services/remote-workspaces.integration.test.ts -t "preserves enrolled workspaces|keeps enrollment conditional"` (server) - `PAPERCLIP_TYPECHECK_LOW_MEMORY=1 pnpm --filter @paperclipai/server typecheck` (passed) - `pnpm verify` selected a broad plan because a doc changed. Required CI supplies the broad coverage. ## Risks - Low risk. The new path runs only where `shouldUseRemoteWorkspaces` already threw. No run that started before can fail now. - For those refused runs, only the failure code, the message, the notice, and the Sentry decision change. - The saved remote workspace and the task's binding are not changed. The owner still chooses a compatible agent or environment. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use and code execution in a sandboxed workspace. ## 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 - [ ] 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>