Skip to content

fix: block delete while instance is still provisioning - #521

Merged
patelspratik merged 1 commit into
mainfrom
BREV-12948/block-delete-while-provisioning
Oct 29, 2026
Merged

patelspratik merged 1 commit into
mainfrom
BREV-12948/block-delete-while-provisioning

Conversation

@shivamj-del

Copy link
Copy Markdown
Contributor

Issue

brev delete sends the delete request for any instance, including one that's still pending, preparing, or provisioning. The UI disables Delete in those states, because deleting mid-setup leaves the Build workflow running against an environment that no longer exists, and it then fails with "environment not found".

Fix

  • Before deleting, read the environment from dev-plane (GetEnvironment added to DeleteStore) and check environment.status, the same status the UI uses.
  • If it's pending, preparing, or provisioning, fail without sending the delete: instance "<name>" is still provisioning and can't be deleted yet. Run 'brev ls' and try again once it's running. The phase in the message follows the status.
  • If dev-plane returns no status, fall back to the workspace status and block while it's DEPLOYING.
  • New environment.SetupPhase helper next to IsFailed in pkg/environment/status.go, with a table test. Failed setups (preparing_failed, provisioning_failed) can still be deleted.

@shivamj-del
shivamj-del marked this pull request as ready for review October 29, 2026 03:19
@shivamj-del
shivamj-del requested a review from a team as a code owner October 29, 2026 03:19
@shivamj-del shivamj-del self-assigned this Oct 29, 2026
@patelspratik
patelspratik merged commit 51720da into main Oct 29, 2026
11 checks passed
@patelspratik
patelspratik deleted the BREV-12948/block-delete-while-provisioning branch October 29, 2026 16:10
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.

2 participants