Cloud start: copy again on the machine's new link after updating it
What
When a machine's older cmux-tui refuses the folder copy (machine_outdated), a Cloud chat start updates the machine and copies again. The update restarts the machine's daemon, so its link comes back on a new socket. The second copy still used the socket it read before the update, so it failed.
Evidence
A DEV capture of build ff3f8c9b (cloud-proof integration, 2026-11-01) sent to a fresh machine, cloud-chats-2. The machine's daemon was upgraded at 15:26:27ā33. Then the card failed with:
Couldn't copy the folder to cloud-chats-2: cannot connect to /var/folders/_2/ā¦/T/cmux-link-1c5fe16010a3.sock: No such file or directory (os error 2)
CloudStartChat read machine.daemon.connection?.endpoint?.socketPath once, before CloudOutdatedMachine.copy. CloudMachineUpdates.updateNow ā reconnectAfterUpdate ā connect(dropTicket: true) creates a new link socket.
Fix
CloudOutdatedMachine.copy(CmuxNextCloud) reads the socket for each copy.- After an update, it waits up to 90 s (
CloudWait.holds) for the connection's handshake key (CloudMachineUpdates.handshake) to change from its value before the update. Then it reads the socket again. - If either read finds no connection, the start fails with "not connected" as before. That failure now comes inside the copy's catch, so it shows as a copy failure with Retry.
- CmuxNextApp shrinks by 1 line (arch-ratchet:
app_lines -1).
Overlap
#30655 (open, same lane family) changes the same CloudOutdatedMachine.copy call in CloudStartChat.swift. Whichever lands second needs a small rebase there.
Tests
CloudStartChatMachineTests.onlyTheMachinesOutdatedRefusalUpdatesItBeforeCopyingAgainnow also checks that the second copy uses the new socket.- New:
theCopyAfterAnUpdateWaitsForTheMachinesNewLink. The link drops during the update and comes back after it returns; the copy waits for it. It also checks that nothing copies while the machine is not connected. - Fleet compile check:
cmux-ci compile-check --appat the head.
Agent session: agent session
š¤ 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 a chat start that copies a folder to a just-updated machine failing because it reused the machine's old link socket, which the daemon restart had removed.
The copy now reads the machine's socket for each attempt, and after an update waits up to 90 seconds for the connection's handshake key to change before copying again. A missing connection surfaces as a copy failure with Retry instead of silently succeeding.