Repository navigation
fix(tmux): 修复 Codex 和 Claude Code 会话定位及窗口跳转 - #373
Conversation
|
@codex review |
…rified The verified Codex path refused the jump with a modal alert whenever it could not prove the pane: tmux outside the three known paths, no answer from the server, the session's process gone or its PID reused, a detached server, or several attached clients with the hook's client gone. main switched panes in all of those cases. Resolution is now three-way. A pane found through the process tree (or the one live Codex pane showing the session's title) is selected. Only a live process that runs outside every pane of the server, with no unique title match, is refused: there the hook's pane is known to be another session's. Anything that can't be checked falls back to the hook's pane, like every other source. The client to switch is one already showing the pane's session (the hook's client first), else the hook's client, else the only client; with none of those tmux picks, as switch-client without -c always did. The isolated-server test now uses a socket path it owns and removes the socket file tmux leaves behind after kill-server. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The alert was hard-coded English in an app that ships seven languages,
and its text ("keep the session open with a distinct title") no longer
fits most of the cases that used to reach it. It now only appears when
the hook's pane is known to be another session's and no single Codex
pane shows this session's title, and says exactly that, in all seven
tables. A modal alert can't run under XCTest, so tests skip it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dropping "codex" from sourceToNativeAppBundleId stops a running Codex.app from stealing a CLI session's jump, but ESP32FocusCoordinator reads the same map for Buddy's focus button when the agent has no card at all, so pressing the Codex button stopped raising Codex.app. Sessionless callers now ask desktopAppBundleId(forSource:), which still knows Codex. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fill backfillClaudeTerminalMetadata runs from tryMonitorSession, which every hook event and every discovery scan reaches. Its guard passes whenever tmuxPane is nil, so for every Claude session outside tmux (most of them) it re-read the process's whole environment on the main actor with each event, forever, without anything new to find: an environment is fixed at exec. The process whose environment was read is now remembered per session, as hostHarnessProbes does for the harness probe (wxtsky#321), and forgotten with the session. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Splits the settings/menu-bar part of this PR out of the tmux fix: the always-on MenuBarExtra replaces the status item that only appears with "Auto-hide When No Active Session" (wxtsky#39), which is a product change of its own. AppDelegate.swift and CodeIslandApp.swift match main again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The app's only scene is Settings { EmptyView() }; the real settings are
SettingsWindowController's window. While that window is open the app is
a regular app with a menu bar, and the generated "Settings..." item (and
Cmd-,) opened the empty scene as a blank window. That command now opens
the real window. Reopening the running app (Finder, Spotlight, Dock)
shows the real settings too, with the reopen handler from cynicalight's
wxtsky#373, without the always-on menu bar item that PR also added.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
testLiveSavedSessionsWhenRequested and testLiveClaudeProcessesWhenRequested only ran with CODEISLAND_TMUX_FIXTURE / CODEISLAND_CLAUDE_FIXTURE pointing at a JSON dump of one machine's sessions. They hard-code the Homebrew tmux path and Ghostty, read the real tmux server and process environments, and skip everywhere else, so they test nothing in CI. The resolution logic they exercised is covered by the injected-process-tree tests and the isolated tmux server test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…us pane When a Codex session's hook pane is known to be another session's and no single Codex pane shows its title in its folder, the jump showed a modal NSAlert: CodeIsland took focus from the terminal and the panel was blocked until it was dismissed. It now brings the session's terminal app forward at app level (no tab, window or tmux pane picked, CodeIsland stays in the background), and leaves tmux as it is. The alert's two strings leave all seven L10n tables. The jump now asks CodexTmuxRouting.resolution(for:tmuxPath:), which only second-guesses Codex sessions in a tmux pane, so the visibility check can share it next. Co-Authored-By: Claude Opus 5.5 <[email protected]>
TerminalVisibilityDetector checked the hook's tmux pane, which for a Codex session in a shared background process is the pane that process started in: Smart Suppress and follow-up reminders could treat one session's pane as another's. Its tab-level check now asks the same CodexTmuxRouting.resolution(for:tmuxPath:) as the jump: the located pane is the one checked, and an ambiguous session is never visible. Jump validation (auto-collapse after a jump) was "tab visible or terminal frontmost", so a jump that could only raise the terminal would still count as landed. It now goes through didJumpLand: the session's tab showing, or its terminal in front only when the session is locatable. That is a new Probe member, isSessionLocatable, defaulting to true, so test probes keep answering as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
感谢 @cynicalight!用进程树定位 pane、共享后台进程时用标题 + 目录兜底、无法确定时不乱跳,这个思路很好,隔离 tmux server 的测试也写得很用心。审查后我们在你的分支上补了几个提交,已合并为 b31282b,会随下个版本发布。 tmux 定位
其他 设置窗口和菜单栏(303d52d、bab8232) 常驻菜单栏图标这次没有保留。按 #39 的设计,菜单栏图标只在开启"无活跃会话时自动隐藏"后出现:那时灵动岛完全隐藏,图标是唯一的入口;其他时候灵动岛本身(面板里的设置按钮)就是入口,不需要再多占一个菜单栏位置,带刘海的 MacBook 右侧菜单栏空间本来就紧张。如果以后要做常驻图标,更适合做成一个设置项,并复用现有的 全量测试已通过(App 1313 项、Core 889 项)。 还有两个问题想请教:
再次感谢! |
…jumps land on each session's pane (#373) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
抱歉,“共享后台进程”这个说法不够准确。我们当时看到多个 Codex session 被记录成同一个 PID 和 pane,就推测它们共用了后台进程,但没有验证具体原因,所以目前无法提供对应的版本和启动方式来复现这个推测。 我自己的 Codex 不是通过 npm 安装的,本机测试能正常匹配。之前没有考虑到 npm 安装后显示为 |
这次修改主要修复了在 Ghostty + tmux 中使用 Codex 和 Claude Code 时,会话跳到错误窗口或找不到对应窗口的问题。
验证情况:
共享后台进程的会话如果标题重复、无法唯一匹配,或者无法确定 tmux 客户端,目前会提示无法定位,不会猜测目标窗口。