Repository navigation
Workspace providers: pluggable create/remove commands (rift, CoW clones, Worktrunk), with support for non-git directories and cleanup on settle #11266
Replies: 3 comments
|
+1, from a game-dev monorepo, with a different reason than copy-on-write. Our repo is a Unity game plus backend, web admin and services: 85k tracked files and 3.1 GB of Git LFS. 85% of the files and 2.8 GB of the LFS data are in the Unity project, which most agent tasks never touch. Every T3 worktree is a full checkout with every LFS object downloaded, and we run several at once. We've also had a We need a sparse cone and a worktree-local A
Our |
|
I have a working Worktrunk-specific version of this on my fork, based on current main. Here is the comparison against main, and the branch is It adds an opt-in setting per machine, Settings → Worktrees → Worktree manager, with Git as the default and Worktrunk as the alternative. With Worktrunk selected, T3 still picks the branch name and start point and creates the branch. Then it runs While building it, I ran into five problems that a generic Ownership after creation. Automatic cleanup, the rebuild of a missing worktree at turn start, and checkpoint rollback only trust worktrees inside T3's worktrees folder. A worktree that a provider created outside that folder needs its own record that T3 manages it. Without one, T3 never cleans it up or rebuilds it. I store the record in the repo's git config, keyed by path, as Rebuilding at an exact path. A thread keeps its Removal by the creator. Whatever created a workspace should also remove it, even if the user has changed the setting since. So the ownership record should also name the provider. Targets that aren't branches. Hook approval. Without a terminal, wt refuses repo hooks the user hasn't approved. I pass The branch has tests for create, the ownership record, remove, and rebuilding at a given path. They use a stand-in for Which shape would maintainers accept, a focused Git / Worktrunk setting like this one or the generic workspace provider proposed here? I can reshape the branch either way, or send the Worktrunk setting first as a step toward providers. |
|
+1, with Worktrunk as the main use case. I want one global setting for each machine, not a script in each project. The "Worktree manager" setting on Arzaroth's branch matches this need. My Worktrunk user config already prepares each worktree. It copies gitignored files ( About hook approval: I prefer that T3 does not pass |
Uh oh!
There was an error while loading. Please reload this page.
Problem
T3 Code has one way to isolate a thread:
git worktree addinto~/.t3/worktrees. That path is hardcoded inGitVcsDriverCore.createWorktree, and everything around it assumes git:local, so every thread on that project shares one directory.node_modules,.env, build caches and generated files are gone, and therunOnWorktreeCreateaction has to rebuild them for every thread.Several discussions already ask for a piece of this: copy-on-write clones instead of worktrees (#10853), driving worktrees through Worktrunk (#8953), and cleaning up when a thread settles (#6856, #6999, #6864). They are all the same missing abstraction.
Proposal: workspace providers
Make the git worktree a provider, and let a project pick a different one. A provider is three things, configured in
t3.jsonor project settings:{ "workspace": { "create": "rift create --copy-all", // runs in the project dir, prints the workspace path "remove": "rift remove --force", // runs inside the workspace "requiresGit": false // default true; false lets plain directories use it } }Lifecycle:
createin the project directory, take the printed path as the thread'sworktreePath, start the session there. ExistingrunOnWorktreeCreateactions keep working since they only need the path.removeinside the workspace. Same guards the team named when closing feat(server): clean worktree build artifacts when threads settle #8771: skip while a session is running, while terminals are open, or while another thread references the path.createagain, exactly like the current "recreate a missing worktree on the next turn" behaviour.The built-in git provider is
git worktree add/git worktree removewithrequiresGit: true, so nothing changes for anyone who does not opt in.Motivating example: rift
rift makes copy-on-write clones of a directory using APFS
clonefile. It does not care whether the directory is a git repo, or whether it holds several repos side by side.rift create --copy-allgives a full clone in well under a second, includingnode_modulesand build output, so the agent starts warm.rift removemoves it to trash and unregisters it. It already has a.rift.tomlpostcreatehook and exposesRIFT_SOURCE/RIFT_DESTINATIONto it.I run this today by hand for every thread. The only thing missing is T3 Code calling it, and pointing the thread at the result.
Worktrunk (#8953) fits the same contract:
wt switch --create --json <branch>prints a path,wt removetears it down. A plaincp -cCoW clone (#10853) fits too.Smallest useful scope
workspace.createandworkspace.removeint3.json,requiresGitflag.createwheregit worktree addruns today and stores the path on the thread.thread.settledthat runsremovewith the guards above.No UI beyond what project settings already have for actions. Happy to contribute the implementation if this shape is welcome, and to fold it into the post-Orchestrator-V2 worktree lifecycle work the team mentioned in #8771.
All reactions