CLI: Update SDK to v0.37.0 and add profiles list params#118
Conversation
Update Go SDK dependency to latest version. Full SDK method enumeration performed - all SDK methods have corresponding CLI commands (no coverage gaps found). Triggered by: kernel/kernel-go-sdk@b6a60bb Co-authored-by: Cursor <cursoragent@cursor.com>
Updates the Go SDK dependency to the latest version. Coverage Analysis: Full enumeration of SDK methods and CLI commands was performed. No coverage gaps were found - all SDK methods have corresponding CLI commands. Co-authored-by: Cursor <cursoragent@cursor.com>
- `kernel deploy delete <id>`: deletes a single deployment by ID with confirmation prompt (skippable via --yes) - `kernel app delete <name>`: deletes all deployments for an app, optionally scoped to a specific --version, with parallel deletion and a progress spinner Both commands use the new Deployments.Delete SDK method added in the go-sdk bump. Co-authored-by: Cursor <cursoragent@cursor.com>
masnwilliams
left a comment
There was a problem hiding this comment.
looks good — a few nits on the app delete command, nothing blocking.
| params.AppVersion = kernel.Opt(version) | ||
| } | ||
|
|
||
| initial, err := client.Deployments.List(cmd.Context(), params) |
There was a problem hiding this comment.
nit: this initial list fetch is only used as an existence check and then thrown away — the deletion loop re-lists from offset 0 anyway. could skip this entirely and just check deleted == 0 after the loop to print "no deployments found"
| break | ||
| } | ||
|
|
||
| g, gctx := errgroup.WithContext(cmd.Context()) |
There was a problem hiding this comment.
nit: no concurrency limit on the errgroup — this fires up to 100 parallel deletes per page. g.SetLimit(10) or similar would be friendlier to the API
| return client.Deployments.Delete(gctx, dep.ID) | ||
| }) | ||
| } | ||
| if err := g.Wait(); err != nil { |
There was a problem hiding this comment.
if one delete in the batch fails, g.Wait() returns early but some deletes may have already succeeded. might be worth printing the deleted count in the error path too, so the user knows partial progress happened
- Updated kernel-go-sdk from v0.36.2-0.20260221214548-0bf19a19dfd7 to v0.37.0 - Updated ProfilesService.List to accept ProfileListParams (breaking change) - Added --limit, --offset, --query flags to profiles list command - Updated tests for new ProfilesService interface Co-authored-by: Cursor <cursoragent@cursor.com>
| } | ||
| deleted += len(items) | ||
| spinner.UpdateText(fmt.Sprintf("Deleted %d deployment(s) so far...", deleted)) | ||
| } |
There was a problem hiding this comment.
Deletion loop may infinite-loop on async deletes
High Severity
The deletion loop always re-lists deployments at Offset 0. The PR description states that Delete "stops a running deployment and marks it for deletion" rather than deleting immediately. If marked-for-deletion deployments still appear in list results, the loop will keep fetching the same items and re-attempting deletion indefinitely. The offset is never advanced, so there's no forward progress when items linger in the list after a delete call.
Additional Locations (1)
| g.Go(func() error { | ||
| return client.Deployments.Delete(gctx, dep.ID) | ||
| }) | ||
| } |
There was a problem hiding this comment.
Unbounded parallel deletes may overwhelm the API
Medium Severity
The errgroup created for each page of deployments has no concurrency limit, so up to 100 Delete calls fire simultaneously per batch. This can overwhelm the API with concurrent requests, triggering rate limiting or transient failures that cause the entire batch to abort. Adding a concurrency limit via g.SetLimit() would make this much safer.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| if err := g.Wait(); err != nil { | ||
| spinner.Fail("Failed to delete deployments") | ||
| return util.CleanedUpSdkError{Err: err} | ||
| } |
There was a problem hiding this comment.
Batch delete error discards partial progress count
Medium Severity
When g.Wait() returns an error during the batch deletion loop, the function reports "Failed to delete deployments" and returns — but the deleted count from prior successful iterations is silently discarded. For a destructive, irreversible operation, the user has no way to know whether 0 or hundreds of deployments were already removed, making recovery difficult.
| for _, dep := range items { | ||
| g.Go(func() error { | ||
| return client.Deployments.Delete(gctx, dep.ID) | ||
| }) |
There was a problem hiding this comment.
Batch delete missing not-found handling causes unnecessary failures
Medium Severity
The batch delete goroutines in runAppDelete propagate not-found errors as failures, while every other delete path in the codebase — including runDeployDelete in the same diff — treats not-found as success (idempotent delete). If a deployment is removed between the List call and the Delete call (e.g., by a concurrent user or auto-cleanup), the not-found error from one goroutine causes g.Wait() to fail, cancels the gctx context (aborting other in-flight deletes), and aborts the entire operation unnecessarily.


Summary
This PR updates the Go SDK dependency to the latest version and updates CLI commands to match SDK interface changes.
SDK Update
Coverage Analysis
A full enumeration of SDK methods and CLI commands was performed. The SDK update included a breaking change to the
ProfileService.Listmethod signature.Changes
ProfileListParamsparameter (breaking change from SDK)--limit,--offset,--queryflags tokernel profiles listcommandNew Flags
--limitforProfileListParams.Limitonkernel profiles list--offsetforProfileListParams.Offsetonkernel profiles list--queryforProfileListParams.Queryonkernel profiles listTriggered by: kernel/kernel-go-sdk@cb6bef9
Reviewer: @dcruzeneil2
Note
Medium Risk
Introduces new deletion flows (including concurrent deletes) that can remove deployments/apps, so correctness of filtering/confirmation and error handling is important despite relatively localized CLI changes.
Overview
Updates
kernel-go-sdktov0.37.0(and addsgolang.org/x/sync) and adapts the CLI to the SDK’s breakingProfiles.Listsignature by introducing paginated, queryablekernel profiles list(--page,--per-page,--query) with updated tests.Adds destructive-management commands:
kernel app delete <app_name>(optionally--version, with confirmation and concurrent deletion of all matching deployments) andkernel deploy delete <deployment_id>(with confirmation/--yesand not-found handling).Written by Cursor Bugbot for commit 74ca985. This will update automatically on new commits. Configure here.