fix(server): allow slow worktree base fetches to finish #24604
main fromrefs/pull/24604/head·merged by juliusmarminge View on GitHubCreating a worktree could fail while fetching a healthy busy remote because fetch inherited the 30-second command limit. Remote-base fetches now allow five minutes per attempt; a genuinely hung fetch still fails with Git command timed out.
Takeover#
Original fix by @watson in #18537, rebuilt on current main on an origin branch. Kept the fixed five-minute fetch bound and replaced the regression coverage with two TestClock cases. Omitted the unrelated executable-bit fixture change.
Evidence#
Server-only runtime proof from real dev servers, isolated fresh homes, and a local bare remote behind delayed/hung upload-pack. Before: 7fd2e09e38. After: cefc1ace94.
| Fixture | Before | After |
|---|---|---|
| Healthy transport delayed 37s | Timeout at 30.032s; no worktree | Success at 37.278s; worktree HEAD equals fresh remote commit |
| Genuinely hung transport | Baseline timeout demonstrated above | Timeout at 300.052s; clear error, no worktree |
| Deadline regression tests | 163 pass, two expected failures | 165 pass, including pending at 299s and timeout at 300s |
Evidence index and all reproduction scripts. Corrected fixture matrix · Proof audit: SUFFICIENT · Independent replay bundle. Independent replay succeeded in 37.218s with fresh HEAD; all affected rows passed.
Environment: Linux x86_64, Node 26.12.1, Git 2.43.0; real vp run dev, RPC thread launch with remote-base fetch, no browser. No screenshots or pixel diffs apply.
What else changed: the longer fetch uses the existing long-command path outside the short-command semaphore. Retry/fallback logic, other fetch helpers, checkout/removal timeouts, clients, contracts and provider adapters are unchanged. Five minutes bounds each fetch attempt; retry can extend the whole workflow.
Verification log
- Two independent review verdicts: MERGE (GPT-6.1-Sol and Claude Opus 5.5), no confirmed findings.
- Final scoped GitVcsDriverCore suite: 165/165 pass after merging main. Server typecheck passes; targeted lint has no new warnings. Diff whitespace check passes.
- Regression fails against baseline production code; timeout mutation checks also catch an incorrect bound.
- CI at handoff: 17 pending, 4 successful, 0 failing on the published head; bot reviews pending. No merges performed.
- Unverified surfaces: none in the changed scope (server only). No client rendering paths change.
- Implementation/tests: Claude Opus 5.5 through Claude Agent SDK in T3 Code. Review: Claude Opus 5.5 and GPT-6.1-Sol; runtime capture/proof audit and PR lead: GPT-6.1-Sol through Codex in T3 Code.
Original description by @watson
Creating a worktree from origin could time out during a healthy fetch on a busy repository. That fetch inherited the 30-second command limit even though the following checkout allows five minutes.
fetchRemote now uses the same five-minute bound as worktree creation, including its existing ref-lock retry and missing-branch fallback. Slow fetches also stay outside the short-command semaphore, so they do not hold slots needed by status commands. A genuinely hung fetch can now take five minutes to fail.
The regression uses real git and a local bare remote with an Effect test clock: a fetch lasting over 30 seconds succeeds and updates the remote ref. Removing the timeout override reproduces the failure. The existing timeout test still proves that a hung fetch is bounded and not retried.
After merging current main, all 166 GitVcsDriverCore tests, server typecheck, targeted lint and formatting pass at e0882fa. Fresh independent Opus and Sol reviews found no blocking defects.
The broader test run exposed a local executable-bit fixture failure on cups; current main CI already passed that fixture. One checkout-index --force call makes the test file on disk match its staged executable mode, retaining both mode-change assertions. The cause of the environment difference was not identified. A real launch against a slow external remote was not exercised; no UI changes require screenshots.
Explicit maintainer approval of the longer timeout policy remains a landing requirement.
Original fix by @watson in #18537. Maintainer takeover by Claude Opus 5.5 and Claude Fable 5.1 through T3 Code, independently reviewed by Claude Opus 5.5 and GPT-6.1-Sol through the Codex harness.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:needs-julius
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅ Codex Live turn messages 1 1 0 (0.0%) 8 ✅ Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅ Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅ Claude Live turn messages 1 1 0 (0.0%) 8 ✅ Other scenarios#
All 64 scenario measurements match
main.All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling Codex short turn resumeWebSocket decoded10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅ Codex short turn resumeWebSocket messages2 2 0 (0.0%) 2 ✅ Codex long turn running, cold openHTTP decoded281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅ Codex long turn running, cold openrows75 75 0 (0.0%) 75 ✅ Codex long turn running, history pageHTTP decoded92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅ Codex long turn running, history pagerows75 75 0 (0.0%) 75 ✅ Codex long turn finished, cold openHTTP decoded381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅ Codex long turn finished, cold openrows151 151 0 (0.0%) 151 ✅ Codex long turn finished, socket cold openWebSocket decoded381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅ Codex long turn finished, socket cold openWebSocket messages2 2 0 (0.0%) 2 ✅ Codex long turn finished, socket cold openrows151 151 0 (0.0%) 151 ✅ Codex long turn finished, work pageHTTP decoded186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅ Codex long turn finished, work pagerows150 150 0 (0.0%) 150 ✅ Codex idle thread resumeWebSocket decoded65 B 65 B 0 B (0.0%) 200 B ✅ Codex idle thread resumeWebSocket messages1 1 0 (0.0%) 1 ✅ Codex fleet shell snapshotHTTP decoded42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅ Codex fleet shell snapshotrows27 27 0 (0.0%) 27 ✅ Codex fleet shell subscribeWebSocket decoded65 B 65 B 0 B (0.0%) 200 B ✅ Codex fleet shell subscribeWebSocket messages1 1 0 (0.0%) 1 ✅ Codex fleet shell resume checkHTTP decoded18 B 18 B 0 B (0.0%) 100 B ✅ Codex fleet shell resume checkrows0 0 0 0 ✅ Codex stale shell reloadHTTP decoded42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅ Codex stale shell reloadrows27 27 0 (0.0%) 27 ✅ Codex stale shell resumeWebSocket decoded140 B 140 B 0 B (0.0%) 400 B ✅ Codex stale shell resumeWebSocket messages2 2 0 (0.0%) 2 ✅ Codex stale todo list cold openHTTP decoded72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅ Codex stale todo list cold openrows75 75 0 (0.0%) 75 ✅ Codex stale todo list cold opennodes2 2 0 (0.0%) 4 ✅ Codex stale todo list cold opensubagents2 2 0 (0.0%) 4 ✅ Codex stale todo list cold openplans1 1 0 (0.0%) 2 ✅ Codex stale todo list cold openproviderTurns1 1 0 (0.0%) 2 ✅ Codex stale todo list cold opencheckpoints1 1 0 (0.0%) 2 ✅ Claude short turn resumeWebSocket decoded10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅ Claude short turn resumeWebSocket messages2 2 0 (0.0%) 2 ✅ Claude long turn running, cold openHTTP decoded283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅ Claude long turn running, cold openrows75 75 0 (0.0%) 75 ✅ Claude long turn running, history pageHTTP decoded93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅ Claude long turn running, history pagerows75 75 0 (0.0%) 75 ✅ Claude long turn finished, cold openHTTP decoded384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅ Claude long turn finished, cold openrows151 151 0 (0.0%) 151 ✅ Claude long turn finished, socket cold openWebSocket decoded384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅ Claude long turn finished, socket cold openWebSocket messages2 2 0 (0.0%) 2 ✅ Claude long turn finished, socket cold openrows151 151 0 (0.0%) 151 ✅ Claude long turn finished, work pageHTTP decoded188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅ Claude long turn finished, work pagerows150 150 0 (0.0%) 150 ✅ Claude idle thread resumeWebSocket decoded66 B 66 B 0 B (0.0%) 200 B ✅ Claude idle thread resumeWebSocket messages1 1 0 (0.0%) 1 ✅ Claude fleet shell snapshotHTTP decoded43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅ Claude fleet shell snapshotrows27 27 0 (0.0%) 27 ✅ Claude fleet shell subscribeWebSocket decoded66 B 66 B 0 B (0.0%) 200 B ✅ Claude fleet shell subscribeWebSocket messages1 1 0 (0.0%) 1 ✅ Claude fleet shell resume checkHTTP decoded18 B 18 B 0 B (0.0%) 100 B ✅ Claude fleet shell resume checkrows0 0 0 0 ✅ Claude stale shell reloadHTTP decoded43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅ Claude stale shell reloadrows27 27 0 (0.0%) 27 ✅ Claude stale shell resumeWebSocket decoded140 B 140 B 0 B (0.0%) 400 B ✅ Claude stale shell resumeWebSocket messages2 2 0 (0.0%) 2 ✅ Claude stale todo list cold openHTTP decoded73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅ Claude stale todo list cold openrows75 75 0 (0.0%) 75 ✅ Claude stale todo list cold opennodes2 2 0 (0.0%) 4 ✅ Claude stale todo list cold opensubagents2 2 0 (0.0%) 4 ✅ Claude stale todo list cold openplans1 1 0 (0.0%) 2 ✅ Claude stale todo list cold openproviderTurns1 1 0 (0.0%) 2 ✅ Claude stale todo list cold opencheckpoints1 1 0 (0.0%) 2 ✅ Baseline:
8247952· PR result:a4652c9· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
No actionable comments were generated in the recent review.
Walkthrough
-
Explicit remote fetches now use a five-minute timeout. A regression test checks that a delayed fetch succeeds and a fetch that remains blocked times out.
Changes: Remote Fetch Timeout
Layer / File(s) Summary Configure and test the fetch timeout
apps/server/src/vcs/GitVcsDriverCore.ts,apps/server/src/vcs/GitVcsDriverCore.test.tsExplicit remote fetches use a five-minute timeout. Tests verify success after 31 seconds and timeout after five minutes. The test also checks that the fetch remains pending at 299 seconds. Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
only21mil
Merge Risk:
Minimal · up toa4652-
This change gives slow but healthy worktree base fetches five minutes to finish instead of 30 seconds, while hung fetches still fail with a timeout error. No concrete merge-blocking risk was found. Worst case, a hung fetch now holds for up to five minutes per attempt before failing.
Pre-merge checks:
4-
Check name Status Explanation Title check The title "fix(server): allow slow worktree base fetches to finish" names the main change. The PR gives remote-base fetches during worktree creation a five-minute per-attempt limit instead of the inhe… Description check The description covers the problem, the change, scope, and verification. It states the problem: worktree creation fails on a healthy busy remote because fetch inherited the 30-second limit. It describ… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title "fix(server): allow slow worktree base fetches to finish" names the main change. The PR gives remote-base fetches during worktree creation a five-minute per-attempt limit instead of the inherited 30-second limit, so healthy slow fetches can complete. It follows the conventional commit style the template asks for. The title is specific and matches the changeset and the PR objectives.
Full details: Description check
-
Explanation
The description covers the problem, the change, scope, and verification. It states the problem: worktree creation fails on a healthy busy remote because fetch inherited the 30-second limit. It describes the fix: remote-base fetches allow five minutes per attempt, and hung fetches still fail. It links the original issue-like PR
#18537and explains why the change is a bug fix. It gives detailed verification with runtime evidence, test counts, and environment details. The template's required sections are present in substance, though the headings differ from the template's exact wording (Problem, Change, Scope, Verification). The description is long and includes extra material such as a takeover narrative, model attributions, and a verification log. These do not block the check.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Usage-based review receipt#
- Mode: Continue automatically
- Reviewed files: 2
- Charged: $0.50
- View usage details
Note
This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: takeover/pr-18537
- File: .coderabbit.config.ts
- Commit: a4652c9
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
649d6a6a-9ffa-4bec-b48b-0ebcbfa62e60
Commits-
Reviewing files that changed from the base of the PR and between cefc1ace94bfe0d9f0bd97655a899fc4eccdffe3 and a4652c9df63b240a2e46d0f8cde839fc17f26930.
Files selected for processing: 2-
apps/server/src/vcs/GitVcsDriverCore.test.tsapps/server/src/vcs/GitVcsDriverCore.ts
Limit details: You’ve used all 10 included reviews currently available.
-
-
This also reproduces on Windows with the existing branch-scoped, no-tags fetch. In a 2026-11-10 server trace, two worktree-provisioning fetches timed out after 32.1 s and 31.3 s. A manual no-op run of the same scoped fetch took 15.3 s, including 9.3 s in the connectivity rev-list. The checkout had 2,294 pack files and 6,760 refs, so the generic 30-second limit had little margin even when there was nothing new to download.
We carried this change in our fork. Both new regression cases failed against the old implementation and passed with the timeout override; all 34 fetch-related driver tests passed on the rebased fork commit. These results support the longer bounded timeout while keeping genuine fetch failures visible. A live launch against a slow external remote was not exercised.
Posted by GPT-6.1-Sol on behalf of Alb11747.
juliusmarminge added labelstakeover:in-progress
Evidence#
Create a synthetic remote with a 37-second upload-pack delay. In the real web app, select New worktree → From main (remote), advance the remote after the background fetch settles, leave origin/main stale, and submit using Replay Showcase. Both sides use fresh databases, Chromium at 1280×800, and light theme. Fixture paths are masked.
Before After 82479522cb a4652c9df6 Fetch fails at 30 seconds; no worktree is created. Fetch completes at 37 seconds; the created worktree's HEAD matches the fresh remote commit. 



Before recording After recording The replay harness disables paid text generation, so the successful run retains its autogenerated branch name and shows a branch-renaming warning.
Not shown:
- The five-minute timeout for a never-completing transport was not exercised; these captures prove the healthy 37-second fetch regression.
juliusmarminge added labelstakeover:ready
juliusmarminge removed labelstakeover:in-progress
juliusmarminge merged this8b30961
juliusmarminge closed this
juliusmarminge removed labelstakeover:ready
Sign in to join this conversation.
Approvability#
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — Remote fetches now have a five-minute timeout instead of 30 seconds, allowing slow worktree-base fetches to complete. This changes default waiting behavior, requiring a human to accept the longer delay for stalled fetches.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).