Skip to content

psmux: TUI-side window ids are still bare — parked mint, list_windows fields, and prune kill targets replay @N cross-server #291

Description

@dracic

Summary

#254 (fixed by #290) session-qualified the engine-side window-id seam: PsmuxMultiplexer.new_window and list_window_ids now emit session:@N. The TUI-side surfaces were deliberately excluded from that diff (per the issue's implementation notes) and still hand around bare @N ids on psmux. Both #290 review passes independently confirmed the remaining surfaces, so this files the promised follow-up audit.

Affected surfaces

  • new_parked_window (inherited from the base backend) still returns a bare #{window_id}. Consumers replay it as a -t target: set_window_option(win_id, PROJECT_OPTION, ...) and window selection in tui/launch.py, plus attach targeting in the TUI app.
  • list_windows field rows: window_id columns stay bare, and prune_ctl_windows passes those ids straight to kill_window — a destructive verb, against the shared cross-project ctl session.
  • select_ctl_window_id / ctl window selection takes bare @N values from callers.

Why this is the same bug class as #254

psmux runs one server per session; a bare -t @N routes by the caller's $TMUX, else the most-recent-session fallback. The TUI process frequently runs outside any psmux pane (user launches from a plain shell), so its bare-id verbs land on whatever server the fallback picks. The #254 forensics also showed warm-recycled panes carrying stale env, making the fallback nondeterministic across sessions — in a controlled two-session test a bare kill-window -t '@2' issued in session A killed session B's @2 with rc 0. The prune path uses exactly this verb shape.

Notes for the fix

  • Mirror the fix(adapters): session-qualify psmux window ids #290 approach: qualify at the psmux backend's minting/listing seams, not per caller. new_parked_window should return the same session:@N form as new_window; list_windows should qualify window_id fields identically.
  • Symmetry hazards to watch: current_window_id() comparisons in the ctl-candidate scan (win_id == current) must compare like with like, and any caller that composes mux.target(CTL_SESSION, window) from an already-qualified id would double-qualify.
  • The session:@N target grammar is already verified on stock psmux 3.3.7 for kill-window, send-keys, pipe-pane, list-panes, and capture-pane (see fix(adapters): session-qualify psmux window ids #290's verification notes); only the TUI-side consumers and their id round-trips need auditing here.

Refs: #254, #290, #221, psmux/psmux#483

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions