Skip to content

feat(badge): show the multiplexer a session runs in next to the terminal - #326

Merged
wxtsky merged 1 commit into
wxtsky:mainfrom
mutoe:feat/multiplexer-badge
Sep 1, 2026
Merged

wxtsky merged 1 commit into
wxtsky:mainfrom
mutoe:feat/multiplexer-badge

Conversation

@mutoe

@mutoe mutoe commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

A CLI running under tmux inside iTerm2 is labelled just iTerm2. The multiplexer it actually sits in is invisible on the badge, even though several sessions in the same terminal may live in different tmux panes — or different tmux sessions entirely.

The data is already there. From a real ~/.codeisland/sessions.json:

{"source":"claude", "termApp":"tmux", "termBundleId":"com.googlecode.iterm2",
 "tmuxEnv":"/private/tmp/tmux-501/default,27935,0", "tmuxPane":"%11", ...}

termApp is tmux, and tmuxEnv / tmuxPane are captured alongside it — activateTmux already relies on them for click-to-jump. But terminalName resolves from termBundleId alone, so it hits com.googlecode.iterm2 and returns "iTerm2"; the multiplexer layer never reaches the badge. Nothing in the collection path needs to change.

Change

SessionSnapshot.multiplexerLabel — the multiplexer layered on top of the terminal — rendered by TerminalBadge as a small chip after the terminal name, in the chip vocabulary already used by the queue counter and the AskUserQuestion header. Both the local and remote branches of the badge get it: SSH sessions are frequently inside tmux too.

The chip augments the terminal name, never replaces it — you still want to know it's iTerm2.

Two deliberate exclusions

cmux is not reported as a multiplexer. It is a terminal app, already named by terminalName (if lower.contains("cmux") { return "cmux" }). Reporting it again here would render the same word twice on one badge. There's a regression test pinning this.

screen is not covered. STY is never captured anywhere in the codebase, so supporting it means touching the hook collection path — a separate change. tmux and zellij both have their env vars already recorded, so they cost nothing.

Nesting

Nested multiplexers each leave their env vars behind, so multiplexerLabel returns the innermost layer — the one the CLI actually sits in. zellij inside tmux reads zellij. This matches how click-to-jump already treats the pair (see the zellij-inside-Terax handling in v1.0.31).

Tests

New SessionMultiplexerLabelTests, built test-first:

  • tmux inside iTerm2 → "tmux", and terminalName still "iTerm2" (the chip must not swallow the terminal)
  • zellij → "zellij"
  • zellij nested in tmux → "zellij" (innermost wins)
  • cmux → nil, with terminalName asserted as "cmux" (pins the no-double-render rule)
  • plain terminal → nil

Full suite green locally on macOS 26.4 / Xcode 26 (Swift 6.3.3): 890 tests, 2 skipped, 0 failures. swift build clean.

Note

Independent of #325 — different files apart from a non-overlapping region of NotchPanelView.swift, and either can merge first.

A CLI running under tmux inside iTerm2 was labelled just "iTerm2". The
multiplexer data was already captured — termApp is "tmux", with tmuxEnv and
tmuxPane alongside it — but terminalName resolves from termBundleId alone,
so the layer the CLI actually sits in never reached the badge.

Add SessionSnapshot.multiplexerLabel and render it as a small chip after the
terminal name, using the chip vocabulary already used by the queue counter
and the AskUserQuestion header.

Two deliberate exclusions:

- cmux is a terminal app, already named by terminalName. Reporting it as a
  multiplexer too would print the same word twice on one badge.
- screen is not covered: STY is never captured, so supporting it means
  touching the hook collection path, which this change does not.

Nested multiplexers each leave their env vars behind, so the innermost layer
wins — zellij inside tmux reads "zellij".
@mutoe

mutoe commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author
image

nguyenvanduocit pushed a commit to nguyenvanduocit/CodeIsland that referenced this pull request Aug 26, 2026
…badge, T-088 question card jump)

New open PRs on wxtsky/CodeIsland (Aug 25, 2026):
- T-088: PR wxtsky#325 — click question card to jump to asking terminal (medium, S; depends on T-036)
- T-087: PR wxtsky#326 — multiplexer badge chip on session cards (low, XS; depends on T-055)

Both gated on upstream merge. Upstream otherwise quiet 11 days since v1.0.32.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UXGjprGYFRNkJMwaYmddBJ
nguyenvanduocit pushed a commit to nguyenvanduocit/CodeIsland that referenced this pull request Aug 29, 2026
…1.0.32)

