fix(tmux): fall back to GT_TOWN_ROOT in sessionPrefixPattern#3448
Open
A3Ackerman wants to merge 1 commit intogastownhall:mainfrom
Open
fix(tmux): fall back to GT_TOWN_ROOT in sessionPrefixPattern#3448A3Ackerman wants to merge 1 commit intogastownhall:mainfrom
A3Ackerman wants to merge 1 commit intogastownhall:mainfrom
Conversation
PR gastownhall#3306 introduced stale-binding detection that re-evaluates sessionPrefixPattern() on every SetCycleBindings call. But this function only reads GT_ROOT, which is never set in the daemon process env on a clean start — the daemon sets GT_TOWN_ROOT in tmux global env (for run-shell subprocesses) but not via os.Setenv(). This causes sessionPrefixPattern() to return only ^(gt|hq)-, missing qc-*, bw-*, and other rig prefixes entirely. Fix: - daemon.go: os.Setenv("GT_TOWN_ROOT") at startup so Go code in the daemon process can read it - tmux.go: sessionPrefixPattern() checks GT_TOWN_ROOT as fallback when GT_ROOT is empty Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sessionPrefixPattern()only readsGT_ROOTto discover rig prefixes for cycle keybindings. On daemon startup,GT_ROOTis never set in the Go process env — the daemon setsGT_TOWN_ROOTin tmux global env (for run-shell subprocesses) but not viaos.Setenv().sessionPrefixPattern()to return only^(gt|hq)-, soC-b n/p/g/abindings miss sessions from other rigs (e.g.,qc-*,bw-*).Fix:
daemon.go: callos.Setenv("GT_TOWN_ROOT", config.TownRoot)at startup so Go code in the daemon process can read ittmux.go:sessionPrefixPattern()falls back toGT_TOWN_ROOTwhenGT_ROOTis emptyGT_TOWN_ROOTfallback pathTest plan
go build ./cmd/gtgo test ./internal/daemon/— passesgo test ./internal/tmux/ -run TestSessionPrefixPattern— all 3 tests pass (including new fallback test)gt upon clean start → verifyC-b n/pcycles through all rig sessions🤖 Generated with Claude Code