cloud.startChat: the machine pick never takes a fleet VM made under the person's account

Merged
TE
6d ago
+106-5

Leo's first real Cloud send (DEV build from c752f764) failed: "The provider rejected Claude Code's credentials on this Cloud machine. Set them up again to continue."

Root cause

cloud.startChat's automatic pick (cmux link start-chat plan, link/start_chat_cli/pick.rs, #29582) takes a free machine the person created. sr2-tunnel-probe is a probe VM our fleet tooling made under Leo's own account: created_by is Leo and it had no chat open, so the pick took it. That machine has no Claude login of Leo's (no ~/.claude/.credentials.json), so its launcher resolved team mode through /etc/cmux/model-plane.env (CodeRouter, whose team token is revoked) and the provider refused it. #29771's login handoff never ran there either (guest kind team; a separate PR covers that).

Change

  • pick::is_fleet: a machine tagged fleet or infra (a tags field the App can pass once machines carry the tag), or named (title or slug) under fs-, sr2- or lane-vm- (fs-lane-N, fs-peer-N, fs-firstsend-..., sr2-tunnel-probe). The pick never takes one, and a workspace's kept machine that is one is dropped.
  • Unchanged: only machines the person created (or an earlier send of theirs used, when the server names no creator) are taken; with none free, a new cloud-chats machine is made.

Tests

  • fleet_vms_under_my_own_account_are_never_picked: Leo's fleet names (connected and idle-paused), tags, and his own idle zesty-indigo-lemur taken over them; names that merely contain the words are not fleet ones.
  • a_teammates_idle_machine_and_none_of_mine_makes_a_new_one: a teammate's idle machines, a creatorless one and a fleet probe give Destination::New, with and without a workspace.
  • The workspace drop test gains the fleet case.

Risk: low. Rust-only, pick filter only; a user machine named fs-... would no longer be auto-picked (it stays choosable by hand).

Agent session: agent session


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


Summary by cubic

Fixes the cloud.startChat machine pick so it never selects fleet VMs made under the person's own account, which caused credential rejections.

A pick previously took any free machine the person created, so Leo's first Cloud send opened on sr2-tunnel-probe, a probe VM fleet tooling made under his account. That VM signs in as the fleet (CodeRouter), not as the person, so the provider refused the credentials. The pick and a workspace's kept machine now skip fleet VMs: those tagged fleet or infra, or named under fs-, sr2- or lane-vm-. When no personal machine is free, a new one is made instead.

Side effect: a personal machine named fs-... is no longer auto-picked, though it stays choosable by hand.