Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/24604/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

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.

FixtureBeforeAfter
Healthy transport delayed 37sTimeout at 30.032s; no worktreeSuccess at 37.278s; worktree HEAD equals fresh remote commit
Genuinely hung transportBaseline timeout demonstrated aboveTimeout at 300.052s; clear error, no worktree
Deadline regression tests163 pass, two expected failures165 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. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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).
    2. juliusmarminge added labelsbugfix

    3. juliusmarminge added labelspr:needs-julius

    4. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      CodexLive turn WebSocket decoded21.5 KiB21.5 KiB0 B (0.0%)24.4 KiB✅
      CodexLive turn messages110 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiB✅
      ClaudeLive turn messages110 (0.0%)8✅

      Other scenarios

      All 64 scenario measurements match main.

      All 64 scenario measurements
      ProviderScenarioMetricMain baselineThis PRImpactPR ceiling
      Codexshort turn resumeWebSocket decoded10.5 KiB10.5 KiB0 B (0.0%)12.7 KiB✅
      Codexshort turn resumeWebSocket messages220 (0.0%)2✅
      Codexlong turn running, cold openHTTP decoded281.7 KiB281.7 KiB0 B (0.0%)302.7 KiB✅
      Codexlong turn running, cold openrows75750 (0.0%)75✅
      Codexlong turn running, history pageHTTP decoded92.4 KiB92.4 KiB0 B (0.0%)107.4 KiB✅
      Codexlong turn running, history pagerows75750 (0.0%)75✅
      Codexlong turn finished, cold openHTTP decoded381.5 KiB381.5 KiB0 B (0.0%)410.2 KiB✅
      Codexlong turn finished, cold openrows1511510 (0.0%)151✅
      Codexlong turn finished, socket cold openWebSocket decoded381.6 KiB381.6 KiB0 B (0.0%)410.2 KiB✅
      Codexlong turn finished, socket cold openWebSocket messages220 (0.0%)2✅
      Codexlong turn finished, socket cold openrows1511510 (0.0%)151✅
      Codexlong turn finished, work pageHTTP decoded186.2 KiB186.2 KiB0 B (0.0%)200.2 KiB✅
      Codexlong turn finished, work pagerows1501500 (0.0%)150✅
      Codexidle thread resumeWebSocket decoded65 B65 B0 B (0.0%)200 B✅
      Codexidle thread resumeWebSocket messages110 (0.0%)1✅
      Codexfleet shell snapshotHTTP decoded42.4 KiB42.4 KiB0 B (0.0%)53.7 KiB✅
      Codexfleet shell snapshotrows27270 (0.0%)27✅
      Codexfleet shell subscribeWebSocket decoded65 B65 B0 B (0.0%)200 B✅
      Codexfleet shell subscribeWebSocket messages110 (0.0%)1✅
      Codexfleet shell resume checkHTTP decoded18 B18 B0 B (0.0%)100 B✅
      Codexfleet shell resume checkrows0000✅
      Codexstale shell reloadHTTP decoded42.4 KiB42.4 KiB0 B (0.0%)53.7 KiB✅
      Codexstale shell reloadrows27270 (0.0%)27✅
      Codexstale shell resumeWebSocket decoded140 B140 B0 B (0.0%)400 B✅
      Codexstale shell resumeWebSocket messages220 (0.0%)2✅
      Codexstale todo list cold openHTTP decoded72.4 KiB72.4 KiB0 B (0.0%)83.0 KiB✅
      Codexstale todo list cold openrows75750 (0.0%)75✅
      Codexstale todo list cold opennodes220 (0.0%)4✅
      Codexstale todo list cold opensubagents220 (0.0%)4✅
      Codexstale todo list cold openplans110 (0.0%)2✅
      Codexstale todo list cold openproviderTurns110 (0.0%)2✅
      Codexstale todo list cold opencheckpoints110 (0.0%)2✅
      Claudeshort turn resumeWebSocket decoded10.6 KiB10.6 KiB0 B (0.0%)12.7 KiB✅
      Claudeshort turn resumeWebSocket messages220 (0.0%)2✅
      Claudelong turn running, cold openHTTP decoded283.3 KiB283.3 KiB0 B (0.0%)302.7 KiB✅
      Claudelong turn running, cold openrows75750 (0.0%)75✅
      Claudelong turn running, history pageHTTP decoded93.4 KiB93.4 KiB0 B (0.0%)107.4 KiB✅
      Claudelong turn running, history pagerows75750 (0.0%)75✅
      Claudelong turn finished, cold openHTTP decoded384.2 KiB384.2 KiB0 B (0.0%)410.2 KiB✅
      Claudelong turn finished, cold openrows1511510 (0.0%)151✅
      Claudelong turn finished, socket cold openWebSocket decoded384.3 KiB384.3 KiB0 B (0.0%)410.2 KiB✅
      Claudelong turn finished, socket cold openWebSocket messages220 (0.0%)2✅
      Claudelong turn finished, socket cold openrows1511510 (0.0%)151✅
      Claudelong turn finished, work pageHTTP decoded188.1 KiB188.1 KiB0 B (0.0%)200.2 KiB✅
      Claudelong turn finished, work pagerows1501500 (0.0%)150✅
      Claudeidle thread resumeWebSocket decoded66 B66 B0 B (0.0%)200 B✅
      Claudeidle thread resumeWebSocket messages110 (0.0%)1✅
      Claudefleet shell snapshotHTTP decoded43.0 KiB43.0 KiB0 B (0.0%)53.7 KiB✅
      Claudefleet shell snapshotrows27270 (0.0%)27✅
      Claudefleet shell subscribeWebSocket decoded66 B66 B0 B (0.0%)200 B✅
      Claudefleet shell subscribeWebSocket messages110 (0.0%)1✅
      Claudefleet shell resume checkHTTP decoded18 B18 B0 B (0.0%)100 B✅
      Claudefleet shell resume checkrows0000✅
      Claudestale shell reloadHTTP decoded43.0 KiB43.0 KiB0 B (0.0%)53.7 KiB✅
      Claudestale shell reloadrows27270 (0.0%)27✅
      Claudestale shell resumeWebSocket decoded140 B140 B0 B (0.0%)400 B✅
      Claudestale shell resumeWebSocket messages220 (0.0%)2✅
      Claudestale todo list cold openHTTP decoded73.4 KiB73.4 KiB0 B (0.0%)83.0 KiB✅
      Claudestale todo list cold openrows75750 (0.0%)75✅
      Claudestale todo list cold opennodes220 (0.0%)4✅
      Claudestale todo list cold opensubagents220 (0.0%)4✅
      Claudestale todo list cold openplans110 (0.0%)2✅
      Claudestale todo list cold openproviderTurns110 (0.0%)2✅
      Claudestale todo list cold opencheckpoints110 (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.

    5. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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 nameStatusExplanation
      Title checkPassedThe 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 checkPassedThe 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 checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck 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 cefc1ace94bfe0d9f0bd97655a899fc4eccdffe3 and a4652c9df63b240a2e46d0f8cde839fc17f26930.

      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.

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

    7. juliusmarminge added labelstakeover:in-progress

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

      BeforeAfter
      82479522cba4652c9df6
      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 secondsAfter: fetch completed at 37 seconds
      Before: failed threadAfter: completed replay turn in the new worktree
      Before recordingAfter 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.
    9. juliusmarminge added labelstakeover:ready

    10. juliusmarminge removed labelstakeover:in-progress

    11. juliusmarminge merged this8b30961

    12. juliusmarminge closed this

    13. juliusmarminge removed labelstakeover:ready

Sign in to join this conversation.