Skip to content

feat!: add ability to cancel pending workspace build #18713

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kacpersaw
Copy link
Contributor

Closes #17791

This PR adds ability to cancel workspace builds that are in "pending" status.

Breaking changes:

  • CancelWorkspaceBuild method in codersdk now accepts an optional request parameter

API:

  • Added expect_status query parameter to the cancel workspace build endpoint
  • This parameter ensures the job hasn't changed state before canceling
  • API returns 412 Precondition Failed if the job is not in the expected status
  • Valid values: running or pending
  • Wrapped the entire cancel method in a database transaction

UI:

  • Added confirmation dialog to the Cancel button, since it's a destructive operation
  • Enabled cancel action for pending workspaces (expect_status=pending is sent if workspace is in pending status)

@kacpersaw kacpersaw marked this pull request as ready for review July 2, 2025 13:52
@github-actions github-actions bot added the release/breaking This label is applied to PRs to detect breaking changes as part of the release process label Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/breaking This label is applied to PRs to detect breaking changes as part of the release process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to cancel Pending provisioner jobs in the UI
1 participant