mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 19:08:33 +01:00
d1680baf8f9aca2a4eae96c73cd71563f85bac94
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0666aff4a4 |
fix(workspaces): clone network repositories blobless in remote sandboxes (#23347)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - A Paperclip Runner task in a Cloud sandbox gets a fresh workspace: the server clones the task's repositories into the sandbox before the agent starts > - The clone is a full clone, so it downloads every historical blob. A full clone of `paperclipai/paperclip` now grows the disk by about 856 MiB > - The Cloud sandbox wraps Git in a storage guard. The guard stops one Git command when the net disk growth gets to 1 GiB, and the growth includes other writers on the same disk > - On hosted staging, the clone now stops with `stage=clone disk=full git=storage_limit exit=75`. Paperclip records `sandbox_disk_full`, the run fails during setup, and the task does not start. This happens more frequently as the repository history grows > - This pull request makes a fresh clone from a network remote blobless (`--filter=blob:none`). The clone gets all commits and trees, but only the file contents that the checkout needs > - Agent commands that the managed GitHub launcher treats as local (`git show`, `git blame`, `git log -p`, checkout) do not ask the credential broker. In a blobless clone they can need to fetch an old blob, which fails for a private repository without credentials. So the launcher now gives these commands the broker credential on demand, at most once per command > - The benefit is that the same clone grows the disk by about 409 MiB and takes less than half the time, so large repositories start again in Cloud sandboxes ## Linked Issues or Issue Description Refs #22848 (classifies the Git storage guard refusal during clone as a full sandbox disk; this PR removes the cause of that refusal for large histories) Refs #22837 (moves a restore off a full reused sandbox; the clone path in this PR is a fresh sandbox, so a new sandbox does not help) **What happened?** On hosted staging, Paperclip Runner runs fail before the agent starts. The run error is `remote_workspace_operation_failed: operation=prepare exit=1; remote_workspace_prepare_failed: stage=clone disk=full git=storage_limit exit=75 program=git` (and the same refusal with `operation=repository` for a secondary repository). The error code is `sandbox_disk_full`. Between 2026-11-27 and 2026-11-30 there were 20 such failures for three different agents. The tasks used fresh workspaces for `paperclipai/paperclip` with `paperclipai/paperclip-cloud` as a secondary repository. **Expected behavior** A fresh sandbox workspace for a large repository starts without hitting the sandbox Git storage budget. **Steps to reproduce** 1. Run `git clone --no-hardlinks https://github.com/paperclipai/paperclip.git` and measure the disk growth. I measured 856 MiB (39 s). 2. Compare with the Cloud sandbox Git storage guard budget: it stops one Git command at 1 GiB of net disk growth, and it counts other writers on the same disk. 3. Run the same clone with `--filter=blob:none`. I measured 409 MiB (17 s). **Paperclip version or commit** `master` at `c737187ec7`. The hosted staging failures were on releases `635ed5a364`, `c49e80da6c`, `629281b1e8`, `e55b475f30` and `bc98abda0c`. **Deployment mode** Hosted Cloud, Paperclip Runner with remote sandbox workspaces. ## What Changed - `server/src/services/remote-workspace-transport.ts`: - The primary workspace clone (`prepareRemoteWorkspaceDirectory`) and the secondary repository clone (`prepareRemoteRepository`) add `--filter=blob:none` when the repository URL is a network remote (`https`, `http`, `ssh`, `git`, or `user@host:path`). - The staged checkout steps after the clone (`checkout_branch`, `checkout_ref`) use the clone's credentials. Checkout of a revision other than the default branch can fetch missing blobs from the origin. Without credentials, that fetch fails for a private repository. The checks after publication still run without credentials. - A local path or `file://` origin stays a full clone. A saved workspace keeps only a promisor remote whose URL works on another machine, so a partial clone of a local origin cannot be saved. - A server that does not support filters ignores the filter and sends a full clone, so the old behavior stays available. - `server/src/services/remote-workspace-transport.test.ts`: a real-subprocess regression with a history-only blob and an origin that is reachable only through the clone credentials. It checks the blobless clone, the fetch of an older revision's files with credentials, the full clone of a local origin, and a save and restore of the blobless clone after the origin is removed. - `packages/adapter-utils/src/github-launcher.ts` (managed `git`/`gh` launcher): a local `git` command (one that does not ask the broker since #17886) now runs with the launcher as `GIT_ASKPASS`, when the launcher has a broker capability and is not anonymous. - Git calls askpass only after every credential helper declines, for example on a lazy fetch of a missing blob from a private repository. Askpass was not used before, so a lazy fetch failed with `could not read Username for 'https://github.com'`. - The launcher answers only prompts for `https://github.com` and `https://www.github.com`. It answers `x-access-token` for the username without the broker. For the password, it asks the broker. - The command's launcher keeps the first broker answer in memory and serves later prompts through a Unix socket in a private (`0700`) temporary directory. So one command asks the broker at most once, however many objects Git fetches. A command that fetches nothing does not ask the broker, as before. If the socket cannot be created, each prompt asks the broker itself. - The recursion guard still rejects every launcher invocation inside an operation, except an askpass prompt inside a local operation (which holds no credential). - I used askpass instead of a URL-scoped `credential.helper`, because a Git wrapper that adds its own `credential.<url>.helper` reset (as the Paperclip tools Git bundle does through `-c include.path`) is applied after the launcher's `GIT_CONFIG_*` entries and would remove the helper. `GIT_ASKPASS` takes priority over any `core.askPass` configuration. - `packages/adapter-utils/src/github-launcher.test.ts`: launcher tests with real Git. A local command runs `git credential fill` three times for a GitHub URL. The test checks that the managed token is returned with one broker request, that `git status` makes no request, that another host gets no answer and no request, and both broker modes (inherited URL and broker file). A second test checks that askpass is set only for local commands of a connected, non-anonymous launcher, and that the recursion guard still rejects other re-entries. - `doc/workspace-storage.md`: a note about the blobless clone. `doc/execution-github-identity.md`: the askpass behavior for local commands. ## Verification - Red: on the unfixed code, the new test fails because the clone downloads the history-only blob (`expected [] to include '<blob>'`). - A second red: with the filter but without credentials for the checkout steps, the test fails with `stage=checkout_ref git=network exit=128`. This proves that the test also covers the private-repository case. - Green: `pnpm --filter @paperclipai/server exec vitest run src/services/remote-workspace-transport.test.ts src/services/remote-workspace-readonly-capture-cause.test.ts src/services/remote-workspace-readonly-inventory-git-guard.test.ts src/services/remote-workspace-restore-disk-full.test.ts` passes (201 tests). - `src/services/remote-workspaces.integration.test.ts`, `remote-workspace-lifecycle.test.ts` and `remote-workspace-migration.test.ts` pass (347 passed, 16 skipped; the integration file skips locally). - `pnpm --filter @paperclipai/server typecheck` passes. - Launcher, red/green: without the launcher change, the 3 new launcher tests fail. With it, `src/github-launcher.test.ts` passes (44 tests). `github-launcher.test.ts`, `github-launcher-environment.test.ts` and `sandbox-callback-bridge.test.ts` in adapter-utils pass (175 tests). `packages/paperclip-runner` `src/drivers/acpx/github-launcher.test.ts` (3) and server `heartbeat-github-launchers.test.ts` (12) pass. `tsc --noEmit` passes in `packages/adapter-utils`. - Launcher, real private repository: I made a blobless clone of a private GitHub repository and ran the generated launcher with a local fake broker that returned a real GitHub token. With the old launcher, `git show <old commit>:README.md` failed with `could not read Username for 'https://github.com': terminal prompts disabled` / `could not fetch <blob> from promisor remote`. With the new launcher, it printed the file with 1 broker request. On a fresh blobless clone, `git log -p -40 -- README.md` (about 150 lazy fetches in the trace) made 1 broker request, and `git status` made 0. - Measurement on a Linux host: a full clone of `paperclipai/paperclip` grows the disk by 856 MiB; a blobless clone grows it by 409 MiB. - Not run: a live Cloud sandbox run. Hosted staging gets this change through the normal automatic deployment. After that deployment, the Sentry case gets a check that new fresh workspaces for this repository start without the refusal. - Local environment note: the tests rewrite the remote URL through `GIT_CONFIG_COUNT`. A Git wrapper first on `PATH` that sets its own `GIT_CONFIG_COUNT` makes the rewrite tests fail, also on `master`. I ran the tests with the system Git first on `PATH`. ## Risks - A blobless clone fetches file contents from the origin when an agent command needs old blobs (for example `git log -p`, `git blame`, or a checkout of another branch). These commands need network access and the run's Git credentials, the same as `git fetch`. The launcher now supplies the credential on demand (one broker request per command that needs it). The Cloud Git storage guard already measures these lazy downloads. - While a local `git` command runs, a process of the same user can read the password from the askpass socket. That user can already get the token with `gh auth token`, so this adds no new access. The token is not written to disk. - A saved workspace of a blobless clone keeps its promisor remote. The existing snapshot capture and restore support this. The new test proves a save and restore after the origin is removed. - Medium-low risk: the clone of a repository on a server without filter support is unchanged (Git ignores the filter). ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), with tool use (shell, 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 - [ ] 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> |
||
|
|
7ef731ec7e |
fix(workspaces): name incompatible project storage when a volume-free server refuses a run (#22398)
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - A volume-free server admits a run only when its task files have
durable storage.
> - A project can keep its task files in plugin storage, such as an
agent-computers plugin. Only environments of that plugin can use that
storage.
> - A task keeps its selected source when it moves to another project.
So the source project's storage still applies after the move.
> - When an agent in a Daytona sandbox got such a task, the volume-free
check refused the run with a generic message. The message said "native
Paperclip Runner with remote workspace storage". The agent already used
native Paperclip Runner.
> - The run ended `setup_failed`. The task offered Retry, but Retry
always failed the same way. Sentry received the refusal as an unexpected
run failure.
> - This pull request finds the real cause with the existing
project-storage compatibility rule. It records the refusal as a
configuration problem that an owner must repair.
> - The benefit is a message that names the storage and the environment,
a task notice with the correct owner action, and no Sentry noise for
this known configuration state.
## Linked Issues or Issue Description
Related: #17552 (a task project and its selected workspace are separate
settings, so a moved task keeps its source).
**What happened?**
On a volume-free server, a task's source project used plugin storage.
The assigned agent used a sandbox environment that cannot use that
storage. Workspace preparation refused the run with "Volume-free servers
require native Paperclip Runner execution with remote workspace
storage." The run failed with `setup_failed`. The task notice told the
user to press Retry. Each retry failed the same way. Sentry received
each refusal as an unexpected run failure.
**Expected behavior**
The refusal names the real cause: the project's workspace storage does
not support the agent's environment. The run fails
`configuration_incomplete`. The task notice tells the owner to use an
agent in a compatible environment, or a source from a project for this
environment. Sentry does not receive this known configuration state.
**Steps to reproduce**
1. Start the server with `PAPERCLIP_EPHEMERAL_SERVER=true`.
2. Create a project whose storage is a plugin workspace provider.
3. Assign a task in that project to a Paperclip Runner agent in a
Daytona sandbox environment.
4. Wake the agent. The run fails `setup_failed` with the generic
volume-free message.
5. Move the task to a project without plugin storage and comment "try
again". The task keeps its source, and the run fails the same way.
**Paperclip version or commit**
Seen on a hosted volume-free staging server. The new regression test
fails on `master` at
|
||
|
|
d6acbf50e6 |
refactor: cut DATABASE.md to setup and schema-change rules (#21700)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - `AGENTS.md` tells every contributor and agent to read `doc/DATABASE.md` before a schema or migration change > - That file grew to 2,611 lines. About 1,950 of them were notes on the tables of one feature, added one pull request at a time > - The setup steps and the migration rules started at line 792, below those notes > - This pull request cuts `doc/DATABASE.md` to 377 lines: setup, and the rules that apply to every schema change > - The benefit is a guide that a person or an agent can read in full before a schema change ## Linked Issues or Issue Description Refs #21670 (the same cleanup for `doc/DEVELOPING.md`). **Issue type** Outdated or confusing documentation. **Where is the issue?** `doc/DATABASE.md` **What's wrong?** The file was 2,611 lines. It opened with a Better Auth upgrade note and 492 lines on task query performance. The schema change workflow started at line 1367. **Suggested fix** Keep database setup and the general rules in `doc/DATABASE.md`. Remove the notes on individual tables. The schema and its tests describe those. ## What Changed - `doc/DATABASE.md` is now 377 lines. It keeps the three database modes, client tuning, the schema change workflow, migration compatibility, the migration authoring checklist, migration snapshots, the rule for retries after a lost connection, transaction-aware work signals, plugin namespaces, and backups. The wording of the kept text is unchanged. - New `doc/database-client-internals.md` holds the response-size diagnostic, the notes on the postgres.js patch, and the transaction memory note. The text is moved without wording changes. - "Experimental remote workspace snapshots" moved to `doc/workspace-storage.md`, which links to it. - "Execution admission accounting" moved to `server/src/modules/README.md`, which links to it. - Deleted about 1,950 lines of notes on one feature each. No other file linked to them. The deleted sections are: Better Auth 1.7.16 upgrade, Durable native provider backups, Workspace cohort admission proofs, Original local Git sources for archived workspaces, Proactive agent chat messages, Persistent case handoffs, Task query performance, Tool profile reads, Execution identity row locks, Remote workspace row locks, Managed adapter settings, Cloud configuration migration receipt, Cloud runtime identity singleton, Unclaimed Cloud warm standby, Native finalization history and idle sleep, Feedback history and idle sleep, Resource membership tables, Decision training snapshot retention, Decision queues and triage provenance, Native runner persistence, Chat communication snapshots, Telegram private draft identities, Attachment upload provenance, Question-response delivery receipts, Secret storage, Persistent agent conversations, Resource lifecycle events, Legacy controller ownership, Agent file persistence and legacy revisions, Large API response snapshots, Runner API response reservations, Internal agent commentary, Agent identity keys and backups, Slack app registration, Slack manager workspace grants, Installed skill packages, Project repository skill synchronization, Task workspace records, Execution recovery query performance, Agent runtime synchronization journal, Retired Pipelines storage, Prompt injection classification, Deferred conversation requests, GitHub inherited review-wait reads, Sandbox creation ownership, Object-backed run evidence, Cloud runtime configuration singleton, Independent accounting and budget evaluation, Standard workspace and Classic opt-in, Project environment rolling compatibility. - Also deleted from kept sections: the subscription-table note and the issue-reference backfill note in the embedded mode section, the HTTP access log note and the per-endpoint retry notes in the connection loss section, and the notes on migrations `0355`, `0313`, and `0314` in the authoring checklist. - `AGENTS.md` now states what `doc/DATABASE.md` is for. ## Verification - A script built the new files by line range from the old file. It asserts the old line count and the first line of each range. - A link check on every changed Markdown file, and on the four files that link to a `DATABASE.md` anchor, found 0 missing files and 0 missing anchors. - `node scripts/check-maps.mjs` passes. - `node --test .github/scripts/tests/*.test.mjs`: 808 pass, 0 fail. - `pnpm verify` was not run. This worktree has no installed dependencies, and the change has no runtime code. ## Risks - The deleted notes were not all read in full before deletion. The decision was by section: a section about one feature's tables, with no inbound link, was deleted. The text stays in git history. - Two deleted sections describe procedures for an operator: the duplicate-account check before the Better Auth 1.7.16 migration, and the secret storage tables. Restore them into a focused doc if operators still need them. - No runtime behavior changes. ## Model Used - Claude Fable 5.2 (`claude-fable-5-2`), Claude Code desktop, with tool use. ## 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 - [ ] 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: Claude Fable 5.2 <noreply@anthropic.com> |
||
|
|
ac114d9479 |
refactor: cut DEVELOPING.md to a setup and workflow guide (#21670)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - `AGENTS.md` tells every contributor and agent to read `doc/DEVELOPING.md` for setup, commands, testing, and worktrees > - That file grew to 5,495 lines. Most of it was notes on how one subsystem behaves, added one pull request at a time > - Readers could not find the commands. Agents also read behavior notes as rules > - This pull request cuts `doc/DEVELOPING.md` to a 660-line setup and workflow guide. It moves the subsystem notes to focused docs > - The benefit is a guide that a person or an agent can read in full, and a clear place for each kind of note ## Linked Issues or Issue Description **Issue type** Outdated or confusing documentation. **Where is the issue?** `doc/DEVELOPING.md` **What's wrong?** The file was 5,495 lines. It opened with 112 lines about case handoffs before it reached Prerequisites. Unrelated sections sat below the "OpenClaw Docker UI One-Command Script" heading. Statements about current behavior read like policy. **Suggested fix** Keep setup, commands, and workflow in `doc/DEVELOPING.md`. Move each subsystem note to a doc for that subsystem. Add an index. ## What Changed - `doc/DEVELOPING.md` is now 660 lines: prerequisites, start dev, health checks, local run, test drive, Docker, instance layout, database, storage, secrets, worktrees, test commands, Storybook, CLI, and an index of the other docs. - 15 new docs hold the moved text without wording changes: `ci-workflows`, `test-infrastructure`, `worktrees`, `hot-restart-deploys`, `heartbeat-internals`, `runner-internals`, `workspace-repositories`, `workspace-storage`, `skills-and-teams-catalog`, `ui-internals`, `case-handoffs`, `chat-connector-development`, `instance-configuration`, `integration-api-notes`, `database-backups`. - "Publish a branch Storybook" moved to `doc/STORYBOOK-DEPLOYMENT.md`. The privacy rollout notes moved to `doc/ISSUE-PRIVACY.md`. - Deleted about 280 lines: the story-by-story Storybook notes, "Agent Artifact Uploads" (a copy of `doc/AGENT-ARTIFACTS.md`), two pointer-only sections, "Workspace feature checks (2026-10-09)", and "Chat and task navigation caching". The test-drive build-lock paragraph is now four lines. - Repointed every inbound link and every script or workflow comment that named a moved section. - `AGENTS.md` now says where a behavior note goes, so the guide does not grow again. ## Verification - A script split the file by line range. It asserts that each of the 5,495 source lines is kept, moved, or dropped exactly one time. - A link check on every changed Markdown file found 0 missing files and 0 missing anchors. - `node scripts/check-maps.mjs` passes. - `node --test .github/scripts/tests/*.test.mjs`: 808 pass, 0 fail. - `node --check` passes on the three scripts with changed comments. - `pnpm verify` was not run. This worktree has no installed dependencies, and the change has no runtime code. ## Risks - Low risk. The change is documentation and comments only. - A link to a moved section from outside this repository will land on the top of `doc/DEVELOPING.md`. - The new docs are not in the audited prose list in `.github/scripts/ci-inputs.mjs`. An edit to one of them runs full CI. An edit to `doc/DEVELOPING.md` does not. This PR does not change that list. ## Model Used - Claude Fable 5.2 (`claude-fable-5-2`), Claude Code desktop, with tool use. ## 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 - [ ] 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: Claude Fable 5.2 <noreply@anthropic.com> |