feat(mcp): expose thread workspace inventory - #8685
Conversation
|
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:
Warning Your free Security trial is over. An organization admin can activate Security or dismiss this notice. Comment |
Thread transfer impact
This comment will update automatically after the next completed run. |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a model-visible worktree inventory capability and substantially expands existing worktree status behavior across MCP, contracts, orchestration, and Git infrastructure. The cross-layer runtime impact and non-trivial inventory/path-resolution logic warrant human review. You can add or adjust custom eligibility rules. Learn more. |
067be67 to
45486fb
Compare
|
Macroscope has since reviewed this pull request. An earlier review was skipped by a cost limit; a review has now completed, so that notice no longer applies. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but a cloud agent failed to start.
Reviewed by Cursor Bugbot for commit d1a6955. Configure here.
602bf69 to
9eaeae0
Compare
9eaeae0 to
bdd0832
Compare

Problem
An agent can see only the branch and worktree path recorded on its own thread. That does not reveal whether Git still agrees, which physical worktrees are available, whether they are dirty, or which live threads are bound to them.
Change
t3_worktree_statuswith separate recorded and actual workspace state plus an agreement resultt3_worktree_listresults with bounded thread bindings and per-entry availabilityvcs.listRefswire payload or cache shapeBehavior
These tools are read-only and current-project scoped. Inventory pages are sliced before per-worktree status reads, one missing or unreadable checkout produces an explicit entry outcome instead of failing the entire page, and plain non-repository project roots return a truthful status. Nested independent repositories are not attributed to a containing checkout. The tools do not create, switch, remove, prune, revive, or repair worktrees.
Validation
vp test run apps/server/src/mcp/WorktreeMcpService.test.ts(60 tests)vp test run apps/server/src/vcs/GitVcsDriverCore.test.ts(58 tests)vcs.listRefsdecode/cache compatibility coverageDependency
Bottom of native stack #8711, rooted on
agents/mcp-controls/base-490318aat490318afa505d3d033295eca12d7e62b4b922725. The dependent checkout mutation is PR #8680. This is independent of lifecycle PR #5589.Implemented by GPT-5.6-Sol via Codex in T3 Code.
Note
Medium Risk
WorktreeMcpStatusResultis an expanded MCP contract (new required fields), and list/status depend on new Git inventory reads with nuanced path/binding attribution logic.Overview
Agents get read-only workspace discovery for the calling thread’s project:
t3_worktree_listpages Git-registered checkouts (including detached entries) with dirty state, availability, and thread bindings, andt3_worktree_statusnow compares recorded thread metadata to on-disk Git state via anagreementfield.The server adds
GitWorkflowService.listWorktrees/GitVcsDriver.listWorktrees, returning canonical repository identity (repositoryCommonDir, physical roots, real paths) and reusing shared porcelain parsing so stale or missing registrations still appear in inventory without changing the existingvcs.listRefswire shape. List/status logic canonicalizes paths, resolves nested recorded cwd values through Git identity (excluding nested independent repos), bounds binding resolution and per-page status reads, and surfaces missing/unreadable checkouts per entry instead of failing the whole page.Contracts, MCP registration, Claude read-only allowlists, presentation labels, docs, and broad tests cover pagination, archived bindings, and non-repository project roots.
Reviewed by Cursor Bugbot for commit 07d53fd. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add
t3_worktree_listMCP tool and revampt3_worktree_statusinventoryt3_worktree_listMCP tool to provide a paginated inventory of worktrees, thread bindings, and workspace statuses for the calling thread's project.t3_worktree_statushandler in WorktreeMcpService.ts to concurrently read workspace settings, Git inventories, and filesystem existence, computing agreement states likein_syncorbranch_mismatch.listWorktreesoperation toGitVcsDriverandGitWorkflowServiceto fetch repository worktree inventory, preserving detached and stale checkout records.t3_worktree_statusnow fails when the actual Git workspace status cannot be read instead of returning a settings-only result;parseWorktreeCheckoutsnow preserves detached and missing worktree entries, changing the data returned byreadGitRefsSnapshot.Macroscope summarized 07d53fd.