management MCP/CLI cannot migrate a workspace's compute provider (canvas can) — add migrate-provider #5
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Gap
The canvas UI can migrate a workspace's compute provider cross-cloud (AWS↔Hetzner↔GCP) — it calls the control-plane
migrate-providerendpoint. The management MCP server andmoleculeCLI cannot: there is no tool/command that triggers a provider migration, so the management surface is inconsistent with what the product already exposes.Evidence the MCP/CLI can't do it today:
update_workspace(server/src/tools/workspaces.ts) exposesname/role/tier/parent_idbut noprovider/computefield.move_agentis org-structure only;restart_workspacehas no provider param.workspacecommand group (internal/cmd/workspace*.go) has no migrate verb.This is a real capability gap, filed against the SSOT-derived tooling chain (OpenAPI → MCP → CLI → docs).
The CP contract (source-verified against
molecule-controlplane)Route (admin surface, gated by
AdminGate→CP_ADMIN_API_TOKEN):Handler:
internal/handlers/admin_workspace_migrate_provider.go→MigrateWorkspaceProvider/GetWorkspaceMigrationStatus. Router:internal/router/router.go.Request body:
Responses:
202 {"status":"migration_started","workspace_id","from","to","note"}— runs async (~15-20 min, detached goroutine).400— bad/same provider, missingfrom_instance_id(non-AWS), orconfirmnot true.409— a migration is already in progress for this workspace.503— migrator/data-persistence not wired in this env.GET status →
200 {"migration": <MigrationStatus>, "terminal": bool}. State machine:snapshotting → snapshotted → provisioning_target → target_healthy → retiring_source → completed; terminal =completed | failed | rolled_back.Auth: CP admin bearer (
cpAdminBearer), exactly likePOST /api/v1/admin/workspaces/{id}/env. The tenant Org API Key has no standing on the CP — this is a CP-admin operation, modeled alongside the othercpAdminBeareradmin ops inmanagement.yaml.Plan (SSOT-first)
migrate-provider+migration-statusoperations to the OpenAPI SSOTworkspace-server/docs/openapi/management.yamlinmolecule-core(request/response/status schemas). [PR in molecule-core]migrate_workspace_provider+get_workspace_migration_statustools (CP-admin-bearer call path) derived from the spec. Unit tests. [PR in molecule-mcp]molecule workspace migrate-provider --to <p> [--from <p>] <id>+migration-status <id>, via the existingcpAdminClient()path. Tests +--help. [PR in molecule-cli]platform-management-api(reference + tasks). [PR in docs]Closes the canvas/management-surface inconsistency.
Claimed by Kimi (Engineer-A) for implementation. PR incoming.