fix(workspace_provision): preserve MODEL secret over MODEL_PROVIDER slug on restart #136
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/preserve-model-secret-on-restart"
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?
Phase 4 follow-up to template-claude-code PR #9 (2026-05-08 dev-tree wedge).
Problem
applyRuntimeModelEnvunconditionally overwroteenvVars["MODEL"]with theMODEL_PROVIDERslug wheneverpayload.Modelwas empty (the restart path). This silently wiped the operator's explicit per-personaMODELsecret on every restart.Symptom: dev-tree workspaces booted correctly on first
/org/import(theenvVarsmap was populated direct from the persona env file with bothMODEL=MiniMax-M2.7-highspeedandMODEL_PROVIDER=minimax), then on the nextRestarttheMODELsecret got clobbered to literal"minimax"— a provider slug, not a valid model id — and the workspace template's adapter failed to match any registry prefix, fell through toproviders[0](anthropic-oauth), and wedged at SDK initialize.Fix
Resolution order in
applyRuntimeModelEnvis now:payload.Model— caller passed the canvas-picked model id verbatim.envVars["MODEL"]— workspace_secret persisted from persona env (/org/import).envVars["MODEL_PROVIDER"]— legacy canvasSave+Restartshape.Tests
TestApplyRuntimeModelEnv_PersonaEnvMODELSecretPreserved— four cases locking in the precedence.TestApplyRuntimeModelEnv_SetsUniversalMODELForAllRuntimescontinues to pass.