Set FORGE_CHANNEL on the tmux session, not the ttyd unit #24
No reviewers
Labels
No labels
bug
docs
enhancement
good first issue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pedromcaraujo/forge!24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-forge-channel-env"
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?
Closes #22.
The bug
FORGE_CHANNELnames the wrong channel in every session but one.The channels share one long-lived tmux server, spawned by whichever ttyd
starts first.
new-session -Acarries only tmux'supdate-environmentallowlist across, so a unit-level
environment.FORGE_CHANNELreaches the ttydprocess but never the tmux session. What a pane inherits is the server's
environment — the first channel's value, for everybody.
Live on nix-dev, all four sampled channels:
...yet a process inside session
forgeprintsFORGE_CHANNEL=vault. The stalevalue arrives through the process tree, not through tmux at all. It has never
worked as documented;
ttyd.nixstill advertised the broken contract.The fix
Per-session
-eonnew-session— the only spelling that's right for allchannels, since it's evaluated per session rather than inherited:
Removed the unit-level
environmentblock (with a comment saying why, sonobody re-adds it) and corrected the module header.
Why fix rather than close
No consumer exists today — Pedro's statusline is driven entirely by Claude
Code's own stdin JSON (
model,cwd, context window) and never reads it, andthere's no other reference in either repo. But this is a public module, the
contract is documented, and a variable that silently reports the wrong answer
is a worse thing to leave lying around than either a working one or none at
all. The fix is two lines.
Test plan
nix flake check.Inspected the generated launcher for two channels — correct
-eperchannel, properly quoted via
escapeShellArg.End-to-end against the same already-poisoned shared server the real
channels run on (its process env carries
FORGE_CHANNEL=vault):Caveat
Like the session command, this applies when a session is created.
-Aonto alive session leaves its environment alone, so existing channels keep the stale
value until recycled (
tmux kill-session -t <ch>then reconnect).