Skip to content

bug: Create workspace submit can use stale parameter values while dynamic-parameters WebSocket evaluation is pending #27125

Closed

Description

@lasttry

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Current Behavior

On the Create workspace page with Dynamic Parameters enabled, each parameter
change triggers a WebSocket round-trip to /api/v2/templateversions/{id}/dynamic-parameters.
On our template (< />70 Terraform resources, < />27 .tf files), each evaluation takes < />4–5 seconds.
If the user edits one or more parameters and clicks Create workspace before the latest
WebSocket response returns, the submitted build may not use the values shown in the form
(often reverting to previous/default values). This is reproducible across multiple fields,
not a single-parameter validation issue.
The submit button is only disabled for:

  • workspace creation in progress
  • missing required external auth
  • diagnostic errors
    It is not disabled while a dynamic-parameters request is in flight.
    Relevant frontend code (main branch):
  • site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx — submit disabled logic
  • site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx — wsResponseId vs latestResponse.id
  • site/src/modules/hooks/useSyncFormParameters.ts — can overwrite values before setFieldTouched completes
    There is also a 500ms debounce for input/textarea fields before the WebSocket request is sent,
    widening the race window.
Screen.Recording.2026-07-08.at.10.52.23.mov

Diagnostic notes from our investigation:

Relevant Log Output

Expected Behavior

  1. Create workspace should be disabled (or queued) until the latest dynamic-parameters
    evaluation for the current form state has completed successfully.
  2. Alternatively, submit should always send the current form values and not be overwritten by
    stale WebSocket sync responses.
  3. Ideally: cancel/coalesce in-flight preview requests and/or cache ParseFS results between
    evaluations (coder/preview re-parses the full template graph on every message).

Steps to Reproduce

  1. Use a template with Dynamic Parameters enabled and non-trivial Terraform (~ dozens of resources).
  2. Open Create workspace for that template.
  3. Wait for the initial form to load.
  4. Type a new value in a string parameter (e.g. version field) or change any parameter.
  5. Click Create workspace within ~5 seconds (before WebSocket evaluation completes).
  6. Observe the created workspace build parameters — the new value was not applied.

Environment

  • Coder version: v2.34.5+c3dd41e
  • Template: large on-prem EC2 Terraform template (~70 resources, 22 parameters)

Additional Context

The issue occurs consistently, The issue happens on multiple deployments, I have tested this on the latest version

Activity

  1. added theissue type on Jul 9, 2026
  2. linear-code commented on Jul 9, 2026

    @linear-code
  3. PushTheLimit commented on Jul 15, 2026

    @PushTheLimit
    Contributor

    Confirming we're hitting this too. Reproduced on our own deployment running Coder v2.35.1, so it's still present as of 2.35.1 (this report was filed against v2.34.5).

    +1 on the proposed fixes here: disabling Create while an evaluation (or the input debounce) is pending, and/or always submitting the current form values so a stale sync response can't overwrite them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions