Skip to content

api refactor: unify provider/deployment adapter flow and remove startup reconciliation#302

Merged
peterj merged 65 commits intomainfrom
api-refactor-8
Mar 11, 2026
Merged

api refactor: unify provider/deployment adapter flow and remove startup reconciliation#302
peterj merged 65 commits intomainfrom
api-refactor-8

Conversation

@ilackarms
Copy link
Copy Markdown
Contributor

@ilackarms ilackarms commented Mar 6, 2026

Description

This PR completes the API/deployment refactor to make provider adapters the single platform boundary, simplify deployment lifecycle handling, and remove startup-time reconciliation behavior from core registry startup.

  • Motivation: reduce abstraction leaks, enforce a cleaner adapter contract, and make deployment behavior consistent across providers without adding parallel APIs.
  • What changed:
    • Enforced strict providerId in core deployment APIs, while keeping CLI/MCP convenience behavior at the edge.
    • Removed startup reconciliation config/wiring and related chart/daemon settings.
    • Moved provider-specific deployment runtime reconciliation behavior into adapters.
    • Introduced adapter result/state patch primitives for provider metadata/status updates without DB access from adapters.
    • Fixed regressions around agent-resolved MCP deployment scoping, ARG_/HEADER_ runtime input recovery, and stale artifact handling during reconciliation.
    • Reduced cross-layer coupling by removing client dependence on handler DTOs and service dependence on runtime translation DTOs.
    • Updated tests and docs to match the new API/adapter behavior.

Change Type

/kind breaking_change
/kind cleanup
/kind design
/kind fix

Changelog

Refactored deployments/providers to use a unified adapter-driven flow: `providerId` is now required in core deployment APIs, startup reconciliation was removed, and adapter result/state patch handling now drives provider-specific deployment status/metadata updates.

@ilackarms ilackarms marked this pull request as ready for review March 10, 2026 21:08
Copilot AI review requested due to automatic review settings March 10, 2026 21:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes an API/deployment refactor to make provider adapters the primary platform boundary, require providerId in core deployment APIs, remove startup reconciliation, and shift provider-specific deployment behavior into adapters.

Changes:

  • Updated OpenAPI + generated UI SDK/types to require providerId for deployment requests and renamed deployments list response type.
  • Removed legacy runtime translation/reconciliation modules and startup reconciliation wiring/config across server, daemon, and Helm chart.
  • Introduced adapter-driven deployment action results and partial deployment state patching (DB + models), plus new local/kubernetes deployment adapters and supporting platform types/utils.

Reviewed changes

