internal: Fix failed deployment cleanup#346
Merged
timflannagan merged 1 commit intoagentregistry-dev:mainfrom Mar 13, 2026
Merged
internal: Fix failed deployment cleanup#346timflannagan merged 1 commit intoagentregistry-dev:mainfrom
timflannagan merged 1 commit intoagentregistry-dev:mainfrom
Conversation
We stop treating failed or cancelled deployment rows as active deployments and allow those rows to be removed without invoking platform undeploy. Previously, list and metadata surfaces counted any matching deployment row, including failed and cancelled records. Deleting a failed deployment also still tried to undeploy platform resources first, which could fail even when nothing had been created. Now, only deployed rows contribute to deployment status displays, and failed or cancelled records are removed directly from the database during delete. Fixes agentregistry-dev#326. Signed-off-by: timflannagan <[email protected]>
timflannagan
commented
Mar 13, 2026
| if deployment == nil || deployment.ResourceType != resourceType { | ||
| continue | ||
| } | ||
| if deployment.Status != models.DeploymentStatusDeployed { |
Collaborator
Author
There was a problem hiding this comment.
TODO: confirm whether we care about the legacy (afaik) "active" column. There was internal/registry/database/migrations/004_unified_deployments_provider.sql and I thought we ripped this out in Scott's refactor a couple of weeks back.
Collaborator
Author
There was a problem hiding this comment.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve handling of non-successful deployments by standardizing deployment status values and ensuring “deployment presence” surfaces only reflect successfully deployed rows.
Changes:
- Introduces shared
models.DeploymentStatus*constants and replaces several hardcoded status strings with these constants. - Updates catalog metadata bridging and CLI deployment counting to only include
deployedstatus rows. - Updates/adds tests to reflect the new “only deployed counts” behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/models/deployment.go | Adds canonical deployment status constants (deploying, deployed, failed, cancelled, discovered). |
| internal/registry/service/registry_service.go | Switches service-side default status strings to use the new constants. |
| internal/registry/platforms/local/deployment_adapter_local.go | Uses the deployed status constant in adapter deploy result. |
| internal/registry/platforms/kubernetes/deployment_adapter_kubernetes.go | Uses the deployed status constant in adapter deploy result. |
| internal/registry/platforms/kubernetes/deployment_adapter_kubernetes_platform.go | Uses the deployed status constant for discovered deployment rows. |
| internal/registry/api/handlers/v0/deployment_meta_bridge.go | Filters deployment metadata indexing to only include deployed rows. |
| internal/registry/api/handlers/v0/deployment_meta_bridge_test.go | Updates tests to expect only deployed rows in the deployment index. |
| internal/cli/common/deployments.go | Updates deployment counting logic to ignore non-deployed statuses. |
| internal/cli/mcp/list_test.go | Updates MCP CLI tests to include status and validate deployed-only counting. |
| internal/cli/agent/list_test.go | Updates agent CLI tests to include status and validate deployed-only counting. |
| internal/registry/service/registry_service_test.go | Adds a test around undeploy behavior for failed/cancelled deployments (currently contradicts PR intent). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
peterj
approved these changes
Mar 13, 2026
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.
Description
We stop treating failed or cancelled deployment rows as active deployments and allow those rows to be removed without invoking platform undeploy.
Previously, list and metadata surfaces counted any matching deployment row, including failed and cancelled records. Deleting a failed deployment also still tried to undeploy platform resources first, which could fail even when nothing had been created.
Now, only deployed rows contribute to deployment status displays, and failed or cancelled records are removed directly from the database during delete.
Fixes #326.
Change Type
/kind fix
Changelog
Additional Notes