TmuxAdapter must refuse a missing tmux binary instead of throwing #432
Labels
No labels
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#432
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
TmuxAdaptershells out at seven sites and never checks thattmuxis on PATH.When it is not,
os.proc(...).callthrowsjava.io.IOException: Cannot run program "tmux", and os-lib spawns the childfrom its own thread, so the trace prints on
subprocess-shutdown-hook-monitorand cannot be caught by the calling thread.
Reachable today:
IW_WORKSPACE_BACKEND=tmux— or the default, since tmux is thedefault — on a machine without tmux.
iw startprints a stack trace instead ofthe clean error the command's
Eithertypes promise.HerdrAdapterclosed the same exposure in IW-422:Its scaladoc records why a
Tryis not sufficient.TmuxAdapterhas noequivalent. It went unnoticed because tmux is nearly always installed when
selected, while herdr can be selected by an environment variable alone.
Why this is not a one-line guard
The seven call sites return four different shapes, and each needs a decision
about what "tmux is missing" means:
sessionExistsBooleancurrentSessionNameOption[String]isInsideTmux,isCurrentSessionBooleancreateSession,killSession,sendKeysEither[String, Unit]attachSession,switchSessionEitheroverrunStreamingexit codeherdr routes everything through one
runHerdrhelper, which is why its guard isa single check.
TmuxAdapterhas no such helper. Introducing one — and decidingwhether a missing binary makes
sessionExistsfalse or an error — is the work.Acceptance
With
tmuxabsent from PATH, everyTerminalWorkspaceOpsmember on the tmuxbackend answers through its error channel and no stack trace reaches the user.
A test drives at least one member with the binary absent.
Origin
Recorded in IW-422's LESSONS.md alongside the herdr fix, which noted "this
affects every adapter, not only herdr". Confirmed during lessons triage: the
herdr guard exists, the tmux one does not. The general rule was promoted to
core/CLAUDE.mdand kanon note #178.