fix(cloud): warn before a Cloud VM disk fills, keep cmux-tui up on a full disk

AU
11d ago
+334-16

Summary

Fixes https://github.com/manaflow-ai/cmux/issues/18466. A Cloud VM's disk filled, cmux-tui stopped, and the hub answered "connection refused" for a day. Nothing warned beforehand, and freeing space alone didn't bring the machine back.

Warning before the disk fills. The Cloud sidebar now flags a machine whose live disk sample shows less than 10% free (never less than 2 GiB). An orange warning glyph appears after its name. The tooltip and accessibility label say how much space is left and what to do: cmux vm clean <id> (the dry-run-first cleanup from https://github.com/manaflow-ai/cmux/pull/21795) or a disk resize. The check reads the stats sample the row already shows, so it covers machines on every image, including ones created before the state reservation existed. An expired machine keeps its lock glyph. The check lives in CloudMachineResourcePresentation.lowDiskFreeMb (CmuxCloudMachines). Only a fresh awake sample counts, so a stale or sleeping reading never warns.

A full disk no longer stops the daemon. Images since https://github.com/manaflow-ai/cmux/pull/18446 keep cmux-tui state on a reserved ext4 image, and https://github.com/manaflow-ai/cmux/pull/18637 made cmux-tui-state-mount grow that image when it runs low. When growth failed (the root disk was full, or the image hit its 8 GiB cap), ensure exited non-zero and cmux-devbox-boot deferred the daemon on every restart. That is the same "connection refused" wedge. Now a failed growth is logged and the daemon starts on the room the state filesystem still has. Only less than 16 MiB free still defers it. Growth now runs where set -e doesn't apply, so each growth step returns its own failure explicitly.

Dropped from the earlier version of this PR: the image-manifest cmuxTuiStateProtection classification and the warning it drove, which showed permanently on every older machine. Every image promoted since that version was written lacks the field, so it would have marked current images as legacy. It also never looked at disk usage.

Running machines get the guest change only from a fleet upgrade (bun scripts/upgrade-fleet-cmux-tui.ts, which installs the current helper), and new machines get it only from the next image bake. Neither is part of this PR. The sidebar warning needs neither.

Testing

Regression for the guest wedge: cd web && bun test ./tests/vm-cmux-tui-state-mount.test.ts. It runs the real helper against a scratch root with stubbed df/losetup/resize2fs/fallocate.

  • Base script (1760b41eb4950, test only): 3 fail. With the root disk full and state below the growth threshold, ensure exits 1. The size-cap case also exits 1.
  • Head: 5 pass. Covers full root, size cap, a still-deferred under-16 MiB state filesystem, normal growth, and the no-op case.

Swift:

  • CloudMachineResourcePresentationTests: thresholds on small and large disks, overcounted usage, only live samples warn, invalid samples never warn.
  • MachinesPanelModelTests "A nearly full disk warns on the row…": glyph, tooltip, and accessibility label on a nearly full disk, and none on a roomy one.

Observed / Not run

  • Ran locally: the bun regression above (red on base, green on head). python3 scripts/verify-local.py: swift-syntax, xcstrings, localization, localization-defaults, app-source wiring, test wiring, and package groups passed. ./scripts/localize-changes and python3 scripts/localization_catalog.py check: 0 parity errors.
  • Fleet: the CmuxCloudMachines package tests (results below).
  • The cmuxTests row test runs in PR CI.
  • Not run: a live VM with a filled disk.

Changelog

Fixed: The Cloud sidebar warns when a machine's disk is nearly full, and a full disk no longer leaves a new Cloud machine unreachable.

Proof

Visual review on the exact head follows in a comment.

Localization: one new key, cloudTree.resources.lowDisk, translated for all nine macOS locales with both placeholders kept.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added low-disk warnings to Cloud machine rows, including available space and cleanup or resize guidance.
    • Added localized warnings in English, Arabic, German, Spanish, French, Japanese, Korean, Simplified Chinese, and Traditional Chinese.
    • Added accessibility labels and tooltips for low-disk alerts.
  • Reliability

    • Improved startup behavior when state-disk growth cannot proceed: startup continues when sufficient space remains and is deferred only when space is critically low.