8000 fix(opencode): retry a TUI session report that never landed by Mattheinrichs · Pull Request #443 · amirlehmam/wmux · GitHub
[go: up one dir, main page]

Skip to content

fix(opencode): retry a TUI session report that never landed - #443

Merged
amirlehmam merged 2 commits into
amirlehmam:masterfrom
Mattheinrichs:fix/opencode-session-report-retry
Nov 6, 2026
Merged

amirlehmam merged 2 commits into
amirlehmam:masterfrom
Mattheinrichs:fix/opencode-session-report-retry

Conversation

@Mattheinrichs
Copy link
Copy Markdown
Contributor

Problem

With several OpenCode panes open, wmux's sidebar can show fewer session rows than the panes that are actually running — and on restore, a pane can come back without its session handle.

The TUI-side plugin reports the viewed session with wmux report-session <id> --provider opencode --surface <id>. Under a burst, wmux's named pipe can answer:

open //./pipe/wmux: All pipe instances are busy

The old reporter set last = id before the CLI call resolved, so a failed report was treated as already sent. Every later observe() of the same session was deduped away, and the pane silently lost its restore handle for the rest of its life.

Fix

  • callWmux now passes the CLI result to its completion callback (null on success, the failure otherwise).
  • createSessionReporter retries a report that never landed at 1 s, 3 s and 10 s, cancelling the retry when the view moves to another session.
  • A hosted session.execution.started reasserts the held handle, throttled to once per 30 s, so a handle main dropped after a successful report heals on the next turn instead of waiting for a tab switch.
  • The TUI marker moves 5 → 6 so wmux opencode-tui reinstalls the pair.

The reassert is deliberately narrow: it only repeats the session this TUI is viewing, so a background session cannot overwrite the tab's restore handle.

Verification

  • Live failure observed with WMUX_PLUGIN_DEBUG: report-session failed with All pipe instances are busy, retried after 1 s, succeeded, and the surface kept its session id.
  • Targeted suites: 98 passed.
  • npm run typecheck: clean.
  • Full WSL suite: 6283 passed, 42 known Windows-path/platform failures — the same baseline as before, none in the changed suites.

Files

  • resources/opencode-plugin/wmux-tui-core.js
  • resources/opencode-plugin/wmux-tui.js
  • tests/unit/opencode-tui-core.test.ts
  • tests/unit/opencode-tui-install.test.ts
  • docs/opencode-plugin.md

Mattheinrichs and others added 2 commits November 6, 2026 08:38
The named pipe can answer "All pipe instances are busy" during a restore burst. The TUI reporter set its dedupe handle before the CLI call resolved, so a failed report-session was never retried: the pane showed in the sidebar without a restore handle and every later observe() of the same id was a no-op.

Pass the CLI failure through callWmux, retry it at 1 s / 3 s / 10 s, and reassert the held handle when a hosted execution starts (throttled to once per 30 s) so a handle main dropped after a successful report also heals on the next run. Bump the TUI marker to 6.

Verified live: a report-session failed with "All pipe instances are busy", retried after 1 s, and succeeded; the fake surface kept its session id. Targeted suites 98 passed; typecheck clean. Full WSL suite: 6283 passed, 42 known Windows-path/platform failures (none in the changed suites).
The TUI passed the viewed session to reassert, but the reporter holds the
root: while the user looked at a subagent the two never matched and the
handle never healed. Reassert now takes the event's root.

A reassert during an in-flight report sent a second concurrent call, and a
late failure from the older one could undo the newer confirmation and start
another retry chain. Only the newest call settles state now, and reassert
waits while a call or a retry is pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0