Skip to content
Source
Sign inSign up
pingdotgg/t3code

Checkpoint capture scans every discovered repo on each turn, so multi-repo projects wait minutes before a turn starts #48170

Openhardikg2907(GitHub profile, opens in a new tab) opened this issue 0 comments

Before submitting

Area

apps/server (orchestration-v2 checkpoints, workspace folders)

Summary

In a project whose root is a plain folder that holds many independent git repos, every turn captures a checkpoint of every discovered repo, not only the repos the turn touched. The next turn's provider-turn.start waits behind that capture on the thread's effect lane. The post-turn capture has no total time limit, so a new message stays on "Starting…" for minutes.

Environment

  • T3 Code Nightly 0.1.14-nightly.20261203.5651, macOS 27.2.1 (Apple Silicon), git 2.56.0
  • Project root: a plain folder (not a git repo) with about 105 tracked repos, all discovered: true
  • An endpoint security scanner makes file IO slow, so each git call is slow. This makes the problem worse, but it is not the cause: the cost grows with the number of repos, not with the work the agent did.

What happens

  • Over about 2 hours, 77 CheckpointService.captureWorkspaceCheckpoint spans had a median of 61 s and a max of 182 s. Single captureRepository spans took 10 to 187 s.
  • Runs stayed in starting for 10+ minutes. The provider process was never spawned. Threads in a small project started at once at the same time.
  • ws.rpc.workspace.listFolders took 133 s. Its WorkspaceFolders.list.hasCommits spans took up to 24 s, mostly waiting for one of the 8 server-wide git slots that the captures hold. The UI showed "Some requests are slow: workspace.listFolders".

Code path (main @ e0661db)

  1. A finished, interrupted or cancelled run enqueues checkpoint.capture on the thread's effect lane (RunExecutionService.ts:889-905). The lane runs one effect at a time (EffectOutbox.ts:365-372), so the next run's provider-turn.start (Orchestrator.ts:3259, :3564-3567) waits behind it.
  2. The capture covers every project folder that is a git repo (up to 128) plus submodules: CheckpointCaptureService.ts:127-130 → CheckpointService.ts:983-1007 → WorkspaceFolders.forThread (:558-586). Discovery walks the disk on every call (WorkspaceFolders.ts:328-394).
  3. For each repo it runs git -c core.fsmonitor=false status --porcelain=v2 --untracked-files=normal (GitVcsDriver.ts:2208-2232), so fsmonitor never helps. Any repo with uncommitted changes gets a full capture (read-tree, add -A, write-tree, commit-tree, diff --numstat) on every turn, even when the agent never touched it (CheckpointService.ts:1106).
  4. Repos run 6 at a time (CheckpointCaptureService.ts:28, :205) and share one server-wide limit of 8 git processes (GitVcsDriverCore.ts:82, :1589-1593). Per-folder capture locks are server-wide (CheckpointService.ts:391-413), so one thread's capture also blocks other threads in the same project.
  5. Only turn-start baselines have a budget (5 s, CheckpointService.ts:421). The post-turn capture has no total budget and no "start without a checkpoint" fallback.

Expected behavior

The cost of a turn depends on what the agent changed, not on how many repos sit under the project root. A slow capture never keeps the next turn from starting.

Suggested fixes (most to least root-cause)

  1. Capture only touched repos. Use the paths from the turn's edit and command items. For other repos, skip the capture if HEAD and the .git/index mtime did not change since the turn-start state (CheckpointService.ts:1066-1106). A shell command can change a repo without an edit item, so the mtime check is the fallback.
  2. Take repo captures off the thread's lane. Commit the root checkpoint, start the next turn, and finish repo captures in the background (CheckpointCaptureService.ts:201-210). The next turn's baseline can snapshot any repo whose capture has not finished.
  3. Add a total budget to post-turn repo captures, as the baseline has. Mark the repos past the budget as error, not blocking.
  4. Run checkpoint git on the background git lane, so listFolders and other interactive calls are not starved, and cache hasCommits.

Workaround

Add t3.json to the project root with {"ignoreRepositories": ["."]}. Discovery then returns no repos, and turns start at once. The cost is no per-repo diffs, rewind or repository rows in that project.

Sign in to join this conversation.