fix: honor inject_status_line=false on the watcher/reconnect path - #1780
fix: honor inject_status_line=false on the watcher/reconnect path#1780hfreire wants to merge 1 commit into
Conversation
|
👋 Thanks for the contribution — intake looks complete. Your PR body carries everything the maintainer's validation pipeline reads first: the problem, the reasoning, the human intent behind it, and an AI-disclosure. It will be applied, built, and tested against gate marker read: ai= |
📝 WalkthroughWalkthroughDisabled status-line injection now explicitly turns the tmux status bar off unless the user overrides ChangesTmux status-bar disabling
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/tmux/inject_status_default_test.go`:
- Around line 9-21: Extend TestReconnectSessionLazyHonorsInjectDefault to also
construct sessions through NewSession and ReconnectSession, asserting
injectStatusLine is false when the default is disabled and true when it is
enabled. Keep the existing default restoration and ReconnectSessionLazy coverage
intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b8d7347-e7ad-49e1-ae0c-d76b46e7f15b
📒 Files selected for processing (4)
cmd/agent-deck/main.gointernal/tmux/inject_status_default_test.gointernal/tmux/socket.gointernal/tmux/tmux.go
| func TestReconnectSessionLazyHonorsInjectDefault(t *testing.T) { | ||
| orig := getDefaultInjectStatusLine() | ||
| defer SetDefaultInjectStatusLine(orig) | ||
|
|
||
| SetDefaultInjectStatusLine(false) | ||
| if s := ReconnectSessionLazy("no-such-session", "d", "/tmp", "", ""); s.injectStatusLine { | ||
| t.Fatalf("expected injectStatusLine=false when default is off") | ||
| } | ||
|
|
||
| SetDefaultInjectStatusLine(true) | ||
| if s := ReconnectSessionLazy("no-such-session", "d", "/tmp", "", ""); !s.injectStatusLine { | ||
| t.Fatalf("expected injectStatusLine=true when default is on") | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Cover all constructors changed by this PR.
This test only exercises ReconnectSessionLazy; a regression in NewSession or ReconnectSession would still pass. Add assertions for both constructors under false and true defaults.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/tmux/inject_status_default_test.go` around lines 9 - 21, Extend
TestReconnectSessionLazyHonorsInjectDefault to also construct sessions through
NewSession and ReconnectSession, asserting injectStatusLine is false when the
default is disabled and true when it is enabled. Keep the existing default
restoration and ReconnectSessionLazy coverage intact.
|
Thank you for this one, and for the honest revert-limitation note in the body — but I want to push back on the premise before we land it, because I think merging as-is would close the ticket without actually killing your status bar. On main today, the reconnect path already honors the config: internal/session/storage.go calls ReconnectSessionLazy at :1318 and then SetInjectStatusLine(GetTmuxSettings()...) 27 lines later at :1345, and the same pairing exists after NewSession at instance.go:783, :862 and :5545. tmux.ReconnectSession itself has zero non-test callers. So the constructor default this PR adds should produce no user-visible delta — which makes me think the bar you are seeing survives for a different reason. My hypothesis for the real gap: buildStatusBarArgs (internal/tmux/tmux.go:2649) returns nil when inject_status_line is false, so agent-deck never emits Three asks:
#1779 merged, by the way — clean mechanism, clean evidence. Thanks for both. |
buildStatusBarArgs returned nil when injection was disabled, so agent-deck never emitted `status off`. Since tmux defaults every session to `status on`, a bar from that default (or the user's config, or a prior enabled run) survived untouched — the opt-out silently did nothing on any session that already showed a bar (asheshgoplani#687). Emit `set-option -t <session> status off` instead, unless the user set `status` explicitly in [tmux].options. Guarded by a revert-sensitive real-tmux eval that asserts #{status}==off after a session starts with injection disabled; a struct/argv unit test can't see this, which is how asheshgoplani#687 shipped.
fd64bf7 to
66aa9f5
Compare
|
You're right, and thanks for the careful read — I pushed a rework that drops my original premise entirely. I checked the four production construction sites and you're correct: they each call Your hypothesis was the actual bug: On your ask for real evidence over argv assertions: the guard is now a revert-sensitive eval beside the existing one, asserting what tmux actually reports: It starts a session with Diff is down to +127/−2 across |
What problem does this solve?
[tmux].inject_status_line = falsedoesn't actually remove the status bar.buildStatusBarArgsreturnsnilwhen injection is disabled, soConfigureStatusBarbecomes a no-op and agent-deck never emitsstatus off. But tmux defaults every session tostatus on, so a bar — from that default, the user's own tmux config, or an earlier run that had injection enabled — survives untouched. Turning the option off stops us setting a bar but never removes one, so the opt-out silently does nothing on any session that already shows a bar (#687).Why this change
When injection is disabled, emit
set-option -t <session> status offinstead of returningnil, so disabling the option actually turns the bar off. An explicit userstatusentry in[tmux].optionsstill wins (returnsnil, we don't override it), so a user who wants to manage the bar themselves can.This supersedes my earlier approach on this PR (seeding a process-wide
injectStatusLinedefault for the reconnect constructors). That was a no-op: all four production construction sites already callSetInjectStatusLine(GetTmuxSettings()...)explicitly right after building the session, andtmux.ReconnectSessionhas no non-test callers — so the constructor default never changed observable behavior. The real gap was the missing turn-off, not the constructor default.User impact
inject_status_line = falsenow removes the agent-deck status bar on every session — fresh or reconnected — rather than silently leaving a pre-existing one on. No change for the default (inject_status_line = true). A user who setsstatusexplicitly under[tmux].optionskeeps control of it.Evidence
The bug is invisible to a unit test that asserts on the struct field or the argv it just built — which is exactly how #687 shipped (see
tests/eval/README.md). So the guard is a real-tmux eval.TestEval_Session_BarOff_RealTmux(tests/eval/session) writesinject_status_line = false, starts a session under a real tmux server (which defaults tostatus on), and asks tmux itself:Revert-sensitive: with the
tmux.gohunk reverted (back toreturn nil), the same eval fails because the default bar survives —Unit coverage of the arg builder both ways (
internal/tmux):TestBuildStatusBarArgs_InjectDisabledassertsset-option ... status offis emitted;TestBuildStatusBarArgs_InjectDisabled_UserStatusOverrideasserts an explicit userstatusoverride is left alone.Sandboxed (production package):
The eval runs under its build tag, matching the existing
TestEval_Session_InjectStatusLine_RealTmux:AI disclosure
Model(s), if AI helped: claude-opus-4-8
Prompt / session log (optional): —
What actually bothered you
My human, running agent-deck with the status bar disabled, asked, verbatim: "there is a bottom ribbon (maybe from TMUX) that can be removed so it doesn't take place (both TUI and iOS)". They had set
inject_status_line = false, but the bar kept showing because disabling the option never actually turned tmux's status off.Checklist
HOME=$(mktemp -d) XDG_CONFIG_HOME= XDG_DATA_HOME= XDG_CACHE_HOME= go test ./...buildStatusBarArgsruns fromConfigureStatusBaron configure/reconnect, not per status poll — the change adds oneset-optionin the already-existing bounded batch, no measurable costSummary by CodeRabbit
Bug Fixes
Tests