fix(handlers): reject PATCH runtime with template variant slugs #2958
Reference in New Issue
Block a user
Delete Branch "fix/seo-agent-runtime-patch-validation"
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?
A live customer conversion (JRS seo-template) set
runtime="seo-agent"onPATCH /workspaces/:id."seo-agent"is aclaude-codetemplate variant, not a runtime; persisting it wedges the workspace because no adapter recognizes the pseudo-runtime.Changes
manifest.json: add optional"runtime":"claude-code"to theseo-agentworkspace_templateentry so variant templates resolve to their base runtime.runtime_registry.go: addRuntimetomanifestEntry;loadRuntimesFromManifestuses the explicit base runtime when present. AddisKnownRuntimehelper.workspace_crud.go:PATCH /workspaces/:idnow validates thatruntimeis a known runtime before the(runtime, model)compatibility check, returning422 RUNTIME_UNSUPPORTEDfor unknown/template-variant slugs.Test plan
go test ./workspace-server/internal/handlers/ -count=1go vet ./... && go build ./...🤖 Generated with Claude Code
APPROVE — clean, correct hardening of the PATCH-runtime path; Go CI passes (the red checks are ceremony gates: qa/security/sop/gate-check, not Platform(Go)).
5-axis:
seo-agenttemplate slug, which is a claude-code variant, not a runtime) before it can be persisted and wedge the workspace at boot (no adapter resolves a pseudo-runtime). Matches the create-boundary'sknownRuntimesgate. The manifest"runtime":"claude-code"field +loadRuntimesFromManifestchange correctly map the variant to its base soseo-agentnever registers as a standalone runtime;isKnownRuntime("seo-agent")→ false → 422, whileclaude-code→ proceeds.runtime.(string)unchecked, which would panic on a non-string PATCH body ({"runtime": 5}). The newtypeOKguard returns 400 instead.isKnownRuntimeis fallback-safe (works beforeinitKnownRuntimesvia the compile-time fallback set).runtimeStrrefactor removes repeated assertions; clear error code (RUNTIME_UNSUPPORTED).TestLoadRuntimesFromManifest_UsesExplicitRuntimeForVariantspins the variant→base mapping; workspace_crud_test additions cover the reject paths; Go CI green.Non-blocking note (sequencing): this and #2957 both edit
Update's runtime block (this adds the known-runtime gate before the model-read that #2957 rewrites from theworkspaces.modelcolumn to theMODELworkspace_secret). They'll need rebasing against each other — whichever lands first, rebase the other. They're complementary (this rejects the bad slug; #2957 fixes the model-read for the good runtime), both needed for the JRS conversion.Ships the PATCH-runtime guard. 👍