Skip to content

direct: fail deploy and destroy when a resource delete is rejected - #7931

Merged
denik merged 7 commits into
denik/cov-delete-err-testfrom
denik/cov-delete-err-fix
Nov 26, 2026
Merged

denik merged 7 commits into
denik/cov-delete-err-testfrom
denik/cov-delete-err-fix

Conversation

@denik

@denik denik commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Changes

(*DeploymentUnit).Delete returns the delete error again when the backend rejects a delete with an error that is not missing, managed-by-parent or permission-denied, and a re-read does not show the resource gone. Before, without deployment history, it fell through to dropping the resource from state: bundle destroy and bundle deploy (for a resource removed from the config) reported success while the resource stayed in the workspace, untracked.

This is a regression from #6094 (7bf1485), which changed the final

} else {
	return fmt.Errorf("deleting id=%s: %w", oldID, err)
}

into } else if db.IsDeploymentMetadataService() { ...; return err } (renamed to RecordsHistory in #7169), so the case without deployment history lost its return.

Fix shape: I kept the pre-#6094 behavior. The error is returned for every run, with or without deployment history, and the resource stays in state so the next deploy or destroy retries the delete. RecordFailure is still called unconditionally in that branch; it is already a no-op when history is not recorded, so nothing extra is written for runs without history.

Tests:

  • bundle/destroy/delete-error (from acc: record that a rejected delete drops the resource from state in bundle/destroy/delete-error #7930): output now shows both commands failing with the delete error and the job kept in state; Badness removed and the DMS=true variant re-enabled (both variants now share one golden).

  • bundle/resources/materialization_sets/settled_failure: its destroy step recorded the old behavior ("forgives a delete error ... drops the state while the set stays in the workspace") and was pinned to DMS="" for that reason. It now asserts the destroy fails (musterr) and runs on both variants.

  • In the fix PR, bundle/destroy/delete-error asserts the failures with musterr and prints the state after the partial destroy: foo (rejected) is kept and bar (deleted) is gone.

Scope notes:

  • Any delete error that is not missing, managed-by-parent or permission-denied, and that a re-read cannot confirm as gone, now fails the command on runs without deployment history, as it did before bundle: record and read deployment state via DMS #6094 and as it already does with history on. A resource type whose backend reports an in-progress or already-done teardown with some other error would need its IsGone (or the error classification) taught about it; I did not find such a case among the existing tests.
  • When a destroy partly fails, destroyCore returns before printing the Destroy: N deleted summary. That is existing behavior for every delete error (including runs with history) and is left for a separate change.

Overlap: #7496 changes the same lines and keeps the fallthrough (with a warning and a "removed from state" count). This PR removes the fallthrough instead; the two need to be reconciled whichever lands first.

Why

A destroy that reports success while leaving resources in the workspace is worse than a failure: the user has no state and no message pointing at the leftover resource.

This PR was created by analyzing coverage gaps.

Coverage: bundle/direct/apply.go, (*DeploymentUnit).Delete, the branch for a delete error that is not missing, managed-by-parent or permission-denied.

Tests

go test ./acceptance -run 'TestAccept/bundle/destroy/delete-error' and TestAccept/bundle/resources/materialization_sets; go test ./bundle/....

AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

Without deployment history, a delete rejected with an error other than
not-found or permission-denied fell through to dropping the resource from
state, so the command succeeded and the resource stayed in the workspace
untracked. Return the error again, as before the deployment history change.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…ete-error

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Commit: 7fda907d1 | Workflow run

Regression test report

Selected 2 changed tests (limit=20, 0 not selected)

4 tests: regression=2 unreleased=0 coverage=2 failing=0
test branch main (0c71683) latest (v1.28.0)
TestAccept/bundle/destroy/delete-error/DMS= ✅ ❌ ❌
TestAccept/bundle/destroy/delete-error/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/materialization_sets/settled_failure/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/materialization_sets/settled_failure/DMS=true ✅ ✅ ✅
TestAccept/bundle/destroy/delete-error/DMS=: branch ✅ | main (0c71683) ❌ | latest (v1.28.0) ❌

main (0c71683):

acceptance_test.go:1402: Diff:
        --- bundle/destroy/delete-error/output.txt
        +++ /tmp/TestAcceptbundledestroydelete-errorDMS=1883153541/002/output.txt
        @@ -10,41 +10,10 @@
         
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/delete-error-[UNIQUE_NAME]/default/files...
        -Error: cannot delete resources.jobs.bar: deleting id=[BAR_ID]: Fault injected by test. (400 INVALID_PARAMETER_VALUE)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/delete
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        -API message: Fault injected by test.
        -
        +Deleted jobs.bar
         Files: 1 uploaded, 0 deleted
        +Resources: 0 created, 0 changed, 1 deleted, 1 unchanged
         
        ->>> [CLI] jobs get [BAR_ID]
        -json.settings.name = "bar-[UNIQUE_NAME]";
        +Unexpected success
         
        ->>> print_state.py
        -json.state.resources.jobs.bar.__id__ = "[BAR_ID]";
        -json.state.resources.jobs.foo.__id__ = "[FOO_ID]";
        -
        -=== destroy: the delete of foo is rejected with 400
        -
        ->>> musterr [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.jobs.bar
        -  delete resources.jobs.foo
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/delete-error-[UNIQUE_NAME]/default
        -
        -Error: cannot delete resources.jobs.foo: deleting id=[FOO_ID]: Fault injected by test. (400 INVALID_PARAMETER_VALUE)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/delete
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        -API message: Fault injected by test.
        -
        -
        ->>> [CLI] jobs get [FOO_ID]
        -json.settings.name = "foo-[UNIQUE_NAME]";
        -
        ->>> print_state.py
        -json.state.resources.jobs.foo.__id__ = "[FOO_ID]";
        +Exit code: 1
        
    acceptance_test.go:1192: Test produced unexpected files:
        .databricks/.gitignore
        .databricks/bundle/default/deployment.json
        .databricks/bundle/default/released-deploy-locks.json
        .databricks/bundle/default/resources.json
        .databricks/bundle/default/sync-snapshots/dd042e40d2625286.json

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/destroy/delete-error/output.txt
        +++ /tmp/TestAcceptbundledestroydelete-errorDMS=1076115312/002/output.txt
        @@ -10,41 +10,10 @@
         
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/delete-error-[UNIQUE_NAME]/default/files...
        -Error: cannot delete resources.jobs.bar: deleting id=[BAR_ID]: Fault injected by test. (400 INVALID_PARAMETER_VALUE)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/delete
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        -API message: Fault injected by test.
        -
        +Deleted jobs.bar
         Files: 1 uploaded, 0 deleted
        +Resources: 0 created, 0 changed, 1 deleted, 1 unchanged
         
        ->>> [CLI] jobs get [BAR_ID]
        -json.settings.name = "bar-[UNIQUE_NAME]";
        +Unexpected success
         
        ->>> print_state.py
        -json.state.resources.jobs.bar.__id__ = "[BAR_ID]";
        -json.state.resources.jobs.foo.__id__ = "[FOO_ID]";
        -
        -=== destroy: the delete of foo is rejected with 400
        -
        ->>> musterr [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.jobs.bar
        -  delete resources.jobs.foo
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/delete-error-[UNIQUE_NAME]/default
        -
        -Error: cannot delete resources.jobs.foo: deleting id=[FOO_ID]: Fault injected by test. (400 INVALID_PARAMETER_VALUE)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/delete
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        -API message: Fault injected by test.
        -
        -
        ->>> [CLI] jobs get [FOO_ID]
        -json.settings.name = "foo-[UNIQUE_NAME]";
        -
        ->>> print_state.py
        -json.state.resources.jobs.foo.__id__ = "[FOO_ID]";
        +Exit code: 1
        
    acceptance_test.go:1192: Test produced unexpected files:
        .databricks/.gitignore
        .databricks/bundle/default/deployment.json
        .databricks/bundle/default/released-deploy-locks.json
        .databricks/bundle/default/resources.json
        .databricks/bundle/default/sync-snapshots/f837a93b38c1a21f.json
TestAccept/bundle/resources/materialization_sets/settled_failure/DMS=: branch ✅ | main (0c71683) ❌ | latest (v1.28.0) ❌

main (0c71683):

acceptance_test.go:1402: Diff:
        --- bundle/resources/materialization_sets/settled_failure/output.txt
        +++ /tmp/TestAcceptbundleresourcesmaterialization_setssettled_failure3592193155/002/output.txt
        @@ -34,7 +34,6 @@
         === The delete settles FAILED the same way: the destroy fails with the operation's error and
         
         === keeps the set, and the features that depend on it, in state.
        -
         >>> musterr [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
           delete resources.features.failfeat
        @@ -43,19 +42,14 @@
         
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-matset-settled-[UNIQUE_NAME]/default
         
        -Error: cannot delete resources.features.failfeat: dependency failed: resources.materialization_sets.set1
        +Destroy: 3 deleted
         
        -Error: cannot delete resources.features.okfeat: dependency failed: resources.materialization_sets.set1
        -
        -Error: cannot delete resources.materialization_sets.set1: deleting id=[UUID][0]: materialization set [UUID][0]: operation failed: [INTERNAL_ERROR] Deleted 0 of 2 materialized features in materialization set '[UUID][0]'. The operation's progress lists which deletion succeeded, which failed and why.; members left unchanged: [UUID][1] (INTERNAL_ERROR): Failed to delete materialized feature '[UUID][1]'. If the issue persists, please retry or contact support.; [UUID][2] (INTERNAL_ERROR): Failed to delete materialized feature '[UUID][2]'. If the issue persists, please retry or contact support.
        -
         This action will result in the deletion of the following Feature Views.
         Deleting a Feature View that a FeatureSpec serves is not blocked, and leaves the FeatureSpec stale:
           delete resources.features.failfeat
           delete resources.features.okfeat
         
        +Unexpected success
         
        ->>> print_state.py
        -json.state.resources.features.failfeat.__id__ = "main.myschema.teardown_fails_[UNIQUE_NAME]";
        -json.state.resources.features.okfeat.__id__ = "main.myschema.ok_[UNIQUE_NAME]";
        -json.state.resources.materialization_sets.set1.__id__ = "[UUID][0]";
        +
        +Exit code: 1
        
    acceptance_test.go:1384: Unexpected output file: out.plan.json
        pathRef: bundle/resources/materialization_sets/settled_failure/out.plan.json
        pathNew: /tmp/TestAcceptbundleresourcesmaterialization_setssettled_failure3592193155/001/out.plan.json
    acceptance_test.go:1192: Test produced unexpected files:
        out.plan.json
FAIL

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/materialization_sets/settled_failure/output.txt
        +++ /tmp/TestAcceptbundleresourcesmaterialization_setssettled_failure4150972906/002/output.txt
        @@ -34,7 +34,6 @@
         === The delete settles FAILED the same way: the destroy fails with the operation's error and
         
         === keeps the set, and the features that depend on it, in state.
        -
         >>> musterr [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
           delete resources.features.failfeat
        @@ -43,19 +42,14 @@
         
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-matset-settled-[UNIQUE_NAME]/default
         
        -Error: cannot delete resources.features.failfeat: dependency failed: resources.materialization_sets.set1
        +Destroy: 3 deleted
         
        -Error: cannot delete resources.features.okfeat: dependency failed: resources.materialization_sets.set1
        -
        -Error: cannot delete resources.materialization_sets.set1: deleting id=[UUID][0]: materialization set [UUID][0]: operation failed: [INTERNAL_ERROR] Deleted 0 of 2 materialized features in materialization set '[UUID][0]'. The operation's progress lists which deletion succeeded, which failed and why.; members left unchanged: [UUID][1] (INTERNAL_ERROR): Failed to delete materialized feature '[UUID][1]'. If the issue persists, please retry or contact support.; [UUID][2] (INTERNAL_ERROR): Failed to delete materialized feature '[UUID][2]'. If the issue persists, please retry or contact support.
        -
         This action will result in the deletion of the following Feature Views.
         Deleting a Feature View that a FeatureSpec serves is not blocked, and leaves the FeatureSpec stale:
           delete resources.features.failfeat
           delete resources.features.okfeat
         
        +Unexpected success
         
        ->>> print_state.py
        -json.state.resources.features.failfeat.__id__ = "main.myschema.teardown_fails_[UNIQUE_NAME]";
        -json.state.resources.features.okfeat.__id__ = "main.myschema.ok_[UNIQUE_NAME]";
        -json.state.resources.materialization_sets.set1.__id__ = "[UUID][0]";
        +
        +Exit code: 1
        
    acceptance_test.go:1384: Unexpected output file: out.plan.json
        pathRef: bundle/resources/materialization_sets/settled_failure/out.plan.json
        pathNew: /tmp/TestAcceptbundleresourcesmaterialization_setssettled_failure4150972906/001/out.plan.json
    acceptance_test.go:1192: Test produced unexpected files:
        out.plan.json

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 7fda907

Run: 45580462332

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 272 21 5:48
💚​ aws-windows-latest-4core-16gb 1 274 19 3:24
💚​ azure linux-2core-8gb 1 271 21 4:40
💚​ azure-windows-latest-4core-16gb 1 273 19 2:26
💚​ gcp linux-2core-8gb 1 272 21 5:19
💚​ gcp-windows-latest-4core-16gb 1 274 19 3:59
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:12 aws linux-2core-8gb TestAccept
3:59 gcp linux-2core-8gb TestAccept
3:21 azure linux-2core-8gb TestAccept
2:12 gcp-windows-latest-4core-16gb TestAccept
2:09 aws-windows-latest-4core-16gb TestAccept
2:00 azure-windows-latest-4core-16gb TestAccept

@denik
denik marked this pull request as ready for review November 24, 2026 15:43
@denik
denik requested review from a team as code owners November 24, 2026 15:43

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review at 7c6fe4c. Each finding was verified against the code.

No blocking issues found. 1 non-blocking comment(s) below.

This PR makes (*DeploymentUnit).Delete return the delete error on runs without deployment history too, so a rejected delete fails bundle deploy/bundle destroy and the resource stays in state. That restores the behavior from before #6094. The change in apply.go is right: RecordFailure already does nothing when history isn't recorded, and deleteConfirmedGone is still checked first. One test gap remains: the settled_failure golden doesn't show the state that its new title describes.

Co-authored-by: Isaac <no-reply@databricks.com>
…er order

Co-authored-by: Isaac <no-reply@databricks.com>
settled_failure/test.toml: #7919 added a Badness for the bug this PR fixes;
keep this branch's version, which drops it with the DMS pin.

Co-authored-by: Isaac <no-reply@databricks.com>

@Sankalp-Mittal Sankalp-Mittal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[AI Generated] Review by review-factory (Claude Sonnet 5.5 + Claude Opus 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.

No issues found.

@denik
denik added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 29baac2 Nov 26, 2026
53 of 55 checks passed
@denik
denik deleted the denik/cov-delete-err-fix branch November 26, 2026 12:19
@denik

denik commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 This PR made the cluster variants of the bundle invariants flaky on AWS, Azure and GCP since 2026-11-26 (merge day): invariant/delete_idempotent cluster.yml.tmpl, invariant/destroy_idempotent cluster_libraries.yml.tmpl and the other cluster*.yml.tmpl variants, all with error/598 "cannot delete resources.clusters.foo: deleting id=[ID]: Cluster [ID] does not exist (400 INVALID_PARAMETER_VALUE)". The second deploy or destroy re-deletes a cluster that is already gone. The cluster read runs clusters/get and libraries/cluster-status concurrently and returned whichever error came first; for a deleted cluster both are 400 INVALID_PARAMETER_VALUE, but the SDK maps only the clusters/get one to not-found. When the library-status error came first, the plan kept the delete, permanent-delete failed with the same 400, and the re-read lost the same race. Before this PR that error was dropped on runs without deployment history; now it fails the command, as intended, which exposed the race (from #6831). Fix: #8068 (open, in review), tracked in ticket/129.

AI agent (opus5.5, isaac_claude)

stevenayers pushed a commit to stevenayers/cli that referenced this pull request Nov 28, 2026
…undle/destroy/delete-error (databricks#7930)

## Changes

New test `acceptance/bundle/destroy/delete-error` that records how
deploy and destroy handle a job delete the backend rejects (400
`INVALID_PARAMETER_VALUE`, injected with `fault.py`):

- `bundle deploy` after removing a job from the config prints `Deleted
jobs.bar` and exits 0; the job still exists and is no longer in state.
- `bundle destroy` prints `Destroy: 1 deleted` and exits 0 and removes
the state; the job still exists, untracked.

`Badness` in `test.toml` says what should happen instead: both commands
fail with the delete error and keep the resource in state, as the
`DMS=true` run already does. The `DMS=true` variant is excluded for now
because its output differs; the fix PR (stacked on this one) re-enables
it.

Fix: databricks#7931

## Why

A delete that fails this way leaves a resource in the workspace that no
bundle tracks, while the CLI reports success. New small test directory
(no existing test sets up a delete fault for a removed resource);
runtime about 0.5s per variant.

This PR was created by analyzing coverage gaps.

Coverage:
[bundle/direct/apply.go](http://go/cli/dashboard/coverage/file/bundle/direct/apply.go),
`(*DeploymentUnit).Delete`, the branch for a delete error that is not
missing, managed-by-parent or permission-denied.

## Tests

`go test ./acceptance -run TestAccept/bundle/destroy/delete-error`

AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

---------

Co-authored-by: Isaac <no-reply@databricks.com>
stevenayers pushed a commit to stevenayers/cli that referenced this pull request Nov 28, 2026
…atabricks#8068)

🤖 

## Changes

`ResourceCluster.DoRead` ran `clusters/get` and
`libraries/cluster-status` concurrently through an errgroup and returned
whichever error came first. For a deleted cluster the backend answers
both, and `clusters/permanent-delete`, with `400
INVALID_PARAMETER_VALUE` "Cluster <id> does not exist". The Go SDK maps
only the `clusters/get` answer to `ErrResourceDoesNotExist`. When the
library-status error came first, the plan warned about a read failure
and kept the delete, `permanent-delete` failed with 400, and the re-read
in `deleteConfirmedGone` lost the same race, so the command failed.
Since databricks#7931 that delete error fails `bundle deploy` / `bundle destroy`
instead of dropping the entry from state, so the race now shows up as
flaky failures.

- `DoRead`: the cluster GET error takes precedence, and the library read
is cancelled once the cluster GET failed (as the errgroup did before). A
deleted cluster now always reads as not found, so the plan drops it
without a delete; a delete that still hits an already-deleted cluster
(saved plan, deleted after planning) is confirmed gone by the existing
re-read in `deleteConfirmedGone`.
- `libs/testserver`: `clusters/get`, `libraries/cluster-status` and
`permanent-delete` for a missing cluster return the cloud's 400 (was 404
/ success). One golden changes: `bundle/migrate/auto/artifacts` now
shows the cloud's message instead of "Not Found".

## Why

Dashboard: [error/598](http://go/cli/dashboard/error/598), first seen on
main on 2026-11-26 after databricks#7931, on AWS, Azure and GCP:

```
Error: cannot delete resources.clusters.[NAME]: deleting id=[ID]: Cluster [ID] does not exist (400 INVALID_PARAMETER_VALUE)
```

Tests:
-
[TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster.yml.tmpl/READPLAN=1](http://go/cli/dashboard/test/acceptance.TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster.yml.tmpl/READPLAN=1)
-
[TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=](http://go/cli/dashboard/test/acceptance.TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=)
-
[TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=](http://go/cli/dashboard/test/acceptance.TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=)
-
[TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=](http://go/cli/dashboard/test/acceptance.TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=)
- and the other `cluster*.yml.tmpl` variants of both invariants.

## Tests

- New `bundle/resources/clusters/deleted-out-of-band`: the state points
at a cluster that no longer exists, and a `clusters/get` stub answers
the 400 after 300ms, so the library-status 400 always comes first.
`bundle destroy` and a deploy that removes the cluster both fail on main
with the error above; they pass here.
- New `bundle/resources/clusters/deleted-out-of-band-plan` (no stub): a
cluster deleted out of band and still in config is created again; a
saved-plan delete of a cluster deleted after the plan sends
`permanent-delete`, gets the 400, and `deleteConfirmedGone` drops the
state entry (with its existing warning; databricks#8046 moves that warning to
debug).
- A unit test that the library read is cancelled once the cluster GET
failed (main's errgroup did that too; it guards the new code).
- The cloud run (commit message) reruns both invariants on every cloud.

## Gaps and risks

- The 400 responses were checked on AWS only. The cloud run of the
invariants covers the read path on Azure and GCP; no cloud test sends
`permanent-delete` for a missing cluster, so the fake's 400 there rests
on the AWS check (the CLI drops the state entry whatever that call
returns, since the re-read decides). Follow-up: make
`deleted-out-of-band-plan` a cloud test.
- A cluster deleted between the two concurrent GETs (cluster GET
succeeds, library status says it does not exist) still fails that plan
once with a read error; the next command reads it as not found. No
message matching is added for it (AGENTS.md rules out branching on error
text).
- Overlaps with databricks#8046 (open) in purpose only: that PR logs the
`deleteConfirmedGone` fallback at debug level; this PR relies on that
fallback for the saved-plan case. No shared lines.
- Risk: medium (deploy/destroy path, concurrency in `DoRead`).

AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

---------

Co-authored-by: Isaac <no-reply@databricks.com>
deco-sdk-tagging Bot added a commit that referenced this pull request Dec 2, 2026
## Release v1.29.0

### Notable Changes

 * Introduce device code login: `databricks auth login --use-device-code` logs in from a machine that cannot open a browser, such as a headless server or an SSH session, by approving the login in a browser on another device. See [docs/device-code-login.md](https://github.com/databricks/cli/blob/main/docs/device-code-login.md). ([#8069](#8069))

### CLI

 * Automatic installation of Databricks AI tools no longer moves a Databricks skill that you put into a coding agent's skills directory (for example `~/.cursor/skills/databricks-sql`) to a temporary directory when no `databricks aitools install` has run yet. While that skill is there it installs no skills, though agents that use the Databricks plugin still get it; if you answered yes to the install question, it prints which skill it kept and the command that replaces it. A later CLI version finishes the install once you move the skill out. ([#8071](#8071))
 * Automatic installation of Databricks AI tools no longer runs a coding agent's CLI after a command you ran for something else, so a Databricks plugin install no longer runs out of time there: an agent without the Databricks plugin gets skill files, an agent that has the plugin keeps it and gets no skill files next to it, and `databricks aitools update` still updates the plugin. Only the install that follows a yes to the question of `databricks auth login` installs the plugins, as `databricks aitools install --scope=global` does. When that install is stopped, a later run gives the skill files to the agents that did not get them, keeping the skill files you edited since, and runs no agent's CLI: an agent that was to get the plugin is left for `databricks aitools install`. On Windows, where stopping an agent's CLI does not stop the processes it started, no automatic installation runs an agent's CLI. `databricks aitools update` no longer gives skill files to an agent that has the Databricks plugin and none of the CLI's skill files. ([#8224](#8224))
 * `databricks aitools install --skills-only --scope project` now installs Codex skills into `<project>/.agents/skills` instead of skipping Codex. `databricks aitools update --scope project` refreshes those skills, and adds none for Codex to a project that does not have them. ([#7990](#7990))
 * `databricks aitools auto-install enable` and `disable` now send usage telemetry when they change the setting, and the other places that ask for or change the consent to installing Databricks AI tools automatically record that too. `databricks auth login` sends that record, and the events of the automatic installation that runs after the answer, with the profile it saved, but only when it asked about installing the tools. When the configured workspace is slow or unreachable, `enable` and `disable` can take up to about 6 seconds longer. Such a login prepares the upload while it waits for the answer, so it takes up to about 3 seconds longer, or up to about 6 when the answer comes within 3 seconds. Set `DATABRICKS_CLI_DISABLE_TELEMETRY=1` to opt out. ([#8194](#8194))
 * When the automatic installation of Databricks AI tools is turned off (for example by `databricks aitools auto-install disable` or `DATABRICKS_AITOOLS_AUTO_INSTALL=false`), the CLI no longer prints its install hint for coding agents or Claude Code's plugin install line. ([#8194](#8194), [#8211](#8211))
 * `databricks aitools install` now reports a coding agent as failed, with a step to recover, when it cannot write the skill files into that agent's skills directory (for example one left owned by root by an earlier run with sudo). It used to report the agent as installed and exit with code 0; it now exits with code 1 when that agent was named with `--agents` or no other agent was set up. `databricks apps init` names such an agent with the same kind of step, and the automatic install retries when no agent got the skills. ([#7962](#7962))
 * `databricks aitools install`, `databricks aitools update` and the automatic install now see a Databricks plugin for Codex or GitHub Copilot installed with the agent's own CLI. When the agent's CLI is not on PATH they keep the plugin and add or update no skill files next to it, and `install` and `update` remove the skill files an earlier run added, so the agent no longer loads every Databricks skill twice. `install --skills-only` skips such an agent and names the agent's own command that removes the plugin. ([#7917](#7917))
 * `databricks auth login` now asks about installing Databricks AI tools with a short card that names the coding agents that get them and says how to turn automatic installs off. An empty reply asks only the card's last line again. ([#8242](#8242))
 * `databricks aitools` commands no longer fail when the latest skills release cannot be looked up: they warn and use the newest release they know, and never downgrade installed skills unless the compatibility manifest entry sets `"allow_downgrade": true` to roll back a bad release. The lookup now reads the version file the skills repository publishes on the host that serves the skill files, instead of the rate-limited GitHub API, so `DATABRICKS_CLI_GITHUB_API_URL` no longer affects it and a `DATABRICKS_SKILLS_BASE_URL` mirror must serve `main/metaplugin/version.meta.json`, and answer `HEAD` for each release's `manifest.json`, for the lookup to succeed. A compatibility manifest entry can track the latest release with `"use_latest": true`, which older CLI versions ignore, and the entry for CLI 1.23.0 and newer now does, so `databricks aitools install` and `update` install the latest skills release instead of 0.2.47. ([#8202](#8202), [#8203](#8203))
 * `databricks aitools uninstall` now removes the skill directories it copied into a single agent's skills directory when they are unmodified; before, it reported them as uninstalled but left them in place. ([#7936](#7936))
 * A global `databricks aitools uninstall` run while the automatic installation of Databricks AI tools is installing now fails before it removes anything and asks to run it again, instead of reporting success and having the installation put the tools back seconds later. An opt-out stored while an automatic installation is deciding whether to install (`databricks aitools auto-install disable`, say) now stops it. ([#7924](#7924))
 * Fix `databricks fs rm` and `fs rm -r` on UC Volumes failing with "file does not exist" or "no such directory" after a delete was retried. ([#7926](#7926))
 * Use the public Sandbox SDK for `databricks sandbox` lifecycle commands, including native SDK JSON output that requires scripts using the previous field names to migrate; preserve short IDs, readiness and terminal text, with SSH through port forwarding. `--idle-timeout 0` now disables auto-stop; use `--no-autostop=false` to reset to the 10-minute default. ([#8040](#8040))
 * Remove `sandbox register` and `sandbox ssh-key`; use OAuth-backed `sandbox ssh` or `sandbox ssh-setup` instead, without changing existing SSH keys, configuration, or server registrations. ([#8098](#8098))
 * Show migration instructions when retired `sandbox register` or `sandbox ssh-key` commands are invoked, including with their legacy flags. ([#8180](#8180))
 * `databricks ssh connect --accelerator` now accepts any serverless GPU type name, such as `GPU_1xRTX6000`, instead of only `GPU_1xA10` and `GPU_8xH100`; the workspace validates which GPU types and environment versions are available. ([#7833](#7833), [#7957](#7957))
 * `databricks ssh connect` now reuses an existing secret scope for its SSH keys only if the scope is Databricks-backed and its ACL grants MANAGE to the current user and no access to any other principal, and otherwise fails with an error that explains how to delete the scope and connect again. ([#8141](#8141))
 * `databricks ssh connect`: the SSH server now writes the client public key from the session's secret scope to `authorized_keys` in canonical form, and fails with an actionable error if the stored key is not a single SSH public key without options. ([#7994](#7994))

### AI Runtime

 * Show workspace-specific supported GPU counts in `databricks air run -h config.compute.num_accelerators`. ([#8215](#8215))
 * `databricks air cancel --all` now lists the runs it matches even with `--yes`, and its help says that `--all` includes runs started from other terminals, scripts and agents, and that runs can be cancelled by ID instead. `air get` now shows a "Cancel reason" for cancelled runs, such as "Run cancelled by user". ([#8233](#8233))
 * Clarify that the `air run` PyTorch warning checks direct dependencies and may appear when another dependency installs PyTorch. ([#8214](#8214))
 * Make `databricks air run --dry-run` say that only static and workspace validation ran, and that dependencies were not installed and code was not run. ([#8219](#8219))
 * Remove outdated Preview labels and the runtime warning from `databricks air images push`. ([#8097](#8097))
 * Print the source image size in `databricks air images push`, and after the push the compressed size and layer count from the pushed manifest, with a link to the Databricks Artifact Registry image limits. ([#7868](#7868))
 * Warn in `databricks air images push` when the source image sets a `WORKDIR` other than `/`, suggest absolute paths in commands and scripts, and link the AI Runtime `command` docs. ([#7867](#7867))
 * Accept `experiment_name` as an alias for `experiment` in `databricks air list --filter`. ([#8220](#8220))
 * `databricks air logs` with no logs to show now reports `PENDING` for a run that is waiting for compute (matching `air get`), prints the `air logs --follow` command to run when not following an active run, and for `--retry N` on a finished retry reports how that retry ended. ([#8232](#8232))
 * `databricks air run` now warns when code passes a run ID to `mlflow.start_run()` before training a Hugging Face Trainer that reports to MLflow, which fails the job with "Run ... is already active" when training begins. ([#8234](#8234))

### Bundles

 * Record deployment history by default for bundles deployed to a workspace that Databricks has enrolled. Set `experimental.deployment_history: false` to opt out. ([#7895](#7895))
 * Recover from a create request that failed after the backend applied it for more resources (Unity Catalog catalogs, schemas, volumes, external locations, registered models and secrets; Lakebase endpoints, databases, synced tables and snapshot schedules; secret scope permissions), in the direct deployment engine. ([#7910](#7910))
 * Fix the bundle auth error "the host in the profile doesn’t match the host configured in the bundle" when only one of the hosts includes the default port, such as `:443`. ([#7948](#7948))
 * Do not warn about missing required fields under an optional block that is explicitly null, such as a job's `schedule: null`. ([#7982](#7982))
 * Fix `bundle deploy` failing with "no such file or directory" when a `dynamic_version` wheel artifact has several wheels of the same package. ([#8027](#8027))
 * `bundle deploy` and `bundle destroy` no longer warn when a delete fails but a read finds the resource missing or in terminal teardown, which is the usual outcome when a delete is retried after a transient error. The message is logged at debug level. ([#8046](#8046))
 * Fix `bundle deploy` and `bundle destroy` with the direct engine sometimes failing with "Cluster ... does not exist" when a cluster in the state was already deleted. ([#8068](#8068))
 * Fix notebooks with an upper-case extension (for example `notebook_path: ./etl.R`) being reported as not found when deploying a bundle from the workspace. ([#8093](#8093))
 * Fix `bundle init` ignoring the default of, and not prompting for, a template property with a JSON schema `format` other than `warehouse_path` (an integer one printed `Validation failed` forever). Without a TTY, such a property with no default and no value from `--config-file` now fails like any other property instead of rendering as an empty string. ([#8094](#8094))
 * Don't update the unchanged permissions of a vector search endpoint, model serving endpoint or model when the resource itself is updated in place (direct engine). ([#8108](#8108))
 * Fix a crash in `bundle init` when the config file sets a `number` property, or an `integer` property declared only in `anyOf`, to null, or when a `number` property has null in its `enum`. ([#8155](#8155))
 * Fix `bundle deploy --plan` uploading the wrong wheels for `dynamic_version` artifacts with a build command when the build output matches several wheels. It now also uploads every library file the plan references, and fails before uploading anything when one of them no longer exists locally. ([#8157](#8157))
 * Fix target overrides of `mode`, `cluster_id` and `git` failing with `expected a map to index ..., found nil` when the top-level `bundle` key is empty. ([#8166](#8166))
 * Fix a crash in `bundle init` when a template schema sets a property to null, for example `"properties": {"p": null}`. It now fails with an error naming the property. ([#8168](#8168))
 * Fix target variable overrides being dropped with a warning, so the root value was used: short-form and complex-value overrides under the deprecated `environments` key, and unquoted dates under `targets`. Short-form overrides under `environments` of a variable that is not defined now fail with `variable x is not defined but is assigned a value`, as they already did under `targets`. A target override no longer panics when the variable's `type` is not a string, and a scalar `targets` value (such as `targets: false`) is reported at its location instead of failing with `failed to rewrite`. ([#8183](#8183))
 * Fix bundle commands failing with `can't find ".venv/bin/python3"` when run from a subdirectory of a bundle that sets a relative `python.venv_path`. ([#8184](#8184))
 * Fix external location updates not clearing `read_only` or `fallback` in the direct deployment engine when they are removed from the bundle configuration; a value set outside the bundle is now reset to the configuration on deploy, as the plan already showed. ([#8230](#8230))
 * Fix `bundle generate app` for an app with no source code to download (never deployed, or an empty workspace source folder): it now creates the source directory, so the generated bundle loads. ([#8244](#8244))
 * Fix `bundle deploy` and `bundle destroy` without deployment history reporting success and dropping a resource from state when the backend rejects its delete; the resource stayed in the workspace untracked. ([#7931](#7931))
 * Add the `genie_agents` resource for managing AI/BI Genie agents on the direct deployment engine. ([#7617](#7617))
 * Apply a secret scope rename that was pending when a bundle migrates from terraform state to the direct engine: the scope is recreated under the new name, which deletes the secrets stored in the old scope, as a direct deploy of the same rename does. ([#7980](#7980))
 * `bundle deploy --plan` now pulls the deployment state, so applying a saved plan from a fresh checkout deletes files removed from the bundle. Because `--plan` skips the build, synced build outputs missing from the apply checkout (for example files a `prebuild` script writes) are deleted from the workspace too. ([#7988](#7988))
 * Record deployment history for `bundle deployment bind` when deployment history is enabled. ([#7817](#7817))
 * Rename registered models in place; a model in a renamed catalog or schema keeps its versions. ([#7379](#7379))
 * `bundle run` and `pipelines run`, `stop`, `dry-run` and `test` on a never-deployed bundle now report a KEY that is not defined in config, instead of suggesting `databricks bundle deploy`. ([#7985](#7985))
 * UC secrets follow a renamed catalog or schema. ([#7381](#7381))
 * The warning shown when a bundle's root path is under `/Workspace/Shared` now links to the FAQ on moving a deployment off `/Workspace/Shared`. ([#6353](#6353))
 * `bundle summary` (text and JSON output) now resolves `${resources.*}` references from the configuration and the deployed resource ids, for example a synced table named after its catalog, and builds resource URLs from them, so `bundle open` and `pipelines open` open the right page. References to values that are not set locally (ids of resources not deployed yet, fields only the workspace has) and to sensitive fields stay as they are. Synced database table URLs now point to the table in Catalog Explorer. ([#8111](#8111))
 * Fix `bundle deploy` and `sync` deleting the remote copy of a notebook or file when the local file is an `.ipynb` with invalid JSON or cannot be read. ([#8032](#8032))
 * Warn when a bundle's `run_as` identity may lack access to deployed files, with guidance for top-level permissions and source-linked files. ([#7313](#7313))

### Dependency Updates

 * Update the Go SDK to [v0.204.0](https://github.com/databricks/databricks-sdk-go/releases/tag/v0.204.0). ([#7955](#7955))
 * Update `go.yaml.in/yaml` from v3 to [v4.0.0](https://github.com/yaml/go-yaml/releases/tag/v4.0.0). ([#7987](#7987))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues factory-generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants