Workspace update fails for templates that use dynamic parameters
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- typescript, vscode
調査の方向性
src/api/updateParameters.ts の collectUpdateParameters と promptSpec から始め、legacy パラメーターの処理を、issue にリンクされている dynamic-parameter エンドポイントおよび resolver パスと比較します。extension に適切な mitigation を判断し、workspace の更新が条件付きの必須パラメーターと動的なオプションを処理しながら、legacy の動作を維持することを確認します。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 131
- フォーク
- 48
- 平均マージ
- 4日 15時間
- マージ済み PR(30日)
- 17
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
coder/vscode-coder のほかの issue
-
coder/vscode-coder#1125 · コメント 1 件 · 担当者 1 名 ·
-
tech-debt
coder/vscode-coder#1119 · コメント 1 件 · 担当者 1 名 ·
-
enhancement tech-debt
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
coder/vscode-coder#1118 · コメント 1 件 ·
-
coder/vscode-coder#1113 · コメント 3 件 · 担当者 1 名 ·
-
Flush the connection log buffer after N failed reconnect attempts against an unreachable server オープンenhancement tech-debt
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
coder/vscode-coder#1112 · コメント 1 件 ·
coder/vscode-coder の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
bcgov/bc-wallet-mobile#4761 · コメント 1 件 ·
-
external-issue to-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100