Skip to content

fix(colima): Boot legacy overlay2 VMs and install missing Colima/Lima on start - #259

Merged
joshuarli merged 2 commits into
mainfrom
cursor/colima-start-legacy-and-install-38a1
Nov 20, 2026
Merged

joshuarli merged 2 commits into
mainfrom
cursor/colima-start-legacy-and-install-38a1

Conversation

@armenzg

@armenzg armenzg commented Nov 20, 2026

Copy link
Copy Markdown
Member

devenv colima start (which devservices up runs during devenv sync when Docker is down) failed in two ways on a Mac with an existing legacy overlay2 Colima VM and no devenv-managed Colima/Lima.

Bug 1: Lima's "no disk" warning is parsed as JSON

ERROR: Cannot safely start Colima: Lima returned invalid disk metadata for Colima. No backend setting was changed; repair the Lima installation and retry.

_legacy_root_disk() runs limactl disk list --json colima through proc.run(..., stdout=True), which merges stderr into the captured output. For a stopped legacy VM (disk: 512, runtime: docker, no rootDisk, no ~/.colima/_store/colima.json, no Lima data disk), Lima 2.2.1 exits 0, prints nothing on stdout and writes this to stderr:

time="2026-11-20T09:38:33-05:00" level=warning msg="No disk matching colima found."

json.loads choked on that line, so the VM never started. Ignoring the warning takes the existing no-data-disk path, which writes containerd-snapshotter: false and boots with overlay2 and the existing images intact.

Changes

  • Before json.loads, keep only output lines whose first non-space character is { or [. If none remain, there is no data disk (disk = None). The command tuple is unchanged.
  • If the remaining JSON still fails to parse, the StorageMigrationBlocked message now includes the captured output. It no longer says to repair Lima. It says to leave the Lima install and VM disks in place and to set docker.features.containerd-snapshotter in ~/.colima/default/colima.yaml.

Bug 2: missing devenv Colima/Lima aborts start

colima executable not found, try running devenv update (twice if this is your first time doing this) to install

colima.check() exits when colima is not on PATH, and only devenv update calls colima.install_global() / limactl.install_global(). On the affected Mac, Homebrew had Colima 0.7.5 and Lima installed but unlinked, and ~/.local/share/sentry-devenv/bin/colima did not exist, so devenv colima start could not recover on its own.

Changes

  • colima.start() now calls a new _ensure_global_tools() first. On macOS, if {root}/bin/colima or {root}/bin/limactl is missing it runs colima.install_global() and limactl.install_global(). If {root}/bin/docker is missing it runs docker.install_global().
  • The check() error now names ~/.local/share/sentry-devenv/bin and says a Homebrew Colima isn't used.

Tests

  • tests/lib/test_colima_storage.py:
    • A stopped legacy VM whose limactl output is only the warning line gets overlay2 (expected_snapshotter is False), writes containerd-snapshotter: false, and leaves the command tuple unchanged.
    • The warning followed by {"name":"colima"} is treated as a modern data disk and blocks.
    • Garbage JSON still raises StorageMigrationBlocked and the message includes the output.
    • start() calls the installers when the bin files are missing, and skips them when they exist.
  • The existing invalid-JSON test now uses {invalid. A bare invalid line has no {/[ prefix, so it is now treated as ignorable noise per the new rule.
  • tests/lib/test_colima.py patches _ensure_global_tools for its start() tests, so they don't try to install tools on a simulated Mac.

tests/test_main.py::test fails on the Linux test VM with "docker engine not installed", both with and without this change. Everything else passes (276 tests), as does uv run prek run --all-files. The ~/dev/sentry smoke test from AGENTS.md was not run, because it needs a Mac and this change doesn't alter devenv's Python pin or the Colima/Lima versions.

Open in Web Open in Cursor 

Ignore Lima's stderr "No disk matching colima found." warning (merged into
stdout by proc.run) when probing for a data disk, and include the output in
the error if the JSON is genuinely invalid.

Install devenv's Colima, Lima and docker CLI from `colima.start()` on macOS
when they are missing from devenv's bin dir, instead of requiring
`devenv update` first.

Co-Authored-By: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Armen Zambrano G. <armenzg@users.noreply.github.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Start test installs real global tools
    • Stubbed _ensure_global_tools in test_fresh_vm_containerd_store_survives_stop_and_start so start() cannot trigger real Colima/Lima/Docker installs on Darwin.

Create PR

Or push these changes by commenting:

@cursor push 4085470aa4
Preview (4085470aa4)
diff --git a/tests/lib/test_colima_storage.py b/tests/lib/test_colima_storage.py
--- a/tests/lib/test_colima_storage.py
+++ b/tests/lib/test_colima_storage.py
@@ -221,6 +221,7 @@ def run(command: tuple[str, ...], **kwargs: object) -> str:
     with (
         mock.patch.object(colima, "home", str(home)),
         mock.patch.object(colima, "root", str(root)),
+        mock.patch.object(colima, "_ensure_global_tools"),
         mock.patch.object(colima, "check", side_effect=lambda: next(statuses)),
         mock.patch.object(colima, "_start", side_effect=start_vm),
         mock.patch("devenv.lib.colima.proc.run", side_effect=run),

@@ -221,6 +221,7 @@ def run(command: tuple[str, ...], **kwargs: object) -> str:
     with (
         mock.patch.object(colima, "home", str(home)),
         mock.patch.object(colima, "root", str(root)),
+        mock.patch.object(colima, "_ensure_global_tools"),
         mock.patch.object(colima, "check", side_effect=lambda: next(statuses)),
         mock.patch.object(colima, "_start", side_effect=start_vm),
         mock.patch("devenv.lib.colima.proc.run", side_effect=run),

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit a95c024. Configure here.

Comment thread tests/lib/test_colima_storage.py Resolved
start() now installs missing Colima, Lima, and Docker before booting.
The containerd stop/start test patches only colima's root, so Lima and
Docker would install into the real devenv prefix on macOS.

Co-authored-by: Cursor <cursoragent@cursor.com>
@armenzg armenzg self-assigned this Nov 20, 2026
@armenzg
armenzg marked this pull request as ready for review November 20, 2026 18:11
@armenzg
armenzg requested a review from a team November 20, 2026 18:11
@joshuarli
joshuarli merged commit d3c3606 into main Nov 20, 2026
18 checks passed
@joshuarli
joshuarli deleted the cursor/colima-start-legacy-and-install-38a1 branch November 20, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants