Skip to content

fix: disallow lifecycle endpoints for prebuilt workspaces #19264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ssncferreira
Copy link
Contributor

@ssncferreira ssncferreira commented Aug 8, 2025

Description

This PR updates the API to prevent lifecycle configuration endpoints from being used on prebuilt workspaces. Since prebuilds are managed by the reconciliation loop and do not participate in the regular workspace lifecycle, they must not support per-workspace overrides for fields like deadline, TTL, autostart, or dormancy.

Attempting to use these endpoints on a prebuilt workspace will now return a clear validation error (409 Conflict) with an appropriate explanation. This prevents accidental misconfiguration and preserves the lifecycle separation between prebuilds and regular workspaces.

Changes

The following endpoints now return an error if the target workspace is a prebuild:

  • PUT /workspaces/{workspace}/extend
  • PUT /workspaces/{workspace}/ttl
  • PUT /workspaces/{workspace}/autostart
  • PUT /workspaces/{workspace}/dormant

Related with:

@ssncferreira ssncferreira changed the title fix(api): disallow lifecycle configuration for prebuilt workspaces fix: disallow lifecycle configuration for prebuilt workspaces Aug 8, 2025
@ssncferreira ssncferreira changed the title fix: disallow lifecycle configuration for prebuilt workspaces fix: disallow lifecycle endpoints for prebuilt workspaces Aug 8, 2025
// Prebuild lifecycle is managed by the reconciliation loop, with scheduling behavior
// defined per preset at the template level, not per workspace.
if workspace.IsPrebuild() {
httpapi.Write(ctx, rw, http.StatusConflict, codersdk.Response{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

409 Conflict based on discussion: #19252 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy