Cloud: share repository discovery, attachment and recovery across agent tools and CLI

Merged
TE
5d ago
+3364-10

Cloud chats need one repository contract for the UI and agents: discover a bare name, attach its clone to the current chat, and recover from missing GitHub access without another user message. This adds Rust daemon cloud.repo.list, cloud.repo.add, attachment/history reads and GitHub recovery waiting, exposed through cmux cloud repo, cmux mcp, and Cloud-only acpmux list_repos / add_repo.

Leo: “i want us to be able to do this too”; “and this kind of recovery”; “tho i think this kinda thing can be more ergonomic”.

Name resolution reads GitHub remotes from the Mac daemon's project registry, synchronizes only repository names over the existing authenticated machine link, then ranks recent Cloud attachments and the GitHub App catalog. Mac-authorized installation links travel with that catalog; VM credentials retain their existing read-only connector permissions. The machine calls the connector through its root agent socket's new github_repos key. Attached repo records and clone job IDs persist in versioned daemon projections; retries reuse the same clone job or attachment. Clones use only git-seed-v1 start/status, under ~/chats/<chat-id>/<name>.

The protocol and exact JSON are documented in plans/cmux-next/cloud-repo-actions.md. The matching app work synchronizes at startup and before repository actions, renders Session Info, and replays retry.args after cloud.repo.wait_github reports connected. The clone-only seed implementation and matching app forwarding are dependencies for the full DEV flow; development already enables the connector.

Validation: fake connector and Unix-socket seed tests cover resolution priority, ambiguity, public repos, every typed failure, automatic retry, job resume, persistence, and custom daemon sockets. Fleet Rust validation at 1de7deef1a2aeb0b646cc92bd5aad9118d718516 passed all 501 tests selected by scripts/ci/cmux-tui-rust-check.sh test repo, including the connector and repository adapters (fleet step 67595b9ab2eccde8a50507da). Static prepush passes. The broader local static runner reports existing localization parity and workspace package-grouping failures in untouched files.

Review follow-ups: #30388, #30391, #30392 and #30393 track tool discovery, timeout alignment, URL spelling and additional deadline coverage. Recovery, caller binding and completed-job persistence have immediate fix-forward commits prepared.

Risk: additive daemon/link surface, durable repository metadata and remote clone orchestration. Only authenticated Cloud machine links receive the remote actions; Mac-local discovery/remember are excluded from the link gate. Requests run on bounded workers; clone waits stop after nine minutes, connection waits after at most sixty seconds plus bounded socket I/O, and sockets/workers are released on completion. There is no idle timer. This coherent contract spans the host bridge, daemon, CLI and agent tools; its size includes fake transport and persistence tests, and splitting those surfaces would expose unusable intermediate actions.

Agent session: agent session