Repository navigation
Match smolvm's vCPU and memory limits - #493
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
βΉοΈ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with π while any review is running, comments if it has suggestions, and reacts with π once all reviews finish with no findings. |
smolvm caps a machine at 16 vCPUs and can't boot one with under 64 MiB of memory, so a configured size now has to fit both, matching #493's machine checks.
The daemon's create check and the smol provider accepted any positive memory, but smolvm refuses to boot a VM with under 64 MiB (`MIN_MEMORY_MIB`), so a create that passed our check still failed in the runtime. Both now require at least 64 MiB.
484472c to
366eae9
Compare
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 366eae9124
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| z | ||
| .object({ | ||
| vcpus: z.number().int().min(1).max(255), | ||
| // smolvm can't boot a VM with under 64 MiB of memory. |
There was a problem hiding this comment.
Cap vCPU requests at smolvm's effective maximum
When a caller requests 17β255 vCPUs, the adjacent vcpus schema still accepts it, as does createMachineSchema.cpus in hostd, but smolvm only provisions up to 16 effective CPUs. The create therefore succeeds with substantially fewer resources than requested; lower both maxima to 16 and add rejection tests for 17 vCPUs.
Useful? React with πΒ / π.
There was a problem hiding this comment.
Fixed in d18d65b: both the daemon's createMachineSchema.cpus and the smol provider's vcpus now cap at 16, with rejection tests for 17 on each path.
smolvm runs a VM on at most 16 vCPUs (`MAX_EFFECTIVE_CPUS`) and only warns when asked for more, so a create for 17-255 succeeded with far fewer CPUs than requested. The daemon's create check and the smol provider now refuse more than 16.
The daemon now refuses machines with more than 16 vCPUs, smolvm's effective maximum (#493), so a configured size can't ask for more.
smolvm warns above 16 vCPUs on every host but only macOS's hypervisor caps there; on Linux the full count reaches libkrun. The comments now say that, and that we refuse more than 16 everywhere.
## Summary A BYOC host can now define the sizes its rigs use, in its TOML config, and `amika-hostd` sends them to Amika when it registers. Companion to gofixpoint/amika-mono#1334, which stores them on `app.hosts` and exposes them through the hosts API. ```toml [sizes.medium] vcpus = 4 memory_gib = 8 disk_gib = 40 # disk_grow_only = false ``` - **Config:** sizes are named freely. Each is held to the daemon's machine limits, so a size never promises what `POST /api/v1/machines` would refuse: 1-16 vCPUs and at least 64 MiB of memory in whole MiB. These match the daemon's machine checks once #493 lands: smolvm can't boot a VM under 64 MiB, and supports at most 16 vCPUs (only macOS actually caps there, but we refuse more on every host). - **Wire format:** the snake_case keys become `{ vcpus, memoryGib, diskGib, diskGrowOnly }`, the shape of a cloud provider's size in Amika. - **Registration:** `POST /hosts` now also sends `sizes`. Registering an existing host returns `200` and leaves it unchanged. So `up` and `register-url` then send `PUT /hosts/{id}` with the configured sizes, and editing the tables and rerunning `up` updates them. - **Old servers:** a server without amika-mono#1334 ignores the extra field, so this is safe to release before or after it. - **Docs:** `config.example.toml` documents the tables, and `AGENTS.md` describes the new registration steps. ## Testing `@amika/hostd`: 195 tests pass. Typecheck, lint and formatcheck are clean. The new tests cover: - parsing the tables - each rejected size - the request bodies of `registerHost` and `setHostSizes` - `up` updating an existing host's sizes, and not calling `PUT` for a new host - the example config resolving
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.3.0 to 8.0.2. ## Release notes Sourced from actions/download-artifact's releases. ### v8.0.2 ### What's Changed - Update the readme by `@danwkennedy` in actions/download-artifact#473 - Improves artifact download retries when the service returns HTTP 429 (rate limiting), including honoring valid Retry-After headers. - Update `@actions/artifact` to 6.3.1 by `@tunc-d` in actions/download-artifact#492 - Prepare download-artifact v8.0.2 by `@tunc-d` in actions/download-artifact#493 ### New Contributors - `@tunc-d` made their first contribution in actions/download-artifact#492 Full Changelog: actions/download-artifact@v8.0.1...v8.0.2 ### v8.0.1 ### What's Changed - Support for CJK characters in the artifact name by `@danwkennedy` in actions/download-artifact#471 - Add a regression test for artifact name + content-type mismatches by `@danwkennedy` in actions/download-artifact#472 Full Changelog: actions/download-artifact@v8...v8.0.1 ### v8.0.0 ### v8 - What's new [!IMPORTANT] actions/download-artifact@v8 has been migrated to an ESM module. This should be transparent to the caller but forks might need to make significant changes. [!IMPORTANT] Hash mismatches will now error by default. Users can override this behavior with a setting change (see below). ### Direct downloads To support direct uploads in `actions/upload-artifact`, the action will no longer attempt to unzip all downloaded files. Instead, the action checks the `Content-Type` header ahead of unzipping and skips non-zipped files. Callers wishing to download a zipped file as-is can also set the new `skip-decompress` parameter to `true`. ### Enforced checks (breaking) A previous release introduced digest checks on the download. If a download hash didn't match the expected hash from the server, the action would log a warning. Callers can now configure the behavior on mismatch with the `digest-mismatch` parameter. To be secure by default, we are now defaulting the behavior to `error` which will fail the workflow run. ### ESM To support new versions of the @actions/* packages, we've upgraded the package to ESM. ### What's Changed - Don't attempt to un-zip non-zipped downloads by `@danwkennedy` in actions/download-artifact#460 - Add a setting to specify what to do on hash mismatch and default it to `error` by `@danwkennedy` in actions/download-artifact#461 Full Changelog: actions/download-artifact@v7...v8.0.0 ### v7.0.0 ### v7 - What's new ... (truncated) ## Commits - `9000827` Merge pull request #493 from actions/tunc-d-prepare-download-v8-0-2 - `e455989` Prepare download-artifact v8.0.2 - `a00b90c` Merge pull request #492 from actions/tunc-d-download-artifact-package-bump - `29bb7ce` Update `@actions/artifact` to 6.3.1 - `484a0b5` Update the readme (#473) - `3e5f45b` Add regression tests for CJK characters (#471) - `e6d03f6` Add a regression test for artifact name + content-type mismatches (#472) - `70fc10c` Merge pull request #461 from actions/danwkennedy/digest-mismatch-behavior - `f258da9` Add change docs - `ccc058e` Fix linting issues - Additional commits viewable in compare view
Summary
The
amika-hostddaemon'sPOST /api/v1/machinescheck and thesmolprovider's resource check allowed machines smolvm won't give you. Both now match smolvm's limits (checked against smol-machines/smolvmd46264c):MAX_EFFECTIVE_CPUSinsrc/data/resources.rs). Above that it only logs a warning and passes the full count to libkrun. On macOS, Hypervisor.framework then runs the VM on 16, so a create for 17-255 succeeded with far fewer CPUs than requested; on Linux, KVM likely ran the full count. We now refuse more than 16 on every host, so a size behaves the same wherever it runs.MIN_MEMORY_MIB, enforced byVmResources::validateon the HTTP create path). So a create that passed our check used to fail in the runtime.Disk is unchanged: smolvm only requires more than 0 GiB, which we already enforce. The
amika-hostdprovider wrapssmol, so it picks up both limits. #492's TOML sizes match them.Testing
@amika/hostd(187 tests pass): 17 vCPUs and 63 MiB are rejected, and 64 MiB is accepted and forwarded.@amika/sandbox(444 tests pass): 17 vCPUs and63 / 1024GiB are rejected (the latter by the new minimum, not the whole-MiB check), and64 / 1024GiB is accepted and sent asmemoryMb: 64.