feat: expose v2 CUDA constraints (gpu.allowedCudaVersions / gpu.minCudaVersion) - #85
feat: expose v2 CUDA constraints (gpu.allowedCudaVersions / gpu.minCudaVersion)#85brodykellish wants to merge 2 commits into
Conversation
…daVersion) rphttp2 2.9.0 nests the CUDA host constraints under the gpu block (they were top-level pre-release and are unrepresentable on CPU workloads), gives serverless a minCudaVersion floor, makes gpu.pools optional on PATCH so a CUDA-only update need not resend the pool list, and makes a pools update replace the GPU selection wholesale (clearing excludedTypes). Adopt all of it: CUDA params on create-pod / create-endpoint / update-endpoint mapped under gpu.*, client-side validation (major.minor grammar, set-XOR-floor) so callers get named errors instead of raw 422s, pools-less gpu PATCH support (also unlocks a count-only patch, previously silently dropped), a _warning when a gpuPoolIds update clears exclusions pinned via console/set-endpoint-gpus, the minCudaVersion availability filter on list-gpu-types, and the refreshed vendored spec (new unmapped ops — ssh-keys, clusters, public template catalog — allowlisted as to-dos in the parity gate).
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
Pull request overview
This pull request updates the Runpod MCP server’s v2 REST integration to adopt rphttp2 2.9.0’s schema changes for CUDA host constraints, moving allowedCudaVersions / minCudaVersion under gpu.* and extending validation + update behavior accordingly.
Changes:
- Add v2 CUDA constraint params to
create-pod,create-endpoint, andupdate-endpoint, including client-side validation and v1-mode 501s. - Allow pools-less GPU PATCHes for Serverless endpoint updates (CUDA-only / count-only), and emit a warning when a pools update clears existing
excludedTypes. - Extend
list-gpu-typeswith the v2minCudaVersionavailability filter, and refresh the vendored v2 OpenAPI fixture + parity allowlist.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/_shared/mappers.ts |
Maps new CUDA constraint params into v2 request bodies under gpu.* and adds shared validation helper. |
src/tools/pods.ts |
Exposes CUDA constraint params for pod create and validates v2-only / GPU-only behavior. |
src/tools/endpoints.ts |
Exposes CUDA constraint params for endpoint create/update, supports pools-less GPU PATCH, and adds exclusion-wipe warning behavior. |
src/tools/catalog.ts |
Adds v2 minCudaVersion availability filter support to list-gpu-types with validation. |
tests/mappers.test.ts |
Adds mapper-level tests for CUDA nesting and validation behavior. |
tests/handlers.test.ts |
Adds handler-level tests for v2 wire shape, validation failures, warnings, and v1 rejections. |
tests/spec-parity.test.ts |
Allowlists newly introduced spec operations that are intentionally not yet exposed as MCP tools. |
tests/fixtures/v2-openapi.yaml |
Updates vendored v2 spec snapshot (including new CUDA fields, clusters/account/template catalog additions, etc.). |
tests/fixtures/v2-create-pod.json |
Updates create-pod fixture to include CUDA constraints and expected v2 mapping. |
.changeset/v2-cuda-constraints.md |
Adds a changeset documenting the new user-facing behavior and the rphttp2 2.9.0 dependency. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- update-endpoint 400s an explicit gpuPoolIds: [] instead of silently dropping it (gpu.pools is minItems 1 upstream and not clearable). - allowedCudaVersions description no longer references a get-capacity product parameter that does not exist. - Note on V1PodParams that the CUDA fields are v2-only.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/tools/endpoints.ts:368
- The update-endpoint tool description’s v2 mutable-fields list is now incomplete: it omits the newly supported gpuPoolIds/gpuCount/allowedCudaVersions/minCudaVersion (and args). This can mislead tool users about what updates are possible; update the description to include these fields.
"Update a Serverless endpoint's config. On v2 you can change image/disk/env/ports/registry/workers/scaling/networkVolumes/timeout/flashboot; on v1, scaling fields (worker min/max, idle timeout, scaler type/value, name). Only provided fields change. An endpoint's request routing (queue vs load balancer) is fixed at creation and cannot be changed here — recreate the endpoint instead. Note: passing gpuPoolIds replaces the GPU selection wholesale, which clears any GPU-type exclusions set elsewhere (console or set-endpoint-gpus) — the reply carries a _warning when that happens.",
tests/spec-parity.test.ts:140
- The comment above ALLOWLIST_UNMAPPED_OPS still says "Empty today" even though the allowlist is now non-empty, which makes the parity gate’s intent unclear. Update the comment to reflect that this is a temporary to-do list of intentionally unmapped spec operations.
// Spec operations deliberately NOT exposed as a tool. Empty today — every operation
// in the vendored spec maps to a registered tool. Add an entry (with the reason) if
// an operation ships that we choose not to cover.
// New in the 2.9.0-era spec refresh: whole resources the MCP has no tools for
// yet. A to-do list, not a permanent carve-out — delete an entry when its tool
| ? `?include=AVAILABILITY&product=${product}${ | ||
| params.minCudaVersion !== undefined | ||
| ? `&minCudaVersion=${encodeURIComponent(params.minCudaVersion)}` | ||
| : '' | ||
| }` | ||
| : '' |
There was a problem hiding this comment.
nit: can we simplify this nested ternary for readability?
| current?.scaling?.type === 'REQUEST_COUNT' | ||
| ? 'REQUEST_COUNT' | ||
| : 'QUEUE_DELAY'; |
There was a problem hiding this comment.
nit: minor concern around usage of magic strings. Seems like there isnt a project convention, but ideally could be simplified by usaing a const as object pattern?
| pools?: string[], | ||
| count?: number | ||
| params: V2EndpointParams, | ||
| mode: 'create' | 'update' |
There was a problem hiding this comment.
note: comment around typing etc below.
| function endpointCommonToV2(params: V2EndpointParams): Record<string, unknown> { | ||
| function endpointCommonToV2( | ||
| params: V2EndpointParams, | ||
| mode: 'create' | 'update' |
What rphttp2 2.9.0 changed on the wire
The CUDA host constraints (
allowedCudaVersions,minCudaVersion) moved from the top level of pod/endpoint bodies into thegpublock (pre-2.9.0 servers 422 the nested spelling as an unknown property; 2.9.0 servers 422 the old top-level spelling). Serverless gained agpu.minCudaVersionfloor. OnPATCH /v2/serverless,gpu.poolsbecame optional (a CUDA-only patch need not resend the pool list), and sendingpoolsnow replaces the GPU selection wholesale — clearingexcludedTypes.The MCP server needed nothing to survive 2.9.0 (it never sent or read the affected fields over REST); this PR adopts the new schema.
What this adds
allowedCudaVersions/minCudaVersionparams on create-pod, create-endpoint, and update-endpoint, emitted undergpu.*. Client-side validation names the failure instead of relaying a raw 422/400: major.minor grammar (a bare"12"is rejected with the fix in the message), set-XOR-floor exclusivity, GPU-pods-only. Update supports the spec's clear sentinels ([]clears the set,""clears the floor).gpuPATCH: a CUDA-only (or count-only — previously silently dropped) endpoint update no longer resendsgpuPoolIds.update-endpointsendsgpuPoolIdsand the endpoint carriesexcludedTypes(set via console orset-endpoint-gpus), the reply carries a_warningnaming the cleared exclusions.minCudaVersionavailability filter (bare major legal here — it only widens a read).RUNPOD_REST_VERSION=v2(thetemplateIdprecedent).Do not release/deploy this MCP version until prod api.runpod.io runs rphttp2 2.9.0 — pre-2.9.0 servers 422 the gpu-nested fields as unknown properties.
28 new tests (14 mapper, 14 handler); suite 733 tests, 725 pass / 8 pre-existing env-gated skips; tsc + eslint + prettier clean on touched files.