cmux NEXT: machine name uses the local host name, not a DHCP/reverse-DNS gethostname
What was wrong
MacName fell back to the kernel host name (gethostname) for the machine identity. On a Mac on DHCP or with reverse DNS, gethostname returns a name like dhcp-10-0-1-5 or an ISP reverse-DNS label instead of the name the owner chose. So the name cmux shows for the Mac (sidebar, tab machine badge, composer) and the color hashed from it could be junk and could change from one network to the next.
Fix
MacName.hostName()(new): the Bonjour LocalHostName the owner set in System Settings > General > Sharing (SCDynamicStoreCopyLocalHostName, a configd read with no DNS lookup). It falls back to the kernel host name only when that is empty.displayName()and thecomputerName()fallback (resolve) now use it. The choice is a purenonisolated static func hostName(localHost:kernel:)/displayName(computer:localHost:kernel:).- The local daemon's identity fallbacks in
RemoteTerminalService.machineNameandRemoteTerminalService+Moves.sessionNameuseMacName().hostName(). - Unchanged on purpose:
linkDeviceName()(it names an existing Cloud link device, so renaming it would break linking), plusTerminalLinkResolverandServerReachService(they match every name the Mac answers to,gethostnameincluded).
Tests
MacNameHostTests in Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/MacNameTests.swift: the local host name beats a DHCP kernel name (in both hostName and displayName), and the kernel name is used when the local host name is nil, empty or blank.
- Red, test-only commit
47e124e6e94227a8d9f3d717c48da58390b28cf5: fleet stepaacfa5cfc5b52b1313c94dcf(cmux-ci log aacfa5cfc5b52b1313c94dcf): queued on the fleet; result to follow - Green, head
01377c63bc7c56aca452c5b1635fb1f03abba403: fleet step335fabd9a2fc03747410333d(MacNameTests,MacNameHostTests): queued on the fleet; result to follow - App compile, head
01377c63bc7c56aca452c5b1635fb1f03abba403:cmux-ci compile-check --appjobb9496797694eac539175fcdb: passed (61 s) - Local:
check-no-godfiles.sh --only swift --base origin/feat-cmux-nexton the changed files passes.crash_ratchet.pyhas no hits in this diff; its one hit (rust acpmux unwrap 179 -> 180) is on base.
No capture: name-source logic, no visual change.
Agent session: cosmic-gray
🤖 Generated with Claude Code
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the Mac machine name cmux shows (sidebar, tab badge, composer, and the color hashed from it) so it's the owner-set Bonjour local host name from Sharing, not the kernel host name, which DHCP or reverse DNS can replace with unstable names like dhcp-10-0-1-5.
- New
MacName.hostName()returns the local host name viaSCDynamicStoreCopyLocalHostName(no DNS lookup) and falls back to the kernel host name only when empty; it answers from a cached read done off the main actor, so main-actor paths never wait on configd. displayName(), the computer-name fallback, and the local daemon's identity fallbacks inRemoteTerminalServicenow use it.linkDeviceName,TerminalLinkResolver, andServerReachServiceintentionally keep the kernel host name.