-
Notifications
You must be signed in to change notification settings - Fork 0
fix: resource limits for starting instances #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✱ Stainless preview buildsThis PR will update the Edit this comment to update it. It will appear in the SDK's changelogs. ✅ hypeman-go studio · code · diff
✅ hypeman-typescript studio · code · diff
❗ hypeman-cli studio
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| // Returns nil if allocation is allowed, or a detailed error describing | ||
| // which resource is insufficient and the current capacity/usage. | ||
| // Parameters match instances.AllocationRequest to implement instances.ResourceValidator. | ||
| func (m *Manager) ValidateAllocation(ctx context.Context, vcpus int, memoryBytes int64, networkDownloadBps int64, networkUploadBps int64, diskIOBps int64, needsGPU bool) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused parameter in ValidateAllocation function signature
Low Severity
The diskIOBps parameter is accepted by ValidateAllocation in both the ResourceValidator interface and the Manager implementation, but it's never used within the function body. The function validates CPU, memory, network, and GPU resources but silently ignores the disk I/O parameter. This creates a misleading API contract where callers expect disk I/O to be validated but it isn't.


Note
Medium Risk
Changes affect instance admission/startup paths and GPU device lifecycle; misconfiguration or validation bugs could block VM scheduling or leak resources, but the logic is additive and guarded by validator wiring.
Overview
Switches instance admission control from static aggregate limits to the
lib/resourcescapacity/oversubscription model. Instance create/start now call a pluggableResourceValidator(wired incmd/api/main.go) and return a new structuredinsufficient_resourceserror when CPU/memory/network/GPU capacity is exceeded.The API/OpenAPI client are updated to surface this as a
409onPOST /instances(and409onStartInstance), while old config fields/tests forMAX_TOTAL_VCPUS/MAX_TOTAL_MEMORYand internal aggregate-usage calculations are removed. vGPU lifecycle handling is tightened: standby is rejected for vGPU instances, vGPU mdevs are destroyed on stop and recreated on start.Written by Cursor Bugbot for commit 2915dc1. This will update automatically on new commits. Configure here.