fix(server): check out submodules in a new worktree - #7674
Conversation
`git worktree add` leaves submodule paths empty, so a repository that keeps shared tooling in a submodule gets a worktree that is quietly missing it. When a project stores agent skills there, every thread started on a new worktree loses them and the agent reports the skill as unknown. Run `git submodule update --init --recursive` after creating a worktree, guarded on the checkout actually having a `.gitmodules`. It stays best-effort: the objects are normally already in the parent's `.git/modules` so this costs milliseconds, but a first-ever clone needs the network, and a submodule that cannot be fetched must not roll back the caller's thread. Model: Claude Opus 5 (1M) via Claude Code.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds new runtime behavior to worktree creation by automatically initializing git submodules via You can add or adjust custom eligibility rules. Learn more. |
## What's Changed * fix(server): bound OpenCode skill discovery output by @Lucenx9 in pingdotgg/t3code#7675 * fix(mobile): persist thread shelf collapse state by @PixPMusic in pingdotgg/t3code#5152 * fix(mobile): restore Android tablet thread controls, clean up header by @PixPMusic in pingdotgg/t3code#5385 * fix(mobile): land the first thread open above the composer on Android by @PollyGlot in pingdotgg/t3code#5585 * fix(server): check out submodules in a new worktree by @Brechard in pingdotgg/t3code#7674 * fix(server): preserve merged PR badges after branch deletion by @tris203 in pingdotgg/t3code#6216 * fix(server): return fresh live pull request reads by @Adamulek123 in pingdotgg/t3code#6472 * fix(web): compare client and server versions as semver, not strings by @spiky02plateau in pingdotgg/t3code#7579 * fix(web): stop follow-ups from leaving giant blank space by @t3dotgg in pingdotgg/t3code#8068 * fix(marketing): stop automatic Vercel deployments on pull requests by @t3dotgg in pingdotgg/t3code#8070 * chore: vouch repeat contributors by @t3dotgg in pingdotgg/t3code#8071 * fix(server): keep the authoritative subagent model when snapshots race task_started by @spiky02plateau in pingdotgg/t3code#7583 * fix(server): honor auto-accept edits for the OpenCode provider by @Rishet11 in pingdotgg/t3code#7100 * fix(server): run the CLI on Node versions without import.meta.main by @CDVolvik in pingdotgg/t3code#7141 * fix(server): recover from provider interrupt failures by @mrmg in pingdotgg/t3code#7412 * fix(server): recreate a thread's worktree before starting a turn by @mackinleysmith in pingdotgg/t3code#7839 * fix(server): thread delete no longer fails on already-removed worktrees by @t3dotgg in pingdotgg/t3code#8076 * fix(web): stop update notices showing through the composer by @t3dotgg in pingdotgg/t3code#8083 ## New Contributors * @spiky02plateau made their first contribution in pingdotgg/t3code#7579 **Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260824.1175...v0.0.34-nightly.20260824.1176 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260824.1176
Fixes #7672.
git worktree addleaves submodule paths empty, so a repository that keeps shared tooling in a submodule gets a worktree that is quietly missing it. When a project stores agent skills there, every thread started on a new worktree loses them and the agent reports the skill as unknown.In my case
.agents/sharedis a submodule that.claude/skills/*symlinks into, so each worktree had ten dangling symlinks and the skills simply disappeared from the picker. Probing the Agent SDK showed 98 available commands at the repository root versus 88 in the worktree — the difference being exactly the submodule-backed skills.What changed
Run
git submodule update --init --recursiveafter creating a worktree, guarded on the checkout actually having a.gitmodules.It stays best-effort. The objects are normally already in the parent's
.git/modules, so this costs milliseconds — ~90 ms measured, fully offline. But a first-ever clone needs the network, and a submodule that cannot be fetched must not roll back the caller's thread, which is what a failure here would otherwise do:ws.tsdeletes the just-created thread whencreateWorktreefails. So the checkout logs a warning and the worktree is still returned.The hook sits in
GitVcsDriverCore.createWorktree, so it covers thread bootstrap, PR worktrees, and the raw RPC alike.Verification
vp test run apps/server/src/vcs/GitVcsDriverCore.test.ts— 51 passed, including two new cases against a real submodule: one asserting the submodule file exists in the new worktree, one asserting an unreachable submodule still yields a worktree.No UI change, so no screenshots.
Model: Claude Opus 5 (1M) via Claude Code.
🤖 Generated with Claude Code
Note
Cursor Bugbot is generating a summary for commit d76919a. Configure here.
Note
Populate submodules when creating worktrees in
GitVcsDriverCore.createWorktreegit worktree add, checks for a.gitmodulesfile in the new worktree and runsgit submodule update --init --recursivefrom the worktree path.git submodule update --init --recursiveno longer failscreateWorktree; callers expecting submodules to be populated must now check for their presence explicitly in GitVcsDriverCore.ts.Macroscope summarized d76919a.