Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: Tasks UI Does Not Restart Running Prebuilds, Breaking User-Specific Configuration #20767

@bjornrobertsson

Description

@bjornrobertsson

Most Similar Issue found during research:

Based on research, this bug is new and unique.
The issue described is distinct from the existing issues. Issue #17840 is related but different - it deals with template upgrades not properly restarting claimed prebuilt workspaces due to ignore_changes
This report is specifically about the Tasks UI selecting a running prebuild without restarting it when user-specific configuration needs to run.

Problem

When creating a workspace through the Tasks UI, if a fully running prebuild is available, it is selected and assigned without being restarted. This differs from normal workspace creation, which properly restarts the prebuild to apply user-specific configuration.

This behavior causes workspaces to fail when templates rely on restart-time user configuration (e.g., workspace owner-specific setup in startup scripts), as the prebuild retains configuration from the prebuilds system user.

Current Behavior

Tasks UI Flow:

  1. User selects template and preset in Tasks UI
  2. User enters task details (including workspace name)
  3. If a fully running prebuild exists, it is claimed immediately
  4. The workspace name is updated but the prebuild is not restarted
  5. User-specific configuration from the template is not applied
  6. Task errors and workspace becomes unusable

Normal Workspace Creation Flow:

  1. User creates workspace from template
  2. If a prebuild is claimed, it is properly restarted
  3. User-specific configuration runs correctly
  4. Workspace functions as expected

Expected Behavior

The Tasks UI should restart claimed prebuilds to ensure user-specific configuration runs, matching the behavior of normal workspace creation.

Impact

  • Tasks become unusable for templates that configure workspaces based on workspace owner
  • Only occurs when at least one prebuild is fully running and available
  • Workaround: If no prebuilds are running, workspace creation works correctly

Environment

  • Coder Version: v2.26.2+4793806
  • Template Configuration:
    • 1 template used by Tasks
    • 8 prebuilds per region × 3 regions = 24 total prebuilds
  • Reproduction Conditions: At least one prebuild must be in "running" state

Steps to Reproduce

  1. Configure a template with prebuilds enabled
  2. Ensure template has user-specific configuration in startup scripts (e.g., based on workspace.owner)
  3. Allow at least one prebuild to reach "running" state
  4. Create a workspace using the Tasks UI
  5. Observe that the prebuild is claimed without restart
  6. Observe that user-specific configuration fails to apply

Related Issues

Notes

  • Issue does not occur when no prebuilds are running
  • Issue appears to be specific to the Tasks UI code path
  • The workspace name is updated during claim, but this change is not propagated to trigger a restart

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions