Skip to content

Cloud start: copy again on the machine's new link after updating it - #31087

Merged
teamleaderleo merged 1 commit into
feat-cmux-nextfrom
cloud-recopy-fresh-socket
Nov 1, 2026
Merged

teamleaderleo merged 1 commit into
feat-cmux-nextfrom
cloud-recopy-fresh-socket

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

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 ff3f8c9 (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.onlyTheMachinesOutdatedRefusalUpdatesItBeforeCopyingAgain now 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 --app at the head.

Agent session: agent session

🤖 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 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.

Written for commit 87bfa16. Summary will update on new commits.

View guided diff Turn on auto-fix

A chat start whose copy the machine's older cmux-tui refused (machine_outdated)
updates the machine and copies again. The update restarts the machine's daemon
and its link comes back on a new socket, but the second copy reused the socket
read before the update and failed: "cannot connect to .../cmux-link-....sock:
No such file or directory (os error 2)" (capture at ff3f8c9, 2026-11-01).

CloudOutdatedMachine.copy now reads the socket for each copy and, after an
update, waits (up to 90 s) for the connection's handshake key to change before
reading it again. CmuxNextApp shrinks by one line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

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

Review 87bfa16: 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=pr31087 -f ref=cloud-recopy-fresh-socket -f platform=macos -f backend_mode=local

Shipped in:

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 1, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (subagent claude-opus-5-5 medium): SHIP at 87bfa16

No blocking findings. Three follow-ups are filed as one issue.

@teamleaderleo
teamleaderleo merged commit e56d4e1 into feat-cmux-next Nov 1, 2026
162 of 172 checks passed
@teamleaderleo
teamleaderleo deleted the cloud-recopy-fresh-socket branch November 1, 2026 15:48
lawrencecchen added a commit that referenced this pull request Nov 1, 2026
…servable macro can name it (#31117)

CmuxNext test compile at the feat tip 6dee40a (job 93d8d8e613bc7df8e78570b6):
CloudStartChatMachineTests.swift:224:2: error: 'Link' is inaccessible due to 'private' protection level
(in macro expansion @observable). The @observable macro emits an extension at file scope that names the
type; a private nested class is not visible there. fileprivate keeps it out of every other file.

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 87bfa169 Deployed Nov 1, 2026 by teamleaderleo via wait for same-key tree publisher #96735
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