fix: route new-session launch through managed opencode lifecycle #396
No reviewers
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman!396
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-managed-launch-newsession"
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?
Closes the last open acceptance criterion of #376 (AC-3: manual and automatic launch paths cannot create competing managed instances).
The managed lifecycle (worktree / MCP
new_session/ same-dir sessions) already routed throughEnsureProjectOpencodeand was guarded by singleflight + the managed registry. But the manual new-session bootstrap —POST /api/tmux/launch-opencode, called by the frontend new-session flow — still ran the rawtmux.LaunchOpencode(opencode --port 0) outside that guard, so a user-driven launch could race an ensure and spawn a second competing instance for one project.Change
handleTmuxLaunchOpencodenow delegates toEnsureProjectOpencodeinstead ofLaunchTmux, so every launch path shares the singleflight guard and managed registry. The responsesessionfield now carries the managed runtime's instance ID (the tmux session name for the native runtime), preserving wire compatibility.EnsureProjectOpencode.createSessionWithLaunchdoc comment.The
LaunchTmuxhost method + gRPC seam are left in place (still part of the remote plumbing); only the HTTP handler's target changed.Coverage ratchet: ✅ pass
Tolerance: -0.1%. Baseline stored on
gh-pages.