Skip to content

Branch switch times out after 10s on partial clones and leaves files deleted on disk #30368

Open

Description

@mahmoodnizamani94-png

What happened

I switched branches using the branch dropdown in the app, and one of the branches I clicked on was a remote branch with large binary files. The checkout timed out after 10 seconds. When I switched back to main, almost all of my repo files were marked as deleted in git status, even though I never deleted anything.

Diagnosis

In apps/server/src/vcs/GitVcsDriverCore.ts (lines 4779-4789 in v0.1.6, the latest stable release), GitVcsDriver.switchRef.checkout runs git checkout with a hardcoded 10 second timeout (timeoutMs: 10_000).

When switching to a branch with a completely different file tree in a blobless partial clone (remote.origin.partialclonefilter=blob:none), git first unlinks the existing tracked files from the working directory (which takes a few milliseconds) and then starts downloading the missing blobs for the target branch over the network.

When that download takes longer than 10 seconds, T3 Code kills the git checkout process before git finishes writing the new files or updating HEAD. That leaves HEAD on the previous branch with the working directory already wiped.

If you then switch to another branch that shares most of its tree with the branch HEAD is still on, git checkout only writes out the small number of files that differ between those two commits, leaving the rest of the repo missing from disk and showing as deleted.

Steps to reproduce

  1. Clone a repo using a blobless partial clone (git clone --filter=blob:none) that has an orphan or deployment branch containing large binaries and none of the main source tree.
  2. Open the repo in T3 Code and use the branch picker to switch to that remote binary branch.
  3. Wait 10 seconds for the checkout to time out.
  4. Switch back to main.
  5. Run git status. Almost all tracked files are missing from disk and shown as deleted.

Version

0.1.6 (latest stable release, not nightly)

Environment

Linux x64 (7.3.1-1-cachyos), T3 Code Desktop 0.1.6 stable (Electron 44.10.0), Node v24.22.1, git 2.56.0

Evidence

server.trace.ndjson:
{"type":"effect-span","name":"runGitCommand","durationMs":10001.144388,"exit":{"_tag":"Interrupted","cause":"InterruptError: All fibers interrupted without error\n at runGitCommand\n at GitVcsDriver.switchRef.checkout"}}
{"type":"effect-span","name":"GitVcsDriver.switchRef.checkout","durationMs":10014.508603,"attributes":{"git.operation":"GitVcsDriver.switchRef.checkout","git.cwd":"<repo>","git.args_count":4},"exit":{"_tag":"Failure","cause":"GitCommandError: Git command failed in GitVcsDriver.switchRef.checkout (<repo>): Git command timed out."}}

Related issues

#22245 hits the same 10-second timeout in GitVcsDriver.switchRef.checkout. This case adds the partial clone (filter=blob:none) + orphan branch angle where git unlinks the whole working tree before fetching blobs, and switching back to main only restores the files changed between the two source branches.

Fix applied or workaround

Ran git restore . (or git reset --hard origin/main) in the terminal to bring the deleted working tree files back.

Filed by

antigravity (gemini-4-argon) via t3 triage

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions