opencode-mission-control icon indicating copy to clipboard operation
opencode-mission-control copied to clipboard

bug: Window-placement jobs not cleaned from tmux on cleanup

Open nigel-dev opened this issue 9 months ago • 1 comments

Description

When mc_cleanup runs, it only kills tmux sessions — jobs that were launched with placement: 'window' are skipped entirely, leaving orphaned tmux windows.

Steps to Reproduce

  1. Launch a job with window placement:
    mc_launch(name: "test-window", prompt: "...", placement: "window")
    
  2. Wait for the job to complete.
  3. Run mc_cleanup(name: "test-window").
  4. Check tmux — the window still exists.

Expected Behavior

mc_cleanup should kill tmux windows for window-placement jobs, not just sessions.

Actual Behavior

// src/tools/cleanup.ts:57-59
if (job.placement === 'session' && await sessionExists(job.tmuxTarget)) {
  try { await killSession(job.tmuxTarget); } catch {}
}

Only placement === 'session' jobs have their tmux resources cleaned up. Window-placement jobs are silently skipped.

Proposed Fix

Add a branch for window-placement cleanup. The tmux target for windows uses session:window format, so use tmux kill-window -t {target}:

if (job.placement === 'session' && await sessionExists(job.tmuxTarget)) {
  try { await killSession(job.tmuxTarget); } catch {}
} else if (job.placement === 'window') {
  try { await killWindow(job.tmuxTarget); } catch {}
}

May need to add a killWindow() helper to tmux.ts if one doesn't exist.

Files Involved

  • src/tools/cleanup.ts:57-59 — cleanup logic only handles sessions
  • src/lib/tmux.ts — may need a killWindow() function

Additional Context

Identified in the master audit report (Section 7: Robustness). This is a good first issue — small scope, clear fix, and teaches the tmux/cleanup code paths.

nigel-dev avatar Feb 12 '26 03:02 nigel-dev

Closing as obsolete with Mission Control 2.0 (#94): placement (session/window) and tmux are removed, so window-placement jobs no longer exist.

nigel-dev avatar Nov 20 '26 19:11 nigel-dev