Return invalid request for macOS vGPU - #359
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c0eac5f. Configure here.
sjmiller609
reviewed
Aug 6, 2026
sjmiller609
left a comment
Collaborator
There was a problem hiding this comment.
lib/instances/create.go:100 — could we model unsupported vGPU as a device/host Capability (find existing pattern in codebase) rather than branching on runtime.GOOS here? something like devices.Capabilities().SupportsVGPU, implemented per platform, is the more standard way to handle platform specific capabilities
Contributor
Author
|
good callout - implemented the existing pattern we rely on in the codebase currently! |
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.

Summary
invalid_requestwhen a macOS instance request includes a vGPUValidation
Scope
This only changes instance creation. Starting an existing instance is unchanged.
Note
Low Risk
Scoped to instance-create validation and error mapping on macOS; Linux vGPU behavior unchanged and existing start paths are untouched.
Overview
Instance create now treats vGPU profile requests on hosts without mediated GPU support as a client error instead of a generic or capacity failure.
Adds
devices.Capabilities()(Linux reports vGPU support; macOS does not) and movesErrVGPUNotSupportedOnMacOSto a shared sentinel indevices/errors.go. Create rejects a non-empty GPU profile whenSupportsVGPUis false beforeReserveAllocation, so macOS no longer surfaces this as insufficient resources. IfCreateMdevstill returns the macOS unsupported error,wrapCreateMdevErrwraps it asErrInvalidRequest, which the API maps to HTTP 400 with codeinvalid_requestand the messageinvalid request: vGPU (mdev) is not supported on macOS.Tests cover platform capabilities, early rejection (no reservation), error wrapping, and the create-instance error mapping.
Reviewed by Cursor Bugbot for commit 9034ff4. Bugbot is set up for automated code reviews on this repo. Configure here.