Conversation
KAJdev
requested review from
deanq,
jhcipar,
lukepiette and
zackmckennarunpod
September 8, 2026 20:29
deanq
reviewed
Sep 11, 2026
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical GraphQL input handling and moderate REST/CLI behavior issues block approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request migrates API helpers to REST API v2 while preserving the public interface and retaining GraphQL for profile reads and registry updates.
Changes:
- Adds REST transport and REST-backed resource operations.
- Updates CLI behavior, errors, tests, examples, and documentation.
- Removes obsolete GraphQL query and mutation builders.
File summaries
| File | Reviewed change |
|---|---|
tests/test_error.py |
Tests REST error metadata. |
tests/test_cli/test_cli_utils/test_info.py |
Updates REST SSH fixtures. |
tests/test_cli/test_cli_groups/test_project_functions.py |
Updates pod status fixtures. |
tests/test_cli/test_cli_groups/test_pod_commands.py |
Updates REST pod fields. |
tests/test_api/test_rest.py |
Adds REST transport tests. |
tests/test_api/test_mutations_templates.py |
Removes obsolete mutation tests. |
tests/test_api/test_mutations_pods.py |
Removes obsolete mutation tests. |
tests/test_api/test_mutation_endpoints.py |
Removes obsolete mutation tests. |
tests/test_api/test_mutation_container_registry_auth.py |
Tests the retained registry mutation. |
tests/test_api/test_ctl_commands.py |
Tests REST-backed commands. |
runpod/error.py |
Adds HTTP error details. |
runpod/cli/utils/rp_info.py |
Handles REST SSH data. |
runpod/cli/groups/project/functions.py |
Uses REST pod status; Moderate (1 vote): handle missing pods during 404 polling. |
runpod/cli/groups/pod/commands.py |
Displays REST pod fields. |
runpod/api/rest.py |
Implements authenticated REST transport. |
runpod/api/queries/pods.py |
Removes obsolete pod queries. |
runpod/api/queries/gpus.py |
Removes obsolete GPU queries. |
runpod/api/queries/endpoints.py |
Removes obsolete endpoint queries. |
runpod/api/mutations/user.py |
Removes obsolete user mutation. |
runpod/api/mutations/templates.py |
Removes obsolete template mutation. |
runpod/api/mutations/pods.py |
Removes obsolete pod mutations. |
runpod/api/mutations/endpoints.py |
Removes obsolete endpoint mutations. |
runpod/api/mutations/container_register_auth.py |
Retains registry updates; Critical (1 vote): escape or parameterize interpolated GraphQL values. |
runpod/api/ctl_commands.py |
Routes helpers through REST; Moderate (2 votes): validate complete instance IDs; Moderate (1 vote): support CPU volume overrides and missing mounts; Moderate (1 vote): preserve or reject unsupported resume_pod GPU counts. |
runpod/api/__init__.py |
Updates API package documentation. |
README.md |
Documents REST wrapper usage. |
examples/rest_wrapper.py |
Updates REST usage examples. |
docs/api/queries.md |
Documents REST response shapes; Nit (2 votes): show get_gpus() output as a list. |
docs/api/handling_errors.md |
Documents REST error handling. |
Review details
Suppressed comments (3)
runpod/api/ctl_commands.py:197
volume_mount_pathis a public option for both GPU and CPU pods, but this branch only runs whengpu_type_idis set. A CPU pod created from a template with a persistent volume therefore cannot override the inherited path (the previous mutation applied the mount path regardless of GPU/CPU), and a template withoutmountsalso raisesKeyErrorwhen an override is requested. Remove the GPU-only guard and treat missing mounts as an empty mapping.
elif template_id and gpu_type_id and volume_mount_path is not None:
template = run_rest_request(
"GET", f"/v2/templates/{_path_segment(template_id)}"
)
persistent = template["mounts"].get("persistent")
runpod/api/ctl_commands.py:230
gpu_countis part of the publicresume_podcontract, but this line discards it and the REST request always performs an unchanged start. Callers that previously requested a different GPU count now silently get different behavior; pass the count using the REST v2-supported action field, or reject/document the unsupported operation instead of ignoring the argument.
def resume_pod(pod_id: str, gpu_count: int) -> dict:
"""Start a stopped pod."""
_ = gpu_count
return run_rest_request(
runpod/cli/groups/project/functions.py:64
get_podnow returnsNonefor a 404, so a pod that disappears or is temporarily not visible during this polling loop makes the next iteration dereferenceNonewith.getand fail withAttributeError. Handle the missing pod explicitly before continuing to poll.
while new_pod.get("status") != "RUNNING" or new_pod.get("runtime") is None:
new_pod = get_pod(new_pod["id"])
- Files reviewed: 29/29 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
deanq
approved these changes
Sep 14, 2026
deanq
left a comment
Member
There was a problem hiding this comment.
LGTM. The REST v2 migration reads cleanly and my earlier concerns are all addressed:
- Registry credential injection is closed —
json.dumpson the values produces valid escaped GraphQL string literals. Migrating this update path to REST/variables would be a nice follow-up but the escaping is correct as-is. - The empty-body and template-mount points are reasonable as deliberate decisions given your explanations (empty list is meaningful; CPU pods don't take local persistent volumes and template_id is always forwarded).
Nothing blocking from me.
…python-to-use-rest-v2
KAJdev
deleted the
zeke/con-1154-rewrite-api-wrapper-in-runpod-python-to-use-rest-v2
branch
September 15, 2026 18:12
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.
Routes the existing API helpers through REST API v2 while preserving the public function surface and list unwrapping behavior. GraphQL is scoped to account profile reads and registry credential updates, since those operations are not exposed by REST API v2.
Linear: CON-1154