Files
PaperClipAI/server
DottaandClaude Opus 5.5 ec94e43c4a test(server): budget the 130 MB isolated re-home test for its data volume (#19400)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Isolated repository re-home moves a task workspace onto the shared
project clone, so the private clone can be deleted
> - One re-home test moves two 65 MiB files on purpose, to prove that
large changes still move
> - On CI this test times out at the 15000 ms default in pull requests
that do not touch re-home
> - The test does a fixed, large amount of CPU work, and a loaded runner
cannot finish it in 15 seconds
> - This pull request gives that one test a 60000 ms budget that matches
its data volume
> - The benefit is a stable server shard, with no change to what the
test proves

## Linked Issues or Issue Description

**What happened?**

A survey of failed `PR` workflow runs found intermittent failures of one
test in pull requests that do not touch re-home:

```
FAIL src/__tests__/isolated-repository-rehome.test.ts > isolated repository source re-home > re-homes a workspace whose changes exceed the default restore point limits
Error: Test timed out in 15000ms.
```

Examples: jobs 127465954304, 127499682176, and 127538360101 (shard
`general-server-without-chat` 7/12). The survey counted 4 such failures.
The other 27 tests in the file passed in each of these runs.

**Expected behavior**

The test passes on every run, and it still proves that a 65 MiB
untracked file and a 65 MiB saved ignored file move with an exact
snapshot match.

**Steps to reproduce**

Run the unchanged test on master while the CPU is oversubscribed:

```sh
cd server
node load.mjs 72 pnpm exec vitest run src/__tests__/isolated-repository-rehome.test.ts -t 'exceed the default' --reporter=verbose
```

`load.mjs` starts 72 busy-loop Node processes (4 per core on an 18-core
machine) and runs the command. The test fails with `Test timed out in
15000ms`.

**Root cause**

The file sizes are part of the test contract. #17410 added the test to
prove two fixes that only show above 64 MiB: `applyRestorePoint` streams
`git diff --binary` into `git apply`, and the ignored-file read sizes
its buffer from the tree. So the files cannot get smaller.

Each full pass over the workspace writes both files into a Git object
store, so it hashes and deflates 130 MB. One test run makes about eight
passes: the test's `before` snapshot, the re-home `before` snapshot, the
capture, the import into the shared clone, the apply, the two
verification snapshots, and the test's final snapshot. That is about 1
GB of SHA-1 and zlib work, plus the byte comparison.

I timed the phases with the re-home hooks on an idle machine: snapshot
0.6 s each, capture and import 1.9 s, worktree add and apply 0.9 s,
verification 1.0 s. With 2 busy processes per core the same phases took
1.3 s, 3.9 s, 1.3 s, and 2.1 s. The work is CPU-bound and scales with
load. No phase waits on a timer, a lock, or a background task. The 15000
ms default is the cause.

## What Changed

- Give `re-homes a workspace whose changes exceed the default restore
point limits` an explicit 60000 ms test budget.
- No other test changes. No production changes. No retries, no skips.

## Verification

Red, on master, 72 busy-loop processes:

```
× ... re-homes a workspace whose changes exceed the default restore point limits
  → Test timed out in 15000ms.
```

Green, with this change, same load:

```
✓ ... re-homes a workspace whose changes exceed the default restore point limits 30414ms
```

So the test needs about 30 s at 4 processes per core, which is half of
the new budget. A hung re-home still fails inside 60 s.

Full file, idle: 28/28 tests pass.

```sh
cd server
pnpm exec vitest run src/__tests__/isolated-repository-rehome.test.ts
```

## Risks

- Low risk. One test budget changes.
- A real slowdown in the re-home path of up to 4 times would no longer
fail this test. Other tests in the file keep the 15000 ms default.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude
Code with tool use (shell, file edits) and extended reasoning.

## 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 22:31:00 -06:00
..