Copilot reviewed 79 out of 80 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ui/lib/api/types.gen.ts Makes providerId required in DeploymentRequest; renames deployments list response type; doc tweaks.
ui/lib/api/sdk.gen.ts Updates cancel deployment description in generated SDK.
ui/lib/api/index.ts Re-exports updated generated types (e.g., DeploymentsListResponse).
ui/components/deploy-server-dialog.tsx Supplies providerId in deploy request to satisfy new API requirement.
pkg/types/types.go Removes legacy deployment target/service factory hooks; updates deployment adapter deploy signature to return DeploymentActionResult.
pkg/registry/database/database.go Renames DB interface method to UpdateDeploymentState using DeploymentStatePatch.
pkg/models/provider.go Adds KubernetesProviderConfig model for provider selection settings.
pkg/models/deployment.go Adds DeploymentActionResult and DeploymentStatePatch; extends k8s metadata.
openapi.yaml Requires providerId in deployment request schema; updates docs and response schema names.
internal/runtime/translation/registry/utils/registry_utils.go Deleted legacy runtime translation utilities.
internal/runtime/translation/registry/internal_registry_translator.go Deleted legacy registry-to-runtime translator.
internal/runtime/translation/kagent/kagent_translator.go Deleted legacy k8s translator.
internal/runtime/translation/dockercompose/docker_compose_translator.go Deleted legacy docker-compose translator.
internal/runtime/translation/api/translator.go Deleted legacy runtime translator interface.
internal/runtime/translation/api/internal_runtime_api.go Deleted legacy internal runtime API types.
internal/runtime/translation/api/dockercompose_types.go Deleted legacy docker-compose type aliases.
internal/runtime/runtime_test.go Deleted runtime validation tests (runtime package removed).
internal/runtime/runtime.go Deleted runtime validator implementation (runtime package removed).
internal/runtime/agentregistry_runtime_unit_test.go Deleted runtime translation unit tests.
internal/runtime/agentregistry_runtime_test.go Deleted runtime docker integration test.
internal/runtime/agentregistry_runtime.go Deleted legacy runtime reconciler implementation.
internal/registry/service/testing/fake_registry.go Updates fake service interface: removes platform param, adds skill resolution hook.
internal/registry/service/service.go Updates RegistryService interface: removes reconciler/platform params; adds ResolveAgentManifestSkills.
internal/registry/service/registry_service_discovered_id_test.go Updates discovered deployment ID tests for new scoping inputs.
internal/registry/registry_app.go Removes startup reconciliation; wires new local/k8s deployment adapters; switches to shared apitypes.VersionBody.
internal/registry/platforms/utils/deployment_adapter_utils_test.go New tests for runtime input splitting and MCP/agent resolution helpers.
internal/registry/platforms/types/types.go New shared platform types (desired state, local/k8s configs, agent gateway config).
internal/registry/platforms/types/agentgateway_types.go Moves AgentGateway types into platforms/types package and refactors comments/formatting.
internal/registry/platforms/local/deployment_adapter_local_test.go New tests for local undeploy cleanup when registry artifacts are missing.
internal/registry/platforms/local/deployment_adapter_local_platform_test.go New tests for local platform config route port defaults.
internal/registry/platforms/local/deployment_adapter_local.go New local deployment adapter implementing deploy/undeploy/cleanup behaviors.
internal/registry/platforms/kubernetes/deployment_adapter_kubernetes.go New kubernetes deployment adapter implementing deploy/undeploy/discover/cleanup behaviors.
internal/registry/database/postgres_test.go Updates/extends tests for UpdateDeploymentState patching behavior.
internal/registry/database/postgres.go Requires provider ID on create; implements UpdateDeploymentState with partial patch semantics.
internal/registry/database/migrations/010_drop_platform_validity_constraints.sql Drops DB-level platform validity constraints (adapter-driven validation).
internal/registry/config/config.go Removes ReconcileOnStartup config; keeps runtime dir/verbose.
internal/registry/api/server.go Switches version type to apitypes.VersionBody.
internal/registry/api/router/v0.go Switches version type to apitypes.VersionBody.
internal/registry/api/router/router.go Switches version type to apitypes.VersionBody.
internal/registry/api/handlers/v0/version.go Aliases version body to centralized apitypes type.
internal/registry/api/handlers/v0/servers.go Updates deployment-meta attachment call signature.
internal/registry/api/handlers/v0/providers.go Updates platform filter doc string.
internal/registry/api/handlers/v0/embeddings.go Moves embeddings request/response types to apitypes.
internal/registry/api/handlers/v0/edit.go Updates deployment-meta attachment call signature.
internal/registry/api/handlers/v0/deployments_test.go Updates deployment adapter signature and providerId validation expectations; removes platform arg passing.
internal/registry/api/handlers/v0/deployments.go Requires providerId; removes platform-resolution param flow; updates cancel/logs unsupported error sentinel usage.
internal/registry/api/handlers/v0/deployment_meta_bridge_test.go Updates tests for filtered deployment statuses and new attachment signature.
internal/registry/api/handlers/v0/deployment_meta_bridge.go Filters inactive deployment statuses; recalculates deployment index internally in attachment helpers.
internal/registry/api/handlers/v0/deployment_adapters.go Deleted legacy deployment adapters (moved to platforms/).
internal/registry/api/handlers/v0/agents.go Updates deployment-meta attachment call signature.
internal/registry/api/cors_test.go Switches version type to apitypes.VersionBody.
internal/registry/api/apitypes/types.go New shared API DTOs used by handlers + internal client.
internal/mcp/registryserver/server.go Updates deploy tool args structure; removes platform lookup for undeploy tool.
internal/mcp/registryserver/deployments_test.go Updates fake undeploy signature (no platform arg).
internal/daemon/docker-compose.yml Removes reconcile-on-startup env var.
internal/client/client_integration_test.go Updates tests to align with providerId requirements and new request/response types.
internal/client/client.go Defaults deploy provider ID to local at the client edge; switches to apitypes DTO aliases.
internal/cli/skill/publish_test.go Minor test cleanup (removes nolint, aligns formatting).
internal/cli/mcp/run.go Replaces legacy runtime reconciliation with local platform config + compose up/down workflow.
internal/cli/mcp/publish_test.go Formatting alignment in table-driven test struct.
internal/cli/embeddings.go Switches embeddings DTOs to internal client aliases.
internal/cli/agent/utils/registry_translator.go Replaces legacy registry translation utils with platform utils translation flow.
internal/cli/agent/build.go Makes --image optional (defaults derived from manifest/name).
go.mod Adds gopkg.in/evanphx/json-patch.v4 indirect dependency.
e2e/deploy_test.go Updates deploy flows to pass/derive image refs consistently and adds k8s resource cleanup verification test.
charts/agentregistry/values.yaml Removes reconcile-on-startup value.
charts/agentregistry/tests/configmap_test.yaml Removes reconcile-on-startup configmap assertion.
charts/agentregistry/templates/configmap.yaml Removes reconcile-on-startup env var from rendered configmap.
AGENTS.md Removes development guidelines document.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +17 to +23
func isActiveDeploymentStatus(status string) bool {
switch strings.ToLower(strings.TrimSpace(status)) {
case "deploying", "deployed", "discovered":
return true
default:
return false
}
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isActiveDeploymentStatus currently treats only deploying/deployed/discovered as active. Deployment statuses like "queued" are used elsewhere (e.g., cancel flow tests) and will be filtered out of server/agent deployment metadata, making queued deployments invisible in Meta.Deployments. Consider including "queued" (and any other in-flight statuses you support) in the active set, or deriving this from a shared status enum/constant list to avoid drift.

Copilot uses AI. Check for mistakes.
Packages: serverSpec.Packages,
Remotes: serverSpec.Remotes,
},
PreferRemote: preferRemote,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this preferremote?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would leave this for anotehr follow up... the scope of this pr is also quite large

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to sit and design the replacement

