fix(server): prevent worktree creation from failing when Git output exceeds 1 MB#31461
Problem
Creating a worktree can fail with Git output exceeded 1000000 bytes and was truncated when checkout warnings or a post-checkout hook produce more than 1 MB of output. T3 aborts the checkout because its diagnostic capture limit is exceeded, even when Git could otherwise finish successfully.
Reproduce with a repository whose post-checkout hook emits over 1 MB to stdout or stderr, then create a worktree through T3.
Change
Enable bounded output truncation for git worktree add using the existing Git execution support. Continue draining both streams and delivering checkout progress after truncation, and determine success from Git's exit status. Retained output remains capped at 1 MB per stream.
The fix is in the shared server Git driver, so existing worktree provisioning and setup continue through their normal paths for every client.
Scope and approval
This qualifies as a small, focused fix for an obvious bug: a diagnostic output quota should not abort a successful worktree checkout. It introduces no setting, contract change, or new workflow. Only the Git driver and its regression tests change.
Verification
- All three new regression cases failed before the fix and passed afterward. They cover stdout and stderr exceeding the limit, creation with and without progress reporting, continued stream draining and progress after truncation, and a nonzero Git exit status remaining an error.
vp test run src/vcs/GitVcsDriverCore.test.tsfromapps/server: all 240 tests passed withTMPDIRresolved to its canonical path. The default macOS/varalias caused an unrelated existing long-worktree-name test to compare/varagainst/private/var; the canonical-path run passed without changing that test.vp run check:changed origin/mainwith canonicalTMPDIR: all checks passed, including formatting, lint, knip, GraphQL validation, typechecking of the three affected packages, and 242 tests across two files. Targeted server typecheck also passed.- Real Git runtime verification through
GitVcsDriver.createWorktreein a disposable repository with a post-checkout hook emitting 1,300,000 bytes each to stdout and stderr:
| 1 | Hook emitted 1,300,000 bytes each to stdout and stderr. |
| 2 | T3 createWorktree succeeded; hook completion marker: done |
| 3 | Worktree branch: noisy-checkout |
Written with GPT-6.1 Sol through the Codex harness in T3 Code.
Checks
Added 1 commit
- fix(server): prevent worktree creation from failing when Git output exceeds 1 MBb68022b
Approvability
Verdict: Approved at b68022b
Macroscope's review found this PR approvable — Worktree creation can now finish despite oversized Git output while retaining bounded diagnostics and continued progress reporting. Git failures still propagate, and unrelated Git operations are unchanged.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review.
Walkthrough
-
Worktree creation now keeps line callbacks active after captured Git output reaches its limit. Regression tests cover progress reporting and success or failure handling when checkout output exceeds that limit.
Changes: Worktree output handling
Layer / File(s) Summary Worktree execution and regression coverage
apps/server/src/vcs/GitVcsDriverCore.ts,apps/server/src/vcs/GitVcsDriverCore.test.tsExecuteGitOptionsadds an option to keep line callbacks active after output truncation.executeGitforwards the option, and worktree creation enables it with a truncation marker. Tests cover progress callbacks, output limits, and exit-code handling.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
- pingdotgg/t3code#25367 reports
git worktree addfailing when output exceeds 1 MB. This change addresses that failure path. - pingdotgg/t3code#26584 reports oversized output failing in the shared Git output collector. This change applies truncation and continued callback processing to worktree creation.
Possibly related PRs
- pingdotgg/t3code#25387 addresses the same worktree output failure with truncation and continued line callbacks.
- pingdotgg/t3code#33687 applies the same Git execution mechanism to submodule updates.
Suggested labels:
bugfixSuggested reviewers:
juliusmarminge,saphid - pingdotgg/t3code#25367 reports
Merge Risk: External image Minimal · up to c3625
-
No actionable merge-blocking issue remains for noisy worktree checkout output.
Pre-merge checks: Passed 4
-
Check name Status Explanation Title check Passed The title clearly and concisely describes the primary fix: preventing worktree creation from failing when Git output exceeds 1 MB. Description check Passed The description includes all required sections and provides the problem, reproduction context, implementation details, scope justification, focused verification results, runtime verification, and agen… 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: Description check
-
Explanation
The description includes all required sections and provides the problem, reproduction context, implementation details, scope justification, focused verification results, runtime verification, and agent disclosure.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
External image Recent review info
-
External image Run configuration
-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: b3fdf2b
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e9155fb0-5342-4b78-9164-5674829ee02d
External image Commits
-
Reviewing files that changed from the base of the PR and between b68022b383c66368b0e6a2d0238f3817c428f361 and c3625c39d3010fd9737933cb1345f3228b6faa45.
External image Files selected for processing: 2
-
apps/server/src/vcs/GitVcsDriverCore.test.tsapps/server/src/vcs/GitVcsDriverCore.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
External image Recent review info
-
External image Run configuration
-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: b3fdf2b
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e9155fb0-5342-4b78-9164-5674829ee02d
External image Commits
-
Reviewing files that changed from the base of the PR and between b68022b383c66368b0e6a2d0238f3817c428f361 and c3625c39d3010fd9737933cb1345f3228b6faa45.
External image Files selected for processing: 2
-
apps/server/src/vcs/GitVcsDriverCore.test.tsapps/server/src/vcs/GitVcsDriverCore.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
Added 2 commits
Evidence
Create a committed disposable repository with a successful post-checkout hook emitting 1,300,000 ASCII characters to stdout. Add it as a project, select New worktree, and send the first message.
Real Chromium web client, 1280×800, light theme; fresh synthetic state on each commit. Repository paths are dynamically redacted. Final stills were captured after two identical screenshots 500 ms apart and sidebar regrouping.
| Before | After |
|---|---|
| b3fdf2b10f | c3625c39d3 |
| Before: workspace preparation fails at the output limit | After: worktree created and replay turn completed |
| Before recording | After recording |
Reproduction scenario. scenarios:prove exited 0: base failed and head passed.
AI-assisted; verified with the tests and tools listed above.
Not shown:
- Independent stderr overflow was not exercised; this reproduction emits to stdout.
- Retained-output bounds and progress callbacks after truncation are not exposed by this UI scenario and were not measured.
- Nonzero Git exit handling was not exercised; the reproduction hook exits successfully.
Thanks for this. Main has the change since #34889.
Compared your complete patch with 080b10c408 and main's output collector: main now implements the same bounded truncation, continued stream draining, progress delivery past the cap, and exit-status handling for worktree creation. Your additional regression cases cover those behaviors, but the patch adds no remaining runtime behavior.
Closing as superseded.