iw start on a tmux server that already runs gives the pane that server's IW_* values #572
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
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#572
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
tmux builds a new session's environment from the server's global environment. The environment of the client process that runs
new-sessionreaches the server only when that client starts the server.TmuxAdapter.createSessionIn(core/adapters/Tmux.scala) passes the filtered map fromsessionEnvas the tmux client's process environment, withpropagateEnv = false. That filter takes effect only wheniw startitself starts the server. On a server that already runs, the pane gets the server'sIW_*values: plumbing names such asIW_COMMANDS_DIRorIW_PLUGIN_DIRS, and the server'sIW_HOME.How likely
Low. The server's global environment must hold plumbing names. That needs a server started by an
iwolder than1daf4fa0, or from a shell that exports those names. The IW-556 investigation created this state by hand; nothing shows it happens in practice.Reproduction script:
project-management/issues/IW-556/analysis.md, Defect 2 (iw-556-server-reuse.sh).Constraint for a fix
new-session -e NAME=valueoverrides the server's value, but it freezes the value for the session's life. Do not passIW_HOMEor any non-IW_variable that way: a developer's tmux config can remove such variables from the server on purpose, so the shell (fish) supplies a live value. See the superseded Decisions D1 and D2 in the IW-556 analysis. Removing only plumbing names with-e NAME=(empty value, whichiw-runtreats as unset) is the candidate;set-environment -uafternew-sessiondoes not change the first pane.Found while working IW-556.
Intake: needs-input
Workflow: diagnostic
Reason: G1 (1 CLARIFY marker)
Analysis: project-management/issues/IW-572/analysis.md on branch IW-572
1. When an iw session starts on a tmux server that already runs, how should iw remove the leaked internal IW_* paths? (G1)
A tmux server that runs already gives each new pane its own environment, and that environment can hold internal iw paths such as
IW_COMMANDS_DIRorIW_PLUGIN_DIRS. The agent'siwin that pane then loads code from a different place, and nothing reports it. The issue suggests an empty value for each session. A probe showed that in fish an empty inherited value hides a universal variable (set -Ux) that has the same name.IW_PLUGIN_DIRSis a documented user setting (README.md#L158). Full comparison: analysis.md#L250-L257. Probe results: analysis.md#L171-L172.new-session -e NAME=). Only iw's session changes. In iw panes, a user's fishset -Ux IW_PLUGIN_DIRSstops working. The assertions at start.bats#L169-L171 change from "name absent" to "no usable value".set-environment -gu NAME) in the same tmux call, beforenew-session. The names are absent, and fish universals continue to work. The cost: iw changes a server that it did not start, so sessions that are not iw sessions and start later on that server also lose these names. This also works when no server runs yet (review note 1).Recommended: b) — These internal paths are wrong in every pane, and the developer's tmux config already uses
-gufor the same fish reason.Answer in a comment on this issue, per number, for example "1: a", or in your own words; intake reads it on its next iteration.