Repository navigation
feat(config): add worker.limits.cpu_ms per-project CPU limit - #299
Merged
Merged
Conversation
Adds a curated wrangler field to void.json so a project can set its own Workers CPU cap: - config.ts / schema.json: validate worker.limits as a strict object (unknown keys rejected) with cpu_ms an integer in 1..300000 - deploy manifest: carry limits.cpuMs (manifest version stays 3, the field is optional and additive) - emit limits into buildVoidManifest and buildFrameworkManifest; static manifests never carry limits - also copy the value into the Cloudflare vite-plugin worker config so the generated dist/ssr/wrangler.json enforces it on `void deploy --backend cloudflare` (adversarial-review finding) - docs: reference/config.md documents managed-platform semantics (deploys above the plan ceiling reject; only rollback clamps) and the self-hosted passthrough Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DF8p6MCmgiE7e3LM1J8EQV
Brooooooklyn
force-pushed
the
feat/worker-limits-cpu-ms
branch
from
August 28, 2026 16:02
fc361a5 to
c752d86
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c752d8694c
ℹ️ 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".
"No plan ceiling applies" on the self-hosted path was too broad. The Void plan ceiling is bypassed there, but the Cloudflare account's own CPU-time allowance still applies — Workers Free caps CPU at 10 ms per request whatever `cpu_ms` says, so a value this page called unrestricted could be constrained or rejected by Cloudflare. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Grrh3fMQxnc3MKfJWKg7Vv
Rollback clamps an over-ceiling value, but deploy rejects it. So a plan downgrade leaves a project whose stored cpu_ms is now too high unable to deploy at all until the value is lowered in void.json. Rejecting is the intended behavior — explicit config that exceeds the plan should fail loudly — but the consequence was undocumented. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Grrh3fMQxnc3MKfJWKg7Vv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
worker.limits.cpu_mstovoid.jsonso a project can set its own Workers CPU cap per request.{ "worker": { "limits": { "cpu_ms": 30000 } } }Context: platform plans cap Workers-for-Platforms
cpuMs(pro = 50 ms today). WASM workloads such as image generation need more. This gives the project a knob, and the platform clamps it to a per-plan ceiling (platform PR follows).Changes
config.ts+schema.json:worker.limitsvalidated as a strict object (unknown keys rejected),cpu_msan integer in 1..300000 (Cloudflare's hard maximum)limits: { cpuMs }field; manifest version stays 3, so old CLI / old API pairs keep workingbuildVoidManifestandbuildFrameworkManifest; static manifests never carry limitsdist/ssr/wrangler.jsonenforces it onvoid deploy --backend cloudflare(found by adversarial review: without this the knob silently no-ops on the self-hosted path)reference/config.mddocuments both paths; on the managed platform, a deploy above the plan ceiling rejects with 400, and only rollback clampsTests
config.test.ts: validation cases plus a schema-drift pin assertingschema.jsonbounds match runtime validationpackage.test.ts: manifest emission for all three buildersplugin-dev-asset-routing.test.ts: the merged Cloudflare worker config carrieslimits.cpu_mswhen configured, and nolimitskey otherwisepackages/voidsuite: 199 files passed, 3700 tests passed, 14 skipped (pre-existing gated live e2e)🤖 Generated with Claude Code
https://claude.ai/code/session_01DF8p6MCmgiE7e3LM1J8EQV
Note
Medium Risk
Changes how deploy manifests and generated wrangler config express per-request CPU limits, which can affect runtime behavior and plan/account enforcement on production deploys, though values are strictly bounded and the manifest field is additive.
Overview
Projects can now set Workers CPU time per request via
void.jsonunderworker.limits.cpu_ms(integer 1–300000 ms), with strict validation, JSON schema support, and docs for managed vs self-hosted behavior.The value flows into managed deploy manifests as optional
limits.cpuMs(void and framework packaging paths; static manifests omit it) and into the generated Cloudflare worker config /dist/ssr/wrangler.jsonforvoid deploy --backend cloudflareand direct wrangler deploys. Deploy CLI passes the setting from config into both packaging flows.Tests cover config validation, schema drift, manifest emission, and plugin worker config merging.
Reviewed by Cursor Bugbot for commit 59902dd. Bugbot is set up for automated code reviews on this repo. Configure here.