No new commits on wxtsky/CodeIsland or vibeislandapp/vibe-island since
Aug 26. Issues wxtsky#327 (Qoder) and wxtsky#328 (Codex) are non-Claude CLI specific.
PRs wxtsky#314, wxtsky#323, wxtsky#325, wxtsky#326 remain open and watching. No actionable items.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T4KU8w1bHuFtRzeNAvW1bn
@wxtsky
wxtsky merged commit c349241 into wxtsky:main Sep 1, 2026
wxtsky pushed a commit that referenced this pull request Sep 1, 2026
…al (#325)

Merged. Two things sold this over a third copy of the jump logic: `NotchCardKind.matches` closes the #308-class hole (an async jump landing after the panel swapped cards would otherwise collapse a live card the user never touched), and `testCollapsingAQuestionCardAfterAJumpKeepsItAnswerable` pins the property that actually distinguishes a jump from Skip. Leaving the question text non-clickable was the right call.

Verified locally on top of #326: build clean, 907 tests green.
wxtsky pushed a commit that referenced this pull request Sep 1, 2026
Merged — thanks, this is exactly the shape #239 was asking for.

I verified the contract against herdr's own source rather than taking it on trust, since a wrong CLI verb here would degrade silently:

- `HERDR_PANE_ID` / `HERDR_BIN_PATH` are set in `src/integration/env.rs` (`apply_pane_base_env`), and `HERDR_SOCKET_PATH` is `api::SOCKET_PATH_ENV_VAR` — so requiring the pane+socket pair before emitting anything is right, and it's what keeps a pane id from being aimed at herdr's default server.
- `herdr agent focus <target>` and `herdr agent get <target>` both exist (`src/cli/agent.rs`), and `resolve_agent_target` tries `parse_current_public_pane_id` first, so passing `HERDR_PANE_ID` as the target resolves.
- `agent get` returns `ResponseResult::AgentInfo { agent }`, and `agent_info` populates `focused: pane.focused` — so `result.agent.focused` is the right path for jump validation.

Degradation is the part I cared about most and it's handled: focus failing falls back to `activate(allowHerdr: false)`, and a missing/renamed binary just means the old behaviour.

Verified locally on top of #325/#326: build clean, 917 tests green.

Two follow-ups I'll push myself rather than hold this up:

1. `terminalName` returning `"Herdr"` now conflicts with #326, merged an hour ago: it added `multiplexerLabel`, whose rule is that a multiplexer chip *augments* the terminal name and never replaces it (tmux inside iTerm2 shows both). Herdr is a multiplexer in exactly that sense, so it should read `iTerm2` + a `herdr` chip rather than losing the host terminal.
2. `TerminalVisibilityDetector` routes on `identity(from:)` while `activate` routes on `shouldRoute`, which additionally excludes tmux/zellij panes. For zellij-inside-herdr the two would disagree — activation goes to zellij, validation asks herdr — so validation should use the same predicate.
wxtsky added a commit that referenced this pull request Sep 1, 2026
#323 and #326 landed within the hour and disagreed about what a
multiplexer does to the badge.

#326's rule is that the chip augments the terminal name and never
replaces it — a CLI under tmux inside iTerm2 reads "iTerm2 · tmux",
because you still want to know which terminal to look for. #323 made
`terminalName` return "Herdr" instead, so the same session in a Herdr
pane lost its host terminal entirely.

Herdr nests inside a terminal exactly the way tmux and zellij do, so it
belongs on the same side of that rule: `terminalName` keeps naming
Ghostty, `multiplexerLabel` names herdr.

Ordering follows `HerdrController.shouldRoute`, which already prefers a
tmux/zellij pane over the Herdr route: whatever the CLI actually sits in
is what the badge names and what a click jumps to. Extracted the
complete-pair check as `hasHerdrRoute` so the badge and the routing
identity cannot drift apart — half a route (pane without socket) would
aim at Herdr's default server, so it counts as no route at all.

Also routes `TerminalVisibilityDetector` through `shouldRoute` rather
than `identity(from:)`. The two agreed only because the zellij and tmux
checks happen to sit above it; making the predicate explicit means
jump validation can't start asking Herdr about a jump that was handed
to tmux.
@mutoe
mutoe deleted the feat/multiplexer-badge branch September 1, 2026 14:53
nguyenvanduocit pushed a commit to nguyenvanduocit/CodeIsland that referenced this pull request Sep 2, 2026
…88 to Todo

v1.0.33 released Sep 1, 2026. Three watched PRs merged:
- PR wxtsky#325 → T-088 gate cleared (question-card click-to-jump)
- PR wxtsky#326 → T-087 gate cleared (multiplexer badge chip)
- PR wxtsky#323 → T-086 gate cleared (Herdr pane-jump)

Also adds Sep 1 scout entry (upstream quiet, no changes).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DUc3EnTaiuJxwGonqaNwk3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants