fix(tui): preview Open terminals with the composition the window opener checks #1167
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 493 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.371
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1167"
general
weight: 0.35
mvschwarz
The TUI's Open terminals action was refused on every attempt on a machine without Herdr where cmux is running: "The terminal view changed since preview. Refresh the preview before opening." This makes it reach the plain-tmux window again, as on 0.6.9.
The cause:
planIdtorig terminal open --window --expected-plan <planId> -- <view>.provider=herdr), falls back to plain tmux when Herdr is missing, and refuses when the plans differ.The change:
&provider=herdr), the one the window opener checks against: one line inpackages/tui/src/daemon-client.ts.--expected-planand the plan hash are unchanged. A provider-less open that isn't a window still chooses cmux.Measured before and after, one test on three commits in CI. It uses the real daemon terminal routes and terminal service over localhost (provider selection, composition, plan hashing), the real TUI preview client, and the real CLI window opener with its plain-tmux fallback on an isolated tmux server. The stubs are named: the provider adapters' availability (no Herdr, cmux available and alive), the Herdr binary probe (absent), and the macOS desktop launcher, which records its command instead of opening a window.
| | 0.6.9 release commit
4b48ca21(run) | main at the content cut67efb111(run) | this PR (run) ||---|---|---|---|
| TUI preview's provider | herdr | cmux | herdr |
| window open | opened both seats, in plain tmux | refused: "The terminal view changed since preview" | opened both seats, in plain tmux |
| plain-tmux view created / desktop launches | yes / 1 | no / 0 | yes / 1 |
Tests (
packages/cli/test/terminal-window-tui-preview.test.ts, the same real composition):openView.Not exercised: a real desktop window, and Herdr's own window path, which existing tests cover. The plan Herdr checks against is shown unchanged above.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WfCu2MmcrSGRNX9Rjv1h6u
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
Improvements
Terminal previews now explicitly select the Herdr provider when available, keeping preview plans consistent with window-opening requests.
When Herdr is unavailable, window opening can use plain tmux, while non-window opens can select cmux.
Opening a window is prevented if the view has changed since its preview, helping avoid acting on an outdated plan.
Tests
Added end-to-end coverage for terminal previews and window-opening behavior across provider availability and view changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->