Skip to content

cmux NEXT tabs: remote SSH and remote-localhost tab badges wear the machine's sidebar color - #24159

Merged
teamleaderleo merged 3 commits into
feat-cmux-nextfrom
machine-badge-color-from-host
Oct 22, 2026
Merged

teamleaderleo merged 3 commits into
feat-cmux-nextfrom
machine-badge-color-from-host

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

What was wrong

Machine identity (#22763) colors a tab's machine badge with MachineColor(name: item.machineName ?? badge). Plain terminal tabs on a remote tree set machineName to the machine's sidebar name, but two kinds of tab set only the badge text:

  • remote SSH terminal tabs (RemoteTerminalService.badge)
  • remote-localhost browser tabs (RemoteLocalhostService.badge)

Both badges show MachineRegistry.machineBadge, which for an SSH host is its destination (leo@huge-blue.tail1.ts.net gives "huge-blue"). The sidebar name is MachineRegistry.machineName, which for an SSH host is its label (for example "lab"). These tabs therefore hashed "huge-blue" and showed a different color from the machine's sidebar rows and composer chip, which hash "lab".

The fix

  • New MachineRegistry.tabColorName(_:badge:): when the badge is that machine's own short name, it returns the machine's sidebar name. It returns nil for any other badge (a "this Mac" chip) and for a machine not known here.
  • RemoteTerminalService.badge(for:) now returns the badge text together with that color name.
  • PaneController sets TabItem.machineName from it for remote terminals and remote-localhost browser tabs. TabCell is unchanged, and its ?? badge fallback still covers tabs with no known machine.

Evidence

  • Red (test-only commit 6776729): pending (fleet step 8383b9b6d6d16ada00f4c7fe, queued)
  • Green (head 064c81b): pending (fleet step 74051e3bcbb3406921dfadb9, queued)
  • cmux-ci compile-check --app at the head: passed (job 5231ff6c1a133534f5c7f7bc, 44 s).

Test: CmuxNextAppTests/TabMachineColorTests.swift adds an SSH host named "lab" at leo@huge-blue. It checks that the terminal badge and the remote-localhost badge both take their color from "lab", and that other badges and unknown machines keep the badge text.

No capture: the badge's color changes only for a remote SSH terminal or remote-localhost browser tab whose SSH host has a label different from its destination. No capture scene or showcase fixture has an SSH machine or a remote-terminal tab (CaptureSceneRegistry*, DebugShowcase), so a fleet capture would show the same stills before and after. TabMachineColorTests checks the color name instead. Badge text and layout do not change.

Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes remote SSH terminal and remote-localhost browser tab badges so they take the machine's sidebar color instead of hashing the badge text (an SSH host's destination, e.g. "huge-blue", rather than its label "lab"). Adds MachineRegistry.tabColorName(_:badge:) to return the sidebar name when the badge is the machine's own short name, and has RemoteTerminalService and PaneController feed it to TabItem.machineName. Other badges (a "this Mac" chip) and machines not known here keep the badge text's color.

  • RemoteTerminalService.badge(for:) now returns the badge text and its color name.
  • PaneController uses the color name for remote terminals and remote-localhost browser tabs; TabCell's ?? badge fallback still covers tabs with no known machine.
  • Adds TabMachineColorTests.swift covering SSH-host terminal and remote-localhost badges, plus "this Mac" and unknown-machine fallbacks.

Written for commit ea3f65b. Summary will update on new commits.

View guided diff Turn on auto-fix

teamleaderleo and others added 2 commits October 21, 2026 19:47
…bar name's color

An SSH host named "lab" at leo@huge-blue badges its remote terminal and
remote-localhost browser tabs "huge-blue"; the badge hashed that text and wore
another MachineColor than the machine's "lab" sidebar rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15bf1-fddf-7670-8279-1a511ab46d6f&host=cosmic-gray
… color

Remote SSH terminal tabs and remote-localhost browser tabs set only the badge
text (an SSH host's destination, "huge-blue"), so TabCell hashed that text and
the tab wore another MachineColor than the machine's sidebar rows and composer
chip (its label, "lab"). MachineRegistry.tabColorName gives the sidebar name
when the badge is the machine's own short name; PaneController sets it as
TabItem.machineName for both kinds. Other badges (a "this Mac" chip) and
machines not known here keep the badge text's color.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15bf1-fddf-7670-8279-1a511ab46d6f&host=cosmic-gray
@teamleaderleo teamleaderleo added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 22, 2026
@teamleaderleo

teamleaderleo commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator Author

Owned by orphan-sweep on air-blue · session

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review ea3f65b: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr24159 -f ref=machine-badge-color-from-host -f platform=macos -f backend_mode=local

red: cmux-next checks (god files, concurrency, crash safety, l10n); NEW: red check: Checks job structure (+1 more) is not red on the base 41f11ee; do not merge until green; see lane-rules

@blacksmith-sh

blacksmith-sh Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Found 9 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmppkd0vxqc/summary-missing.json (live):/summary-missing.json (live): View Logs
/tmp/tmpxqor17uu/summary-fail.json (live):/summary-fail.json (live): View Logs
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows/
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows
View Logs
[new_workspaces] the window draws no frames/[new_workspaces] the window draws no frames View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
View Logs
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs
test_every_part_of_bun_run_check_runs_in_the_warn_branch (main.WebviewsWarnSplitCov
ersCheck.test_every_part_of_bun_run_check_runs_in_the_warn_branch)/
test_every_part_of_bun_run_check_runs_in_the_warn_branch (main.WebviewsWarnSplitCov
ersCheck.test_every_part_of_bun_run_check_runs_in_the_warn_branch)
View Logs
test_every_submodule_free_checkout_on_an_owned_runner_resets_submodules (main.Reuse
dWorkspaceSubmodules.test_every_submodule_free_checkout_on_an_owned_runner_resets_submo
dules)/
test_every_submodule_free_checkout_on_an_owned_runner_resets_submodules (main.Reuse
dWorkspaceSubmodules.test_every_submodule_free_checkout_on_an_owned_runner_resets_submo
dules)
View Logs
test_every_submodule_free_checkout_on_an_owned_runner_resets_submodules (main.Reuse
dWorkspaceSubmodules.test_every_submodule_free_checkout_on_an_owned_runner_resets_submo
dules) (job='web-bundles')/
test_every_submodule_free_checkout_on_an_owned_runner_resets_submodules (main.Reuse
dWorkspaceSubmodules.test_every_submodule_free_checkout_on_an_owned_runner_resets_submo
dules) (job='web-bundles')
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-sznm7 created for this PR by the cmux coordinator.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (Codex GPT-6 at xhigh via acpmux on cmux16, correctness first): SHIP at ea3f65b

  • ea3f65b is a clean merge of feat-cmux-next (41f11ee, which includes cmux NEXT: machine name uses the local host name, not a DHCP/reverse-DNS gethostname #24172) into the PR. Its diff against base is the PR's 4 files.
  • Checked:
    • Browser tabs: RemoteLocalhostService.route resolves the tab's owning daemon, which matches the pane's daemon.
    • Terminal tabs: the badge text and the color name resolve the same session daemon. The local daemon gives nil, so those tabs keep the color of their badge text.
    • Cloud and server badges already equal their sidebar names.
    • Lookups are in-memory, with no added I/O or IPC.
    • The test APIs match head.
    • browserMachineBadge (the omnibar chip) does not set strip-item colors, so this is not a duplicate of it.
  • Fleet cmux-ci compile-check --app at ea3f65b: passed (job acfea114d0360c9521e3dbdb, 30 s).
  • Not fixed (P3, nonblocking): TabMachineColorTests exercises tabColorName directly, so removing the RemoteTerminalService.badge(for:) or PaneController wiring would leave it passing. A test through those call sites, including the "This Mac" fallback, would close that gap.

@teamleaderleo
teamleaderleo merged commit 54ec1ac into feat-cmux-next Oct 22, 2026
@teamleaderleo
teamleaderleo deleted the machine-badge-color-from-host branch October 22, 2026 09:24
teamleaderleo added a commit that referenced this pull request Oct 23, 2026
Conflicts:
- MachineRegistry: keep this branch's remoteDaemon(named:)/machine(named:among:)
  and base's tabColorName(_:badge:) (#24159); both are additive.
- AgentSessionWorkspace: base's #24162 group join (any same-named group that can
  hold the row) and predecessor-row reuse for the local open. The remote adopt
  now joins its group through base's AgentSessionWorkspace.join, so this
  branch's duplicate SidebarEdits.group(named:accepting:in:) and joinGroup are
  removed; AgentBypassBadgeTests checks AgentSessionWorkspace.group instead.
- agent_update.rs: keep the shared agent_session_start::is_chief; it now reads
  tags through base's panic-free JsonFields::field, as base's copy did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16040-fd0b-7dd0-9487-1a3a198d9f5c&host=cosmic-gray

This branch was previously deployed

1 inactive deployment
ci-routing-agent — ea3f65b8 Deployed Oct 22, 2026 by teamleaderleo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant