Files
PaperClipAI/server
DottaandClaude Opus 5.5 f144bdee34 fix(workspaces): name the overlap and missing-Git cases that keep a workspace from moving online (#22718)
## 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
> - A stack moves only when the online pass reports no blockers, so each
blocker must name its exact cause
> - On staging, one stack reports
`workspaces:overlapping_workspace_requires_maintenance` x6 with no
detail code, and two stacks report
`workspaces:source_scope_not_git_source` x33
> - The overlap code has no detail when the workspace does not need a
proven source scope, and `not_git_source` joins two different cases
> - This pull request names how the paths overlap, why the source scope
is unproven, and which of the two Git cases applies
> - The benefit is that the next pass on each blocked stack shows which
rule applies, so the matching fix can follow

## Linked Issues or Issue Description

Refs #22644, #22696

**What happened?**
After repeated online passes on staging (Core 4434d12e), one stack
reports `overlapping_workspace_requires_maintenance` x6 with no
`source_scope_*` code. Two other stacks report
`source_scope_not_git_source` x30 and x3.

**Expected behavior**
Each blocked workspace names the exact cause. An overlap names how the
paths overlap and why the source scope is unproven. A missing Git source
says if the directory has a `.git` entry that is not a repository, or no
repository at all.

**Steps to reproduce**
1. Create a workspace at an unmanaged path, and a second task workspace
in a subfolder of it.
2. Run `inventoryRemoteWorkspaceMigration` online for either workspace.
3. The result has only `overlapping_workspace_requires_maintenance`. It
has no detail and no `sourceScopeUnproven`.

**Why no detail was emitted**
The inventory reported `sourceScopeUnproven` only when the workspace
needs a proven source scope (`requiresOnlineWorkspaceSource`). A non-Git
directory outside the managed roots does not need one. The overlap check
then blocks it, and nothing names the cause.

## What Changed

- `workspaceMigrationLayoutBlockers` returns a state with each overlap:
`same_directory`, `nested_workspace`, `enclosing_workspace` or
`imported_child_unrecorded`. The inventory adds it as
`overlapping_workspace_requires_maintenance:<state>` in `details`. The
online pass already reports details as `workspaces:<reason>:<state>`.
- The inventory now reports `sourceScopeUnproven` also when the
workspace is blocked by an overlap. Example: `ordinary_root_unmanaged`.
- `not_git_source` is now one of two codes:
- `git_marker_not_repository`: the directory has a `.git` entry that is
not a readable repository.
- `git_checkout_missing`: the record says Git (repository URL, branch or
worktree strategy), but the directory has no repository.
- The `reasons` list does not change. No rule changes: every case that
was blocked stays blocked.

## Verification

- Red on `origin/master` (b908678ea3): the four new or changed
assertions fail. The overlap result has no `details` and no
`sourceScopeUnproven`. The Git fragment and the declared Git record
report `not_git_source`.
- Green with the fix: `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/online-durable-data-migration.test.ts
src/services/remote-workspace-migration-concurrency.test.ts`: 5 files,
392 tests passed (embedded PostgreSQL).
- `cd server && pnpm typecheck`: passed.

## Risks

- Low risk. Only names change. The set of blocked workspaces and the
`reasons` list do not change.
- The online pass reports one more deferral key per overlapping
workspace
(`workspaces:overlapping_workspace_requires_maintenance:<state>`). This
is the same form that #22696 uses.

## 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>
2026-11-23 19:42:00 -06:00
..