Workspace update fails for templates that use dynamic parameters
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript, vscode
- Ambito
- developer-experience, tooling
Direzione di ricerca
Inizia in src/api/updateParameters.ts, in collectUpdateParameters e promptSpec, quindi confronta la relativa gestione dei parametri legacy con gli endpoint dei parametri dinamici e i percorsi dei resolver collegati nell’issue. Determina quale mitigazione sia appropriata per l’estensione e verifica che gli aggiornamenti del workspace gestiscano i parametri obbligatori condizionali e le opzioni dinamiche, preservando il comportamento legacy.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Symptom
Updating a workspace from VS Code fails with a generic "resolve parameters" 400 error when the template uses dynamic parameters (the dynamic-parameters experiment, docs) and any of the following are true:
- A parameter is conditionally
requiredbased on another input value. - A parameter only appears for certain combinations of other inputs (the static rich-parameters list does not include it).
- A parameter's options are computed dynamically (the static
optionslist is empty or stale).
The user sees the failure as a build error in the workspace logs, with no clear indication that the workspace update endpoint expected additional or different parameter values than were provided.
Root cause
collectUpdateParameters (src/api/updateParameters.ts) calls getTemplateVersionRichParameters, which returns the static parameter list captured at template-version provisioning time (coderd/templateversions.go:287). It then mirrors the dashboard's legacy-params getMissingParameters check.
For templates using dynamic parameters, the dashboard takes a different path entirely:
- It opens a WebSocket at
/api/v2/templateversions/{id}/dynamic-parameters?user_id=…(site/src/api/api.ts:1175). - The server reactively re-renders the parameter form as the user types, evaluating
coder_parameterconditionals against owner data, previous build values, and presets. - On submit, the build endpoint calls
wsbuilder.getDynamicParameters→dynamicparameters.ResolveParameters(coderd/wsbuilder/wsbuilder.go:881), which returns anhcl.Diagnosticserror if any reactive constraint is unsatisfied.
The extension never opens that socket, so its prompt set is whatever the static list said at provisioning time. When the dynamic resolver evaluates the submitted build values and finds a conditionally-required parameter missing (or a dynamically-restricted option violated), the build fails.
Reproduction
- Author a template with
terraform-provider-coder v2.xdeclaring two parameters where the second isoptionalonly when the first has a specific value (a typical reactive form), and enable thedynamic-parametersexperiment on the deployment. - Create a workspace from that template, choosing values such that the conditional path requires the second parameter.
- Update the template's active version (any change that keeps both parameters but does not alter the conditional logic).
- From VS Code, run
coder.updateWorkspaceon the workspace. - Observe the build fails with a 400 "resolve parameters" error from
wsbuilder. The extension shows a generic workspace-update-failed notification; the underlying diagnostic is only visible in the workspace logs.
Scope of impact
- Affected: any deployment with the
dynamic-parametersexperiment enabled (the path the Coder team is pushing as the default going forward). - Not affected: deployments still on legacy/classic parameters — those continue to work with the existing
needsPromptlogic. - Partial impact: templates that enable dynamic parameters but never use any reactive constructs (no conditional
required, no dynamic option lists, no conditionally-appearing parameters) update fine, because the static list happens to be accurate.
Proposed mitigations
In rough order of effort:
- Detect and warn (S): read the template's
use_classic_parameter_flow(or equivalent) flag incollectUpdateParameters. If false, surface a one-line warning telling the user to update via the dashboard (with a deep link) and skip the prompts. Currently we silently send incomplete data. - One-shot REST evaluate (M): call
POST /api/v2/templateversions/{id}/dynamic-parameters/evaluate(coderd/parameters.go, api.ts:1155) with the current build parameters asinputs, feed the returned non-reactive parameter list into the existingpromptSpec+ QuickPick flow. Loses interactive reactivity but picks up server-evaluatedrequiredand option lists. Best ROI for most templates. - WebSocket + Webview (L): open
/api/v2/templateversions/{id}/dynamic-parametersfrom the extension, render a reactive form in a Webview, send each answer back as the user fills it in. Closest to the dashboard UX but a real feature, not a fix. ExistingreconnectingWebSocket.tsinfra is reusable.
Related
- PR #967 (this PR): legacy-params drift detection and immutable-param prompting. Closes the legacy gap but explicitly does not address dynamic params; the JSDoc on
promptSpeccalls this out. - The dashboard skips its
getMissingParametersclient-side check whenisDynamicParametersEnabledis true (site/src/api/api.ts:2532) and relies entirely on the server resolver.
- Lingua principale
- TypeScript
- Stelle
- 131
- Fork
- 48
- Merge medio
- 4g 16h
- PR unite (30g)
- 13
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di coder/vscode-coder
-
tech-debt
coder/vscode-coder#1120 · 1 commento · 1 assegnatario ·
-
tech-debt
coder/vscode-coder#1119 · 1 commento · 1 assegnatario ·
-
enhancement tech-debt
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
coder/vscode-coder#1118 · 1 commento ·
-
coder/vscode-coder#1113 · 3 commenti · 1 assegnatario ·
-
Flush the connection log buffer after N failed reconnect attempts against an unreachable server Apertaenhancement tech-debt
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
coder/vscode-coder#1112 · 1 commento ·
Tutte le issue di coder/vscode-coder
Issue simili
-
Type/Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenNSW/nsw-srilanka#497 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
0xMiden/bridge-portal#132 ·
-
react-doctor severity:warning tech-debt
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
digidem/comapeo-cloud-app#403 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100