MCP ensure path does not fold a worktree dir to the project root #532
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
follow-up
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#532
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found during review of PR #523 (fix: relaunch a killed opencode on local create). Pre-existing; same bug class the PR fixed on the create-session path, but on the MCP/scheduled-prompt path.
internal/server/host.go:133—ensureProjectOpencodePortpasses the raw directory toEnsureProjectOpencodewithout theprojectRootForDirectoryfolding that the create handler now does. If the parent session lives in a git worktree, ensure resolves the worktree's toplevel (git.ResolveRepoRootreturns the worktree root,internal/git/worktree.go:62) instead of the main checkout — violating the "one opencode instance per project" invariant and potentially launching a second instance per worktree for MCP splits and scheduled prompts.Open design question first (flagged during review): is per-worktree ensure on this path intentional? If not, apply the same folding as the create path and add a table-driven test mirroring the create-path one.