Skip to content

Return invalid request for macOS vGPU - #359

Merged
jarugupj merged 3 commits into
mainfrom
hypeship/macos-vgpu-invalid-request
Aug 6, 2026
Merged

Return invalid request for macOS vGPU#359
jarugupj merged 3 commits into
mainfrom
hypeship/macos-vgpu-invalid-request

Conversation

@jarugupj

@jarugupj jarugupj commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • return HTTP 400 invalid_request when a macOS instance request includes a vGPU
  • reject the request before checking GPU capacity, so it is not reported as insufficient resources
  • leave other GPU creation errors unchanged

Validation

  • Linux and macOS tests pass in CI
  • local build, vet, and focused error-response tests pass

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 moves ErrVGPUNotSupportedOnMacOS to a shared sentinel in devices/errors.go. Create rejects a non-empty GPU profile when SupportsVGPU is false before ReserveAllocation, so macOS no longer surfaces this as insufficient resources. If CreateMdev still returns the macOS unsupported error, wrapCreateMdevErr wraps it as ErrInvalidRequest, which the API maps to HTTP 400 with code invalid_request and the message invalid 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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread lib/instances/create.go
@jarugupj
jarugupj requested a review from sjmiller609 August 6, 2026 15:48

@sjmiller609 sjmiller609 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.

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

@jarugupj

jarugupj commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

good callout - implemented the existing pattern we rely on in the codebase currently!

@jarugupj
jarugupj requested a review from sjmiller609 August 6, 2026 18:31

@sjmiller609 sjmiller609 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.

perfect, thanks!

@jarugupj
jarugupj merged commit 899d680 into main Aug 6, 2026
12 of 15 checks passed
@jarugupj
jarugupj deleted the hypeship/macos-vgpu-invalid-request branch August 6, 2026 18:37
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