ServerName string `json:"serverName" required:"true"`
Version string `json:"version" required:"true"`
Env map[string]string `json:"env,omitempty"`
PreferRemote bool `json:"preferRemote,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove prefereremote

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing preferRemote is a significant change to the api / behavior of the registry today. i think it deserves its own design+pr (which i was planning on addressing after all the deployment stuff is done)

return servers, nil
}

func kubernetesTranslatePlatformConfig(ctx context.Context, desired *platformtypes.DesiredState) (*platformtypes.KubernetesPlatformConfig, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason all these functions are prefixed with "kubernetes" -- they are in the kubernetes package already

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personally i prefer this for searches; makes it easier when trying to find the right file. is this a strong ask?

return servers, nil
}

func kubernetesTranslatePlatformConfig(ctx context.Context, desired *platformtypes.DesiredState) (*platformtypes.KubernetesPlatformConfig, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, the file naming looks odd -- why not just name the file "platform.go" without the "deployment_adapter_"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above wrt easier for searches

}

func (a *localDeploymentAdapter) Discover(_ context.Context, _ string) ([]*models.Deployment, error) {
return []*models.Deployment{}, nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is something we'll implement, let's add a TODO here, so we don't forget.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we will implement this; it is needed just to implement the interface

@@ -1,450 +0,0 @@
# AGENTS.md - Development Guidelines

This document provides guidelines for both AI coding assistants (Claude, Copilot, Cursor, etc.) and human developers working on the AgentRegistry codebase.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this deleted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, unintended, restoring

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why it still shows as deleted but it is re-added in my pr 266df2e

Copy link
Copy Markdown
Contributor

@peterj peterj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a couple of comments, I'll try to test it in the morning

@peterj peterj added this pull request to the merge queue Mar 11, 2026
Merged via the queue into main with commit d272053 Mar 11, 2026
8 of 9 checks passed
@peterj peterj deleted the api-refactor-8 branch March 11, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants