cloud: a create may set the machine's idle pause (POST /api/vm idlePauseMinutes)

Merged
TE
11d ago
+107-9

Leo (2026-10-25, via claude-sr2): "One command for a persistent machine: cmux cloud new-machine --persistent --size ..., with built-in bootstrap, no idle pause, and automatic acpmux and fleet-registry enrollment. Then use it to create the lane VMs in machines/lane-vms.md, and make lane-place able to create them on demand."

The server half of --persistent. POST /api/vm takes an optional idlePauseMinutes ("off", 0, 15, 30, 60 or 120, the same values as PUT /api/vm/{id}/idle-pause) and stores it on the new row's insert (providerMetadata.cmuxIdlePauseMinutes, the key the idle cron and the PUT already use), before any provider call. The answer carries idlePauseMinutes.

  • A same-key retry answers the first create's row and never changes it (the value rides on the insert, not a write after it).
  • A bad value is a 400 invalid_idle_pause with details.field, before admission and the provider.
  • No field: unchanged, the default applies.

The app half (cmux cloud new-machine --persistent --size --name --bootstrap-script) is the companion PR on lane/pm-newmachine-cli.

Changelog

none

Observed / Not run

  • Ran: bun test tests/vm-idle-pause.test.ts tests/vm-agent-updates-workflow.test.ts tests/vm-create-option-policy.test.ts (53 pass, 2 DB tests skipped locally), bun run typecheck, bun run lint:complexity, bunx eslint on the changed files: clean.
  • Not run locally: the DB-gated test (a create stores its idle pause with the row, and a same-key retry keeps the first one); it runs in ci-web's Database behavior tests.

Risk: normal (one optional create field; no migration; the key already exists on rows).

Agent session: acpmux 01a1756f-4a01-79f0-a405-561d20fd162c on gcp-agent-lane-1 (pm-newmachine, helper of p0-machines)

šŸ¤– Generated with Claude Code


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