Wire /wt, MCP new_session, and loops to run sessions in-app on the project instance #268
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
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#268
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?
Parent
#265 — One OpenCode per project: worktree sessions run in-app.
What to build
Wire all three session-creation callers through
EnsureProjectOpencode(#267) + directory-awareCreateSession(#266)so worktree and same-directory sessions run in-app against the
project's single opencode instance. This is the first fully demoable
slice of #265.
/wt(local.Host.CreateWorktreeSession): create the gitworktree, call
EnsureProjectOpencode(repoRoot), then create an in-appsession pointed at the worktree path against the returned port. Stop
calling
LaunchWorktreeTmux.new_session(worktree) + loopsspawn_worktree(
mcp.SessionLauncher.LaunchWithWorktree): replacelaunchTmux(repoRoot, worktreePath)+waitForPort(worktreePath)withthe injected
EnsureProjectOpencode(repoRoot), thenLaunchwithDirectory = worktreePath.new_session(same directory) (SessionLauncher.Launch):ensure the project instance before
CreateSession, so same-dir splitsself-heal instead of returning
ErrPlatformUnreachable.hostsvc.WorktreeSessionResultreturns the createdsession ID (plus worktree path, branch, reused flags). The
/api/worktree/create-and-launchresponse changes accordingly./wtnavigates to the created session in-app insteadof
tmux switch-client. Worktrees view associates each worktree withits sessions by the session's own
directory(now distinct from theprocess cwd), which ocman surfaces per session (folds in the original
attribution ticket).
EnsureProjectOpencoderuns on the owning host, same asCreateWorktreeSessiontoday.Acceptance criteria
/wtcreates a worktree session on the shared project instance —no new opencode process, no per-worktree tmux window.
/wtfor the same project reuses the same instance.new_sessionand loopsspawn_worktreereuse theproject instance.
new_sessionlaunches the instance if none isrunning (no
ErrPlatformUnreachable).create-and-launchresponse carries the session ID; frontendopens it in-app.
old per-worktree tmux launcher is no longer invoked.
make test && make lintgreen; coverage delta ≥ 0 both sides.Blocked by