fix-wg-owns

Fix: wg owns tmux session settings — re-assert on startup AND when settings change at runtime

Metadata

Statusdone
Assignedagent-1184
Agent identityf51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e
Created2026-04-29T21:06:00.514441042+00:00
Started2026-04-29T21:06:59.627983698+00:00
Completed2026-04-29T21:21:31.444542662+00:00
Tagsfix,tui,chat,architecture, eval-scheduled
Eval score0.78
└ blocking impact0.80
└ completeness0.75
└ constraint fidelity0.70
└ coordination overhead0.80
└ correctness0.80
└ downstream usability0.75
└ efficiency0.75
└ intent fidelity0.80
└ style adherence0.80

Description

Description

wg's chat persistence (implement-tmux-wrapped, commit ce6ca245a) wraps each chat in a tmux session. Tmux has its own config (status bar, status colors, mouse mode, etc.) but wg has its own desired state for those settings. Currently wg sets these at session-creation time (spawn_via_tmux in pty_pane.rs) but never re-asserts.

User framing 2026-04-29: 'to assert the settings from the host so it can be changed while the tmux is running?'

The right architectural pattern: wg owns the desired tmux-session state. wg re-asserts that state whenever it could drift.

Scope

A function: sync_tmux_settings()

Reads wg's current desired state for tmux sessions:

  • status off — bar hidden (current default; future: themed)
  • Mouse mode (per fix-mouse-wheel-3 outcome — depending on whether we let tmux handle wheel or claim it ourselves)
  • Status-style colors (when fix-tmux-status's option B / theme-aware bar lands later)
  • Any other knobs we add later

Iterates every wg-chat-* tmux session and applies the desired state via tmux set-option -t <session> <key> <value>. Idempotent.

Hook points

Call sync_tmux_settings() from:

  1. TUI startup — at the orphan-sweep hook (fn ensure_user_coordinator in state.rs:13294, same place implement-tmux-wrapped sweeps orphans). Subsumes fix-tmux-status-2's scope (existing pre-fix sessions get the bar disabled on next startup).
  2. Theme toggle — when the user flips dark/light theme in the TUI, push the new theme's tmux palette to all sessions immediately.
  3. Future settings changes — any user-controllable knob that affects tmux gets a sync call when changed.

Why this is the right shape

  • Single source of truth: wg's settings code
  • Self-healing: tmux drift gets corrected on next sync
  • Composable: adding a new tmux-relevant setting later means adding one line to sync_tmux_settings, not threading through every callsite
  • Subsumes fix-tmux-status-2 (existing sessions retroactively get status off — abandoned that narrower task in favor of this)

Validation

  • Failing test: pre-existing tmux session with status bar on; TUI startup; ASSERT tmux show -t <session> status returns 'off'
  • Failing test: theme toggle while TUI running with active chat sessions; ASSERT all wg-chat-* sessions reflect new theme palette (when option B lands; for now, just status-off remains constant — but the framework is in place)
  • sync_tmux_settings() is idempotent — running twice produces no change
  • sync_tmux_settings() is no-op on non-wg-chat-* sessions (don't mess with the user's own tmux work)
  • No regression: implement-tmux-wrapped's persistence + orphan-sweep still work
  • Live smoke: kill TUI, modify a wg-chat-* session manually (e.g. tmux set -t wg-chat-X status on), restart TUI, confirm the manual change is reverted
  • cargo build + cargo test pass
  • cargo install --path . was run before claiming done

Depends on

Required by

Log