Skip to content

fix(server): allow slow worktree base fetches to finish - #24604

Merged
juliusmarminge merged 4 commits into
mainfrom
takeover/pr-18537
Nov 14, 2026
Merged

juliusmarminge merged 4 commits into
mainfrom
takeover/pr-18537

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Creating 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.

juliusmarminge and others added 3 commits October 24, 2026 23:17
A healthy fetch before creating a worktree must survive past 30 seconds,
and a hung one must still fail with a clear timeout at five minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 30s

The fetch that runs before `git worktree add` inherited the 30s git default,
so busy repositories failed to create a worktree while the fetch was still
making progress. Give fetchRemote a five-minute bound, matching worktree add,
and pin that bound in the test by checking the hung fetch is still running
one second before it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 24, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

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.

@juliusmarminge juliusmarminge added bugfix Fix PR opened by an issue lead; enters the PR loop pr:needs-julius Needs Julius: route gate, unverifiable surface, or blocked labels Oct 24, 2026
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

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 resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: 8247952 · PR result: a4652c9 · Source CI: success

Scenario 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.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.ts
Explicit 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 to a4652

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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 #18537 and 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

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

Commits

Reviewing files that changed from the base of the PR and between cefc1ac and a4652c9.

Files selected for processing: 2

  • apps/server/src/vcs/GitVcsDriverCore.test.ts
  • apps/server/src/vcs/GitVcsDriverCore.ts

Limit details: You’ve used all 10 included reviews currently available.

Alb11747 added a commit to Alb11747/t3code that referenced this pull request Nov 11, 2026
… 30s

The fetch before a start-from-origin worktree inherited the 30-second Git
default. On a large Windows checkout a no-op single-branch fetch takes
15-32 s, so new worktree threads failed with "Git command timed out."
Remote fetches now allow five minutes per attempt; a hung fetch still fails.

Carries juliusmarminge's takeover of watson's fix, applied to current fork
code with its TestClock regression cases.

Upstream-PR: pingdotgg#24604
Co-Authored-By: Claude Opus 5.5 (high, primary) <noreply@anthropic.com>
@Alb11747

Copy link
Copy Markdown
Contributor

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 juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 14, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member Author

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: fetch timeout at 30 seconds After: fetch completed at 37 seconds
Before: failed thread After: completed replay turn in the new worktree
Before recording After recording

Scenario and fixture driver

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 juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 14, 2026
@juliusmarminge
juliusmarminge merged commit 8b30961 into main Nov 14, 2026
52 checks passed
@juliusmarminge
juliusmarminge deleted the takeover/pr-18537 branch November 14, 2026 08:30
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 14, 2026
Pipyakas pushed a commit to Pipyakas/t3code that referenced this pull request Nov 15, 2026
Alb11747 referenced this pull request in Alb11747/t3code Nov 21, 2026
The fork already contains the upstream versions of the slow Git fetch,
Codex effort-only reload, bounded delegation waits, and requeued-steer
visibility. Drop duplicate Git and timeline tests. Keep the Antigravity
delegation coverage and thread-wait parameter help as a fork follow-up.

This reverts commit 94257e3.
This reverts commit 78db7eb.
This reverts commit 367053b.
This reverts commit 4202c26.
This reverts commit e651005.
This reverts commit 3ce35da.

Refs: 94257e3
Refs: 78db7eb
Refs: 367053b
Refs: 4202c26
Refs: e651005
Refs: 3ce35da
Related-PR: pingdotgg#15622
Co-Authored-By: GPT 6.2 Sol (high, implementation) <noreply@openai.com>
Co-Authored-By: GPT 6.2 Sol (xhigh, review) <noreply@openai.com>
Co-Authored-By: Claude Fable 5.2 (medium, design) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix PR opened by an issue lead; enters the PR loop pr:needs-julius Needs Julius: route gate, unverifiable surface, or blocked size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants