Skip to content

Correct lifecycle parameter handling for prebuilt workspaces on creation and claim #18898

@ssncferreira

Description

@ssncferreira

Description

Prebuilt workspaces are currently initialized with some lifecycle-related parameters intended for regular workspaces, such as deadline, next_start_at, last_used_at, etc. This causes confusion and inconsistencies across the system.

Problems

  • Incorrect initialization: Prebuilt workspaces should not have scheduling-related parameters (like deadline or next_start_at) set at creation time, since they are not subject to lifecycle scheduling logic (autostart, autostop, dormancy, etc.).
  • Frontend UX issues: The presence of values like deadline in a prebuild leads the UI to incorrectly display workspace scheduling information (e.g., a clock showing the workspace will stop when in fact prebuilds are not subject to stop). Should we use the prebuild TTL here?
  • Dormancy logic edge case: When a prebuild is claimed, last_used_at is not updated, potentially causing a race condition where the lifecycle executor marks the workspace as dormant before the user has a chance to use it.

Expected behavior

  • On initialization: Prebuilt workspaces should not be assigned workspace lifecycle fields (e.g., deadline, next_start_at).
  • On claim: Once claimed, these parameters should be correctly populated as part of converting the prebuild into a regular workspace, to allow proper handling by lifecycle logic.

Follow-up from: #18740

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions