Skip to content

Match smolvm's vCPU and memory limits - #493

Merged
jdc123 merged 3 commits into
mainfrom
amika/smolvm-limits
Sep 25, 2026
Merged

jdc123 merged 3 commits into
mainfrom
amika/smolvm-limits

Conversation

@jdc123

@jdc123 jdc123 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The amika-hostd daemon's POST /api/v1/machines check and the smol provider's resource check allowed machines smolvm won't give you. Both now match smolvm's limits (checked against smol-machines/smolvm d46264c):

  • vCPUs, 1-16. smolvm supports at most 16 vCPUs (MAX_EFFECTIVE_CPUS in src/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.
  • Memory, at least 64 MiB (still in whole MiB). smolvm refuses to boot a VM with less (MIN_MEMORY_MIB, enforced by VmResources::validate on 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-hostd provider wraps smol, 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 and 63 / 1024 GiB are rejected (the latter by the new minimum, not the whole-MiB check), and 64 / 1024 GiB is accepted and sent as memoryMb: 64.
  • Typecheck and lint are clean for both. Formatted with the pinned prettier 3.8.3.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
πŸ“ Code Review βœ… Completed 2026-09-25T19:55:39.366097Z d18d65b New commits
ℹ️ 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" or "@codex security review".

Codex reacts with πŸ‘€ while any review is running, comments if it has suggestions, and reacts with πŸ‘ once all reviews finish with no findings.

jdc123 added a commit that referenced this pull request Sep 25, 2026
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.
@jdc123
jdc123 force-pushed the amika/smolvm-limits branch from 484472c to 366eae9 Compare September 25, 2026 19:46
@jdc123 jdc123 changed the title Match smolvm's vCPU and memory limits Require smolvm's minimum machine memory Sep 25, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

πŸ’‘ 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 πŸ‘Β / πŸ‘Ž.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.
@jdc123 jdc123 changed the title Require smolvm's minimum machine memory Match smolvm's vCPU and memory limits Sep 25, 2026
jdc123 added a commit that referenced this pull request Sep 25, 2026
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.
@jdc123
jdc123 merged commit 3a6d9f9 into main Sep 25, 2026
4 checks passed
@jdc123
jdc123 deleted the amika/smolvm-limits branch September 25, 2026 20:01
jdc123 added a commit that referenced this pull request Sep 25, 2026
## 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
dbmikus pushed a commit that referenced this pull request Oct 23, 2026
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
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.

1 participant