Repository navigation
fix(fleet): reject hexadecimal CPU limits - #105158
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 12, 2026, 5:39 AM ET / 09:39 UTC. Summary PR surface: Source +1, Tests +4. Total +5 across 2 files. Reproducibility: yes. Current Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Merge the focused CLI-boundary fix after normal exact-head checks, while leaving CPU storage and downstream container argument construction unchanged. Do we have a high-confidence way to reproduce the issue? Yes. Current Is this the best way to solve the issue? Yes. Reusing the existing strict finite-number contract at the sole public CLI ingestion boundary is narrower and more maintainable than adding runtime-specific validation or changing the stored CPU type. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cc3dfc9ded87. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +4. Total +5 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
Merged via squash.
|
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Summary
fleet create --cpuswith the shared strict finite-number parser.1.5and add regression coverage.What Problem This Solves
openclaw fleet create tenant-a --cpus 0x10previously usedNumber(value). The check interpreted the token as16, then returned the original0x10string and eventually forwarded it to Docker or Podman as--cpus 0x10.That turned a precise CLI input error into a late, runtime-specific failure after fleet setup had started. The fix performs strict decimal/scientific parsing at the public option boundary.
User Impact
Hexadecimal CPU syntax now fails immediately with
--cpus must be a positive number.Valid positive fractional limits continue through the existing fleet runtime path.Origin / follow-up
fleet create --cpusremained a permissive numeric boundary and could pass an invalid original token into the container command.Competition / linked PR analysis
Searched open PRs and issues for
fleet cpus,fleet create cpus,hexadecimal cpus, andstrict cpusbefore implementation and immediately before proof. No equivalent open change was found.parseCpusboundary.--cpus <count>CLI option changes; its default, positive fractional values, and downstream runtime object remain unchanged.Merge risk
src/cli/fleet-cli/register.test.ts.Number(value)as a predicate, so it validated a broader grammar than the unchanged string later passed to the container runtime.src/cli/fleet-cli/register.tsis the sole shipped production creator and owns the public option boundary;parseStrictFiniteNumberis the shared normalization contract.--cpus 0x10rejects;--cpus 1.5remains accepted.Real behavior proof
fleet create --cpusCLI token) → ingestion/normalization (CommanderinvokesparseCpus) → runtime object (FleetCreateOptionsandCellContainerProfile) → request/effect (Docker/Podman subprocess receives the--cpusargument).parseStrictFiniteNumber; no provider-owned constraint applies.registerFleetCliparsing forfleet create proof-tenant --cpus 0x10 --no-start, then repeated with fractional control--cpus 1.5.Review findings addressed
No reviewer findings yet. Pre-submit review confirmed that fractional CPU values are an intentional control case, so the fix uses strict finite-number parsing rather than an integer-only parser.
Regression Test Plan
0x10case resolved instead of rejecting on the pre-fix implementation.oxfmt --checkpassed for both changed files.oxlintpassed for both changed files.Risk / Compatibility
Low. The change removes accidental JavaScript coercion without narrowing documented positive fractional CPU values.
What was not changed
Root Cause
The parser used
Number(value)only as a predicate but returned the original string. For0x10, the predicate saw the valid number16while the downstream runtime received the different token0x10. Strict parsing at the external boundary keeps validation and transported syntax aligned.This is not a downstream fallback: it fixes the source invariant where untrusted CLI text is converted into the trusted fleet runtime object. Once the token leaves that boundary as
cpus: string, no later consumer can distinguish an intentionally supported value from syntax accepted only by JavaScript coercion.