Repository navigation
cmux-next iPhone: identify a Mac by its machine id, never its name - #24167
Conversation
…ever its name Two cmux builds on one Mac register two devices; the phone must list that Mac once, found by the machine id every build registers. Same-named Macs on different computers stay two Macs, and the 30-day auto-hide is gone. These fail on the base: there is no machine id yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#24117 hid an offline Mac when another Mac of the same name and owner was online or seen later, and hid any Mac unseen for 30 days. A name is not an identity: several Macs can share one. The duplicate it was meant to fix was two cmux builds (a deleted dev build and the nightly) on one Mac, each with its own device id. - hostd registers a machine id: HMAC-SHA256 under a cmux key of the owner and the host UUID (gethostuuid), 16 bytes in hex. Every build on a Mac sends the same one; the raw hardware id never leaves the Mac. It also names the device ids of other builds it finds in Application Support (siblingDeviceIds). - Worker: devices.machine_id (migration 0003). POST /v1/devices validates and stores it; a sibling that is the caller's own Mac with no machine id gets this one, so the deleted build's record is listed as this Mac's. Every Mac list, hello and presence frame carries it. - Phone: MacRoster groups one owner's Macs by machine id and lists the most recently active build. No name matching, no 30-day rule; a Mac without a machine id is never folded. Links follow the same list. Settings > Devices still lists every build and marks the others. Builds stay separate devices: one shared device id would make two running builds replace each other's signaling socket, and would give a debug build the identity key phones pin for the release build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Mac that never sent one keeps the device and Mac list shapes older clients and tests pin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CMUX_NEXT_MOBILE_DEVICE_NAME (Debug builds, passed with open --env) is the name phones list this Mac by, so the rig can give two Macs one name and check that the phone still lists two. Also runs the machine-id link tests on the main actor, as the other coordinator suites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also dates migration 0003 before the open push-settings migration, so drizzle applies both whichever reaches a database first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rig.py takes MULTIMAC_DEVICE_NAME (the Debug name override, open --env), and several rig folders can share one mini. multimac_machine_id.py checks the Workspaces filter lists one row per computer by device id and Settings > Devices marks the other build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The other build on a listed Mac links when something names it (a Feed answer, a notification, a link it holds), so its asks are still answered; the focus stays on the listed build. - Same-name tags and Settings marks follow each team's list, as Workspaces. - The hub catches up on a sibling the database claimed earlier. - hostd writes a machine-id marker beside its device id and skips a sibling folder whose marker names another machine (Migration Assistant); validates CMUX_MOBILE_MACHINE_ID; never prints the host UUID; says when it has none. - Migration 0003 is dated when it was made, not ahead of the clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
red: cmux-next checks (god files, concurrency, crash safety, l10n); NEW: Tour of |
|
Found 9 test failures on Blacksmith runners: Failures
|
Review 1 (fresh correctness and security subagent) on 314e4c7: FIX, with every finding fixed in ca5861bThe reviewer read the diff only; it did not build or run tests.
Security, checked with no problem found:
|
…ext-ios-mac-machine-id
|
Bead |
- Workspaces and the Feed (showing nil) show the listed Macs only, so another build named once (a Feed answer, a notification) closes after the idle window instead of staying linked. - A presence frame for a Mac new to the list is the caller's own (the hub carries only the caller's Macs), so machine-id grouping applies at once. - The hub never replaces a machine id it has (as the database). - hostd does not write the machine marker for an override id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review 2 (fresh correctness and security subagent) on ca5861b: FIX, fixed in 67cb742The reviewer confirmed that the fixes for findings 2 through 9 of review 1 are in the code. It read the code only; it ran nothing.
Tests on 67cb742:
|
Review 3: /v1/me/macs (every 30 s) rebuilt each Mac without its machine id and owner, so two builds on one Mac were listed twice again until the next team list. DiscoveredMac carries both (the caller owns every Mac it lists) and keeps the team list's when a look has none. The Settings fallback rows carry their team, and PROTOCOL.md says when another build links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…est file iOS-only - Team.listedMacs (MacRoster) for the team's online count and dots, the sidebar and setup rows, and the new-workspace Mac picker (review 4). - The Demo driver keeps each Mac's machine id when it marks them offline. - MacMachineIDLinkTests is #if os(iOS), as the other coordinator suites: the macOS swift test leg has no LiveCoordinator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
Live check: one Mac per computer, whatever the nameSetup:
Deploy so far
Non-green checks on 1ec207f
|
Reviews 3 to 5 (fresh correctness and security subagents)Review 3 on 67cb742: FIX. One major finding: the
Review 4 on 1ec207f: SHIP. Its minors and nits:
Fixed with the review 4 changes: the Review 5, on the delta 1ec207f..01d60db: SHIP. Follow-ups, not blocking:
Tests on 01d60db, iOS simulator on mini-cmux8s: Model 174, Live 247, Chief 67, Workspaces 101, Shell 3, Onboarding 3, all pass. Rust and the Worker are unchanged since their last green runs (7, 75 and 82 tests plus clippy; 75 of 75 Worker tests plus tsc). Review (fresh subagent): SHIP at 01d60db |
|
Review (fresh subagent, correctness first): SHIP at 75bc7bc This reviews the merge of feat-cmux-next into the branch (75bc7bc). The PR's own diff is line-for-line identical before and after the merge. No raw |
|
Review (fresh subagent, correctness first): SHIP at ea61581 This covers the second merge of feat-cmux-next (ea61581). The PR's own diff is line-identical: 39 files, +1466/-161. The 447 merged base commits touch nothing under cmux-next-ios/backend and add no raw Non-green checks on this head, all base:
None of these files is in this PR. |
|
Review (fresh subagent, correctness first): SHIP at 2aac5fa This head is another base merge by the lander (parents ea61581 and the base tip 75673f9). The PR's own added and removed lines are identical to the reviewed diff (the same check the review of ea61581 ran), and the merged base commits change nothing under cmux-next-ios/backend. The non-green checks are the base reds listed in the previous comment. |
|
Merging with a merge commit. Every non-green check on 2aac5fa is also red on the feat-cmux-next tip (run 39898799506: "No new SwiftUI", "Crash safety", "Checks job structure", "Check the app FFI pin"; the PR shows a subset of these). The swift test and crash-class reds are in ImportSuggestionRowView and HoverCard files outside this PR. The app compile and risk evidence are green, and the SHIP receipt names this exact head. next-autoland counted the base red as "its own" because it probed only one check. |
The push settings migration becomes 0004_push_settings (0003 is now #24167's device machine id, already on dev and prod): file, journal idx 4 with a later when, and a 0004 snapshot whose prevId is 0003_device_machine_id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
#24117 hid a Mac from the iPhone app's Mac filter, Workspaces and Home in two cases:
A name is not an identity: "theoretically I could have several Macs with the same name." The duplicate it was meant to fix ("Abdulaziz's MacBook Pro (2) 39C6" offline beside "… 3EB7") came from two cmux builds on one MacBook: a deleted test build (
dev.cmuxterm.app.next.iostest) and the nightly (com.cmuxterm.app.nightly.cmux-next). Each build keeps its own device id in its own Application Support folder, so each registered as its own device.Design
Each Mac now says which computer it runs on (a machine id). The phone groups one owner's Macs by machine id and never by name.
Choice: builds stay separate devices, grouped on the phone (option b), not one shared device record (option a). One shared device id is not safe:
4000 replaced) in a loop.What the phone does with it:
MacNameDisambiguationtag.Machine id. HMAC-SHA256 under the key
cmux-mobile machine-id v1of<owner sub> NUL <host UUID>(gethostuuid, the IOPlatformUUID), first 16 bytes in lowercase hex.HostUuid'sDebugis redacted.The user's stale record. "… 39C6" will never register again (its build is deleted), so nothing would ever give it a machine id. hostd therefore also sends
siblingDeviceIds: thedevice-idfiles of other builds in~/Library/Application Support(<bundle>/cmux-mobile-host,<bundle>/cnx-host, at most 16).machine-idmarker beside its device id. A sibling folder whose marker names another machine (Migration Assistant, a restore) is skipped.Changes
machineIdandsiblingDeviceIdsonPOST /v1/devices.CMUX_MOBILE_MACHINE_ID(validated) andCMUX_MOBILE_APP_SUPPORT_DIRfor tests.devices.machine_id, migration0003_device_machine_id(one nullable column).siblingDeviceIdsonly with amachineId, at most 16 UUIDs. OmittingmachineIdkeeps the stored one.helloandpresencecarries it, and omits the key for a Mac without one, so older clients see the same shapes.MacDevice.machineID;MacRostergroups by machine id.touch), so its asks are answered on it.CMUX_NEXT_MOBILE_DEVICE_NAME(passed withopen --env) so the rig can give two Macs one name. Release builds ignore it.multimac_machine_id.py;rig.pytakesMULTIMAC_DEVICE_NAME.Migration ordering. The open rich-push worker branch adds
0003_push_settings. Whichever lands second renumbers to0004and takes a later journalwhen(now in the backend README). This migration'swhenis its real creation time.Tests
The failing tests were committed first (7cb0532) and run on that commit:
cmux_mobile_kit-test-ios.sh CmuxMobileModelTests/MacRosterTests CmuxMobileModelTests/SettingsRowsTests CmuxMobileLiveTests/MacMachineIDLinkTests, iOS simulator on mini-cmux11s. The base fails to compile: nomachineID, noSettingsDeviceRows.otherBuilds.rbx -- cargo test --locked -p cmux-mobile-host --test machine_id. The base fails to compile: nomachine_id,sibling_device_idsorDeviceRegistration.machine_id.vitest run test/machine-id.test.tson a mini. 7 of 7 fail on the base: the machine id is not stored, listed or validated, and siblings are not claimed.On the head (
ca5861b4e295and later):MacRosterTests: two builds on one Mac listed once; same-named Macs on two computers both listed; a Mac without a machine id never hidden; no 30-day rule; owner scoping; stable choice; per-team.SettingsRowsTests: other builds marked, per team.MacMachineIDLinkTests: one link for two builds; two links for two same-named computers; the other build links when touched; decoding.machine_id7,cmux-mobile-link --lib75,cmux-mobile-host --lib82, all pass.clippy -D warningson both crates is clean.tscclean,vitest run75 of 75 pass, including the hub catch-up after a missed claim.prepush-gate.py: no new violations.Observed / Not run
IPhoneHostService+Wiring.swift; the fleet build compiles it.No capture: this changes the iOS app's Mac lists, not Mac UI. The live-check stills are listed in the comment below.
Changelog
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
The iPhone app now identifies a Mac by its machine id rather than its name, so several cmux builds on one computer appear as one Mac, and same-named Macs on different computers stay separate. The previous behavior — hiding an offline Mac when another Mac had the same name and owner, and hiding any Mac unseen for 30 days — is gone.
0003_device_machine_id), validates it, carries it in every Mac list and presence frame, and gives a registering Mac's id to its siblings, so a deleted build's record is listed as this Mac's.Migration
0003_device_machine_id(one nullable column).0004and take a later journalwhen.Written for commit 2aac5fa. Summary will update on new commits.