-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
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:
- User selects template and preset in Tasks UI
- User enters task details (including workspace name)
- If a fully running prebuild exists, it is claimed immediately
- The workspace name is updated but the prebuild is not restarted
- User-specific configuration from the template is not applied
- Task errors and workspace becomes unusable
Normal Workspace Creation Flow:
- User creates workspace from template
- If a prebuild is claimed, it is properly restarted
- User-specific configuration runs correctly
- 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
- Configure a template with prebuilds enabled
- Ensure template has user-specific configuration in startup scripts (e.g., based on
workspace.owner) - Allow at least one prebuild to reach "running" state
- Create a workspace using the Tasks UI
- Observe that the prebuild is claimed without restart
- Observe that user-specific configuration fails to apply
Related Issues
- bug: template upgrade fails on claimed prebuilt workspace #17840 - Template upgrade fails on claimed prebuilt workspace (different but related issue about
ignore_changesand restarts) - Regression: Workspace doesn't stop before template version change when dynamic parameters enabled #20333 - Workspace doesn't stop before template version change when dynamic parameters enabled (similar restart bypass issue)
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