Expose isolatedWorktree on the sessions MCP surface - #253
Merged
Conversation
SessionControl.createSession has supported isolatedWorktree (per-branch worktree even on a shared-checkout repo) since the server capability landed, but the opensession-sessions MCP adapter never exposed it: create_session's Zod schema, handler argument type, and forwarded createSession input all omitted the field, so matching-repo child sessions always shared the parent worktree from the agent's perspective. Expose isolatedWorktree on create_session and spawn_task, forward it to SessionControl.createSession, let it satisfy spawn_task's branchless code-mode guard (the durable create plan generates a branch from the prompt), and document that true keeps child/report-back linkage while minting a separate worktree and branch. Regression tests prove the schema exposure and forwarding on both tools.
🤖 OS review · approve · confidence 5/5Safe to merge. The PR consistently exposes and forwards
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
SessionControl.createSessionhas supportedisolatedWorktree(mint a per-branch worktree even when the child could share the parent's) since the server capability landed in session-control / session-control-wiring, but the publicopensession-sessionsMCP adapter (src/agents/slack/sessions-tools.ts) never exposed it: thecreate_sessionZod schema, handler argument type, and forwardedcreateSessioninput all omitted the field. As a result, an agent fanning work out to matching-repo child sessions could not get separate workspaces — every child shared the parent worktree and produced one mingled diff.spawn_taskhad the same omission, plus a branchless code-mode guard that would have refused the isolated case.Fix
isolatedWorktree?: booleanoncreate_sessionandspawn_task(schema + handler types), forward it toSessionControl.createSession.isolatedWorktree: truesatisfyspawn_task's branchless code-mode guard — the durable create plan generates a branch from the prompt, exactly as the wiring already does for non-shared creates.truekeeps child/report-back linkage while creating the child's own worktree and branch.Tests
Two regression tests, written first and failing at exactly the omission before the fix:
exposes isolatedWorktree on create_session and forwards it to createSession— asserts the field is in the MCP tool's input schema and reachescreateSessionwith parent linkage and report-back intact.accepts isolatedWorktree: a branchless code task gets its own worktree instead of sharing the parent's— spawn_task no longer refuses a branchless isolated code task and forwards the flag withbranchleft undefined for plan generation.bun test src/agents/slack/sessions-tools.test.ts: 30 pass, 0 fail.bunx tsc --noEmitclean.Started by Jaap Frolich in this OS session