mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-12 06:10:44 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Workspace migration preserves saved files when a web server becomes replaceable. > - A repository request records intent before any checkout exists. > - Online migration currently requires that request to finish, even when preparation needs credentials and has saved no repository files. > - This pull request preserves that database intent while migrating the existing workspace files. > - Normal admission still owns repository acquisition and authorization after restore. ## Linked Issues or Issue Description **What happened?** Online workspace migration refuses a pending repository request, or a request marked `needs_repair` with `repository_preparation_failed`, even when its contained checkout path does not exist. This can force an unrelated agent turn and credential acquisition before existing files can be preserved. **Expected behavior** Preserve an absent, unpinned repository request unchanged. Migrate the existing files under the normal source locks. Prepare the repository only on a later authorized admission. **Steps to reproduce** 1. Create a task-scoped local workspace with saved files and an absent repository checkout. 2. Keep its repository request pending, or let canonical preparation fail before checkout publication. 3. Attempt online workspace migration. Before this fix, it refuses with `repository_preparation_unresolved`. **Paperclip version or commit** Reproduced against master `8004ad069e`. **Deployment mode** Self-hosted control plane with PostgreSQL and local legacy workspace files. The regression uses real local PostgreSQL and independent filesystem restore. Related migration work: #20371. No duplicate open unmaterialized-request fix was found in the GitHub search. ## What Changed - Accept unchanged pending requests and canonical preparation failures only when no pin or branch exists and the contained checkout path is absent. - Require a proven online source or the existing offline writer-stop contract. - Leave companion workspace requests under their existing strict blocker. Classify the current workspace request with its filesystem check. - Extend existing migration and cold-admission fixtures. Repository rows retain their catalog, requested ref, failure state, timestamps, and identity. ## Verification - RED: the real PostgreSQL/filesystem regression produced two `repository_preparation_unresolved` failures for online pending and failed requests. Offline pending passed. Duration: 24.95 seconds. - Local server TypeScript check passed with Node 24 and pnpm 9.15.4. - GREEN on final head `eeaea6134a56397ca8c12ed8f7009a19c41d79b1`: 18 focused cases passed across the existing migration and cold-admission suites in 77.48 seconds. This covers offline pending intent, online pending/failed intent, active preparation and partial checkout refusals, strict companion requests, publication races, real archive restore, and later normal repository preparation. - The first GREEN attempt reached successful cold preparation, then failed one inherited assertion that expected the old failure code after success. The assertion now expects the canonical owner to clear it. The migration row-equality checks had already passed; no production change was needed for this assertion failure. - Final-head [PR workflow 42723571639](https://github.com/paperclipai/paperclip/actions/runs/42723571639) completed SUCCESS. The [final `ci / verify` gate](https://github.com/paperclipai/paperclip/actions/runs/42723571639/job/129531238991) passed at 2026-11-10 00:08:04 UTC. The full rollup contains 55 successful checks and 4 intentional skips, with no pending or failed checks. Greptile reviewed exact head `eeaea6134a56397ca8c12ed8f7009a19c41d79b1` at 23:52:42 UTC with 5/5, a successful check, and no inline threads. The optional `pnpm verify --explain` selection was invalidated when the assertion commit landed during selection; no verification pass is claimed from it. Focused local tests and required CI supply the verification scope. - The first local test invocation could not resolve the plugin SDK before its local build. It ran no tests. The SDK was then built and the RED regression ran successfully as a failure proof. ## Risks - The failed-request exception is limited to `repository_preparation_failed`. Unknown failures remain blocked. - Active preparation, a pin, a branch, a partial checkout, unsafe paths, and unresolved companion requests still block migration. - Migration does not edit repository intent or grant repository/task access. A restored request can still fail normal preparation if its current authorization or source is unavailable. - Offline migration retains its existing writer-stop and maintenance checks. Online migration retains its source, task, lifecycle, and publication fences. - This patch changes internal migration admission. No schema, public API, user command, or documentation contract changes. ## Model Used OpenAI Codex, GPT-6 family, with reasoning and tool use. The exact serving model ID and context window are not exposed in 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 (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 --------- Co-authored-by: Paperclip <noreply@paperclip.ing>