cloud set-network-access: a slow server answers pending before the result deadline

Merged
TE
5d ago
+42-2

Fixes #28855, a follow-up from the review of #28270.

cmux cloud set-network-access runs a GET (up to 30 s) and then a PUT (up to 60 s) against the control plane, but the control socket gives action.run a 40 s result deadline. On a slow server the CLI or MCP caller timed out while the change still went through, so it never learned what happened.

A CLI, MCP or script run now uses CloudHandlers.result(..., pendingAfter:) with CloudHandlers.answerWithin (deadline minus 5 s), the same way the other long Cloud actions do. A run still going at that point answers machine_id, the requested network_access and pending: true, and the change keeps going. A person's run is unchanged.

Test: CloudNetworkAccessTests.aSlowServerAnswersPendingAndTheChangeGoesOn holds the GET open, checks for the pending answer, then releases the GET and checks that the PUT still runs.

Risk: low. One handler, and only the non-person path.

Leo asked about Cloud ergonomics and tightening up, quoted from the ask:

Also, what about all the various ergonomics things that I've been waiting on for, you know, cloud stuff, right? Like all the various ideas, all the various commands, all the tightening up, shoring up.

Leo-ask: ask-40c75490ac

šŸ¤– Generated with Claude Code

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 cmux cloud set-network-access timing out for CLI, MCP, and script callers when the control plane is slow. The command's GET and PUT could outlast the 40 s result deadline, so the caller timed out without learning that the change still went through.

Non-person runs now answer pending: true with machine_id and the requested network_access before the deadline, and the change continues in the background. Person runs are unchanged.