mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-24 05:47:10 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - A hosted server moves each local workspace to shared storage in bounded online passes while it serves work > - The online pass moves a managed folder with no repository as an ordinary folder: it copies the files under the folder's source locks > - On staging, two stacks keep 33 workspaces blocked with `workspaces:source_scope_not_git_source` > - Those records carry a repository URL or branch, so the ordinary path skips them, but their folder holds no repository, so the Git path refuses them too > - The offline move copies the same folder as files > - This pull request lets the ordinary path prove a managed folder whose records name a repository that is not there > - The benefit is that these workspaces move online exactly as they move offline, with the same fence as every other ordinary folder ## Linked Issues or Issue Description Refs #22644 **What happened?** After repeated online passes on staging (Core4434d12e), one stack reports `source_scope_not_git_source` x30 (29 of them also `overlapping_workspace_requires_maintenance`), and another reports it x3. **Expected behavior** The online move accepts what the offline move accepts for the same data, with a fence that is checked again under lock at publication. Offline copies a folder with no repository as files, whatever its records say about Git. **Steps to reproduce** 1. Create a managed project folder with three task records that point at it. 2. Set `repoUrl` and `branchName` on the records. Do not create a repository in the folder. 3. Run `inventoryRemoteWorkspaceMigration` online. It reports `online_workspace_source_scope_unproven` with `not_git_source`. **Why it is safe** - The source locks come from the folder's physical path, not from the record's Git fields. Writers to the folder take the same project or task lock. - The ordinary capture runs with `requireNoGit`. If a `.git` entry appears during the capture, the capture fails and nothing is published. - The ordinary proof still checks every member: provider, task binding, strategy, status, restoration state, foreign aliases. The publication checks the scope again under lock. - The published source keeps the record's repository URL and base ref, the same as offline. ## What Changed - `explainOnlineOrdinarySource` no longer skips a `local_fs` record because it has `repoUrl` or `branchName`. It still skips such a record when the folder has a `.git` entry, so real checkouts keep the Git path and its cost does not change. - `ordinaryMemberUnproven` accepts a `local_fs` member with `repoUrl` or `branchName`. Non-`local_fs` members are still `ordinary_member_git`. - A member with an unfinished Git cache expiration is now `member_git_expiration_pending` on the ordinary path too. The Git path already refuses it. ## Verification - Rebased onto `origin/master` after #22718 and #22721. Both behaviours are kept: members are compared by physical path (#22721), and a `local_fs` member may carry Git fields when the folder has no repository (this PR). - Red on `origin/master` (b908678ea3): the never-cloned folder reports `not_git_source` and is not eligible. The expiration guard test also reports `not_git_source`. - Green with the fix. The never-cloned folder is eligible, its source is `ordinary` with all three records, and the migration publishes. The published source is `{ kind: "git", repoUrl, ref: "main" }`. The restored archive holds the saved file, and the local folder is unchanged. The member with an unfinished expiration stays blocked with no workspace operation. - `cd server && npx vitest run src/services/remote-workspace-migration.test.ts src/services/remote-workspace-online-source.test.ts src/services/remote-workspace-cohort-migration.test.ts src/services/remote-workspace-migration-concurrency.test.ts src/services/online-durable-data-migration.test.ts src/services/remote-workspace-snapshot-archive.test.ts`: 6 files, 532 tests passed after the rebase (embedded PostgreSQL). - `cd server && pnpm typecheck`: passed. ## Risks - Medium. More folders become movable online. The fence and the capture are the same ones that ordinary folders already use. - A folder with a `.git` entry that is not a repository still goes to the Git path and stays blocked. - A `local_fs` record at an unmanaged folder with no repository now reports `ordinary_root_unmanaged` instead of `git_checkout_missing` (#22718), because the unmanaged root is the reason it stays blocked. A `git_worktree` record in the same state still reports `git_checkout_missing`. The test covers both. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use and 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 - [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 Opus 5.5 <noreply@anthropic.com>