CPLAT-11161: resolve refs against the tmux window ccx runs in, not the client's active window - #148
Merged
Merged
Conversation
…lient's active window
CurrentWindowClaudes asked tmux for the client's active window
("#{session_name}|#{window_index}") and scanned only that window's panes
for Claude processes. A Claude session running in a background window of the
same client (common during a multi-window build) then matched sessions from
the foreground window instead of its own, so `ccx refs` surfaced unrelated
PRs or reported "no PR/Jira references found".
Walk this process's own PPID chain to the tmux pane that hosts it (reusing
the walkToPane/batchPPIDMap helpers MarkLiveSessions already uses) and pin
the window from that pane. The client-active window remains as a fallback
when the pane can't be determined (e.g. a wrapper re-parented the process
beyond tmux's view).
Extracted claudesInWindow/findPaneByPID so the window-selection logic is
testable without a live tmux.
Kairo-Kim
approved these changes
Jul 30, 2026
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.
JIRA: https://sendbird.atlassian.net/browse/CPLAT-11161
Problem
ccx refsresolved the session to scan by asking tmux for the client's active window (#{session_name}|#{window_index}) and collecting Claude panes only from that window. When a Claude session runs in a background window of the same tmux client (common during a multi-window build),ccx refsmatched sessions from the foreground window instead of its own — surfacing unrelated PRs or reporting "no PR/Jira references found in session".Reproduced
%143, windowlocal|9, cwd/Users/gavin.jeong/src/keyolk/ccxlocal|2(which contained a live Claude atsoda-k8s/.worktree/cohome)ccx refs→Error: no PR/Jira references found in session(scanned the soda-k8s session)ccx refs→ correctly lists this session's PRs (cohome-k8s#150,ccx#52/56/99,CPLAT-1234, …)Fix
CurrentWindowClaudesnow walks this process's own PPID chain to the tmux pane that hosts it (reusing thewalkToPane/batchPPIDMaphelpersMarkLiveSessionsalready uses) and pins the window from that pane. The client-active window remains as a fallback when the pane can't be determined (e.g. a wrapper re-parented the process beyond tmux's view).Extracted
claudesInWindow/findPaneByPIDso the window-selection logic is testable without a live tmux. AddedTestFindPaneByPIDandTestClaudesInWindowFiltersByWindow.Test plan
go build ./...go test ./internal/tmux/ ./internal/cli/ ./internal/session/ccx refs --plainfrom a background-window Claude session now returns that session's own refs