Skip to content

fix(core): accept gpu: 0 in resources - #198

Merged
userAugustos merged 8 commits into
mainfrom
fix/gpu-zero
Sep 25, 2026
Merged

userAugustos merged 8 commits into
mainfrom
fix/gpu-zero

Conversation

@userAugustos

@userAugustos userAugustos commented Sep 24, 2026 •

Copy link
Copy Markdown

Every canyonos deploy on main currently fails at config validation:

ERROR:canyonos_core:.car/config/global_controller.yaml:17: agents[0].resources.gpu: expected a finite number > 0, got the number 0
ERROR:canyonos_core:Configuration rejected: 7 problem(s) found; nothing was built.

#184 added the pre-deploy resource picker, which fills gpu: 0 for any agent that does not set it and writes the config back. #178 added the manifest schema, which requires gpu > 0. The two landed independently and contradict each other, so a config that does not already declare a positive gpu is rejected on every deploy. Behind the schema, cli._load_config has an older check with the same > 0 rule (Agent SplitAgent resource gpu must be a positive number.), so both are changed.

The runtimes already read a falsy gpu as "no GPU" (bool(resources.get("gpu")) in the global controller, if resources.get("gpu") before --gpus in the Local runtime), so gpu: 0 is a meaningful value, not a mistake. This makes both checks accept it: the gpu bound becomes inclusive (>= 0), while cpu and memory keep their exclusive > 0.

Repro: canyonos deploy on any project whose agents do not set resources.gpu (e.g. examples/portfolio), with the picker left at its defaults.

Verification: uv run --package canyonos-core pytest -q packages/core/tests/test_manifest_schema.py packages/core/tests/test_agent_declaration_schema.py packages/core/tests/test_cli.py — 139 passed.

Summary by CodeRabbit

  • Bug Fixes
    • Resource settings now handle zero values consistently: GPU may be set to zero to indicate no GPU, while negative GPU values are rejected.
    • Validation continues to reject booleans, non-numeric values, and non-finite numbers for resource settings.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3baf918d-3fcf-404a-927c-0913f1e5342e

📥 Commits

Reviewing files that changed from the base of the PR and between eab6c04 and ce8a5d9.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • packages/cli/canyonos/resources.py
  • packages/cli/tests/test_resources.py
  • packages/core/canyonos_core/cli.py
  • packages/core/canyonos_core/schema/manifest.py
  • packages/core/tests/test_cli.py
  • packages/core/tests/test_manifest_schema.py

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f5eb5791-f0be-40cf-b5af-7486d17b9540

📥 Commits

Reviewing files that changed from the base of the PR and between be91b2a and eab6c04.

📒 Files selected for processing (5)
  • packages/core/canyonos_core/cli.py
  • packages/core/canyonos_core/schema/_checks.py
  • packages/core/canyonos_core/schema/manifest.py
  • packages/core/tests/test_cli.py
  • packages/core/tests/test_manifest_schema.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Resource validation now allows zero for GPU values and rejects negative GPU values. The numeric checker supports inclusive floors. Tests cover GPU zero and invalid resource values.

Changes

Resource validation

Layer / File(s) Summary
Resource bounds and validation
packages/core/canyonos_core/schema/_checks.py, packages/core/canyonos_core/schema/manifest.py, packages/core/canyonos_core/cli.py, packages/core/tests/test_manifest_schema.py, packages/core/tests/test_cli.py
The numeric checker supports inclusive floors. Manifest validation allows GPU zero while keeping CPU and memory strictly positive. CLI validation allows zero for CPU, memory, and GPU, and rejects negative values. Tests cover these resource bounds.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to eab6c

The resource validation preserves positive CPU and memory requirements and permits GPU zero. No issue identified here needs to be resolved before merge.

Security Architecture Review

Security architecture risk: 🔵 Low · up to eab6c

Zero GPU now means no GPU across the checked validation and runtime paths. The change does not appear to grant GPU access or add a deployment entrypoint, but deployment access and production rollout conditions were not fully established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The checked effect is on agents deployed from a configured manifest. The newly accepted zero value does not request Local Docker GPU access; external authority to modify or deploy that manifest remains unverified.

Trust Boundaries and Controls

  • observed — Manifest validation remains before build generation. The changed GPU bound permits zero but not negative values, and the runtime’s GPU option remains conditional on a truthy value.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: allowing gpu: 0 in core resource validation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Saaketh0

Copy link
Copy Markdown
Collaborator

@userAugustos Basically if GPU is 0 it becomes None?

@userAugustos

Copy link
Copy Markdown
Author

@Saaketh0 kinda (?)

before we had the validation with minimum that required gpu > 0 now with float it accepts gpu >= 0

This doesn't change runtime, because existing code already supported 0 gpu

global_controller.py: wants_gpu = bool(ctrl.get("resources", {}).get("gpu")) this would just be False

and then no --gpus

the only thing was that we (I) added on the manifest PR this check of bigger than 0 gpu, which is wrong

basically the whole code already supports "0 gpus" only the validation files changed

@Saaketh0
Saaketh0 self-requested a review September 25, 2026 18:27
userAugustos and others added 2 commits September 25, 2026 15:54
The picker, the manifest schema and the deploy config check now all treat gpu as a
non-negative integer; the picker also rejects negative values at input.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@Saaketh0 Saaketh0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

great

@Saaketh0
Saaketh0 enabled auto-merge (squash) September 25, 2026 19:11
auto-merge was automatically disabled September 25, 2026 19:12

Repository rule violations found

@Saaketh0
Saaketh0 enabled auto-merge (squash) September 25, 2026 19:13
auto-merge was automatically disabled September 25, 2026 20:28

Repository rule violations found

@userAugustos
userAugustos merged commit d734b64 into main Sep 25, 2026
13 checks passed
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.

2 participants