Skip to content

aitools: stop auto-install from downgrading newer skills - #7888

Open
anton-107 wants to merge 4 commits into
mainfrom
aitools-auto-install-no-downgrade
Open

anton-107 wants to merge 4 commits into
mainfrom
aitools-auto-install-no-downgrade

Conversation

@anton-107

Copy link
Copy Markdown
Contributor

Changes

Automatic installation no longer downgrades skills. If the installed skills come from a newer release than the one auto-install would install, it leaves them as they are.

  • libs/aitools/installer: new UpdateOptions.NoDowngrade. When it is set and the target ref is a release tag older than the installed release, UpdateSkills returns the usual RefusedError from the downgrade check. It does this even when the ref is pinned, whether by DATABRICKS_SKILLS_REF or by the compatibility manifest. A branch or commit SHA has no release order to compare against, so a pinned branch or SHA is still installed.
  • cmd/aitools/update.go: the auto-install path, which sets keepModified, now also sets NoDowngrade. A databricks aitools update that you run yourself works as before and still installs the pinned release.
  • Auto-install already treats a RefusedError as KEPT. So in this case it prints nothing, reports the KEPT outcome and records the version, which means the next command doesn't retry.
  • Changelog fragment under .nextchanges/cli/.

Why

The compatibility manifest pins each released CLI to a skills release, and the update code counts that pin as an explicit ref. An explicit ref skipped the downgrade check. Say a user installed a newer skills release themselves, for example with DATABRICKS_SKILLS_REF=v0.4.0. When they upgraded the CLI, auto-install replaced those skills with the older release pinned for that CLI and reported it as "Updated". Auto-install runs without being asked, so it should never undo a newer install the user chose. Rolling back is still possible with an explicit databricks aitools update.

Tests

  • TestUpdateNoDowngradeRefusesAnOlderPinnedRelease: with NoDowngrade, a pinned older release is refused and the installed release stays the same. Without it, the same pinned release is installed.
  • TestUpdateNoDowngradeInstallsAPinnedBranch: with NoDowngrade, a pinned branch (main) is still installed.
  • Acceptance test acceptance/cmd/aitools/auto-install/upgrade: new scenario that installs skills v0.4.0 explicitly, then upgrades to a CLI version that the compatibility manifest pins to 0.3.0. It checks that nothing is printed, the outcome is KEPT, the installed skills are unchanged and the new version is recorded.

## Changes

Automatic installation no longer downgrades skills. If the installed skills come from a newer release than the one auto-install would install, it leaves them as they are.

- `libs/aitools/installer`: new `UpdateOptions.NoDowngrade`. When it is set and the target ref is a release tag older than the installed release, `UpdateSkills` returns the usual `RefusedError` from the downgrade check. It does this even when the ref is pinned, whether by `DATABRICKS_SKILLS_REF` or by the compatibility manifest. A branch or commit SHA has no release order to compare against, so a pinned branch or SHA is still installed.
- `cmd/aitools/update.go`: the auto-install path, which sets `keepModified`, now also sets `NoDowngrade`. A `databricks aitools update` that you run yourself works as before and still installs the pinned release.
- Auto-install already treats a `RefusedError` as `KEPT`. So in this case it prints nothing, reports the `KEPT` outcome and records the version, which means the next command doesn't retry.
- Changelog fragment under `.nextchanges/cli/`.

## Why

The compatibility manifest pins each released CLI to a skills release, and the update code counts that pin as an explicit ref. An explicit ref skipped the downgrade check. Say a user installed a newer skills release themselves, for example with `DATABRICKS_SKILLS_REF=v0.4.0`. When they upgraded the CLI, auto-install replaced those skills with the older release pinned for that CLI and reported it as "Updated". Auto-install runs without being asked, so it should never undo a newer install the user chose. Rolling back is still possible with an explicit `databricks aitools update`.

## Tests

- `TestUpdateNoDowngradeRefusesAnOlderPinnedRelease`: with `NoDowngrade`, a pinned older release is refused and the installed release stays the same. Without it, the same pinned release is installed.
- `TestUpdateNoDowngradeInstallsAPinnedBranch`: with `NoDowngrade`, a pinned branch (`main`) is still installed.
- Acceptance test `acceptance/cmd/aitools/auto-install/upgrade`: new scenario that installs skills `v0.4.0` explicitly, then upgrades to a CLI version that the compatibility manifest pins to `0.3.0`. It checks that nothing is printed, the outcome is `KEPT`, the installed skills are unchanged and the new version is recorded.

Co-authored-by: Isaac <no-reply@databricks.com>
@anton-107
anton-107 requested review from a team and lennartkats-db as code owners November 23, 2026 16:37
@github-actions github-actions Bot added the aitools AI tools (databricks aitools) related changes label Nov 23, 2026

@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 85d587b. Each finding was verified against the code.

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

This PR adds UpdateOptions.NoDowngrade and sets it on the auto-install path, so auto-install refuses a pinned release tag older than the installed skills and reports KEPT instead of rolling the skills back. The raw-skills path does what the description says. In a mixed install, though, the plugin step runs before the refusal, so a refused run has already rewritten the plugin record to the pinned version, printed a line, and is still reported as KEPT. There are also two small fixes: a test-script output sent to /dev/null, and a doc comment line that wasn't re-wrapped.

Comment thread cmd/aitools/update.go
Scope: scope,

KeepModified: f.keepModified,
NoDowngrade: f.keepModified,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nice to have] NoDowngrade only reaches the raw-skills reconcile, but updatePluginsFn(ctx, scope, ref) (line 182) runs first with the same pinned ref and no downgrade check. Take a mixed global install where Claude Code has the plugin and Cursor has raw skills from v0.4.0, with the manifest pinning this CLI to 0.3.0. Auto-install runs the plugin update, UpdateInstalledPlugins saves the record as 0.3.0 and line 195 prints it. Then UpdateSkills returns RefusedError and the run is reported as KEPT. Can the refusal be decided before the plugin step when keepModified is set (compare ref with the installed release up front), so a refused run changes nothing?

use_home pinned-home
skills_dir="${USERPROFILE:-$HOME}/.databricks/aitools/skills"
trace DATABRICKS_SKILLS_REF=v0.4.0 $CLI aitools install --skills-only --scope=global --agents=cursor
print_telemetry > /dev/null

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] .agents/rules/testing.md says to send output you don't want in the golden to LOG.<name>, not /dev/null. As written, the telemetry from the setup install is lost even under go test -v. print_telemetry > LOG.install_telemetry still clears it and keeps it out of output.txt.

Comment thread libs/aitools/installer/update.go Outdated

// NoDowngrade refuses a release older than the installed one even when
// the ref is pinned (by DATABRICKS_SKILLS_REF or the compatibility
// manifest). A pinned branch or commit SHA is still installed. Automatic updates set it: a newer release the user installed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] This line of the NoDowngrade doc comment ("A pinned branch or commit SHA is still installed. Automatic updates set it: …") is much longer than the lines around it. Please re-wrap it.

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

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Commit: b1a67e80c | Workflow run

Regression test report

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

1 tests: regression=1 unreleased=0 coverage=0 failing=0
test branch main (1ea5591) latest (v1.27.0)
TestAccept/cmd/aitools/auto-install/upgrade ✅ ❌ ❌
TestAccept/cmd/aitools/auto-install/upgrade: branch ✅ | main (1ea5591) ❌ | latest (v1.27.0) ❌

main (1ea5591):

acceptance_test.go:1270: Substituted DATABRICKS_CLI_GITHUB_API_URL "$DATABRICKS_HOST" -> "http://127.0.0.1:43553" ("[DATABRICKS_HOST]")
    acceptance_test.go:1270: Substituted DATABRICKS_SKILLS_BASE_URL "$DATABRICKS_HOST" -> "http://127.0.0.1:43553" ("[DATABRICKS_HOST]")
    acceptance_test.go:1402: Diff:
        --- cmd/aitools/auto-install/upgrade/output.txt
        +++ /tmp/TestAcceptcmdaitoolsauto-installupgrade3602102792/002/output.txt
        @@ -74,16 +74,18 @@
         === upgrade to 1.33.0 pinned to 0.3.0 over an explicit 0.4.0 install: no downgrade, nothing printed, not retried
         
         >>> DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.33.0 [CLI] jobs list
        +Updated Databricks AI tools for Cursor. Disable: databricks aitools auto-install disable
         
         >>> print_telemetry
        -{"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"KEPT","holdout_arm":"TREATMENT","interactive":false}}
        +{"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"INSTALLED","holdout_arm":"TREATMENT","interactive":false}}
         
         >>> cursor_skills
        +databricks-dropped
         databricks-edited
         databricks-kept
         
         >>> skill_file databricks-kept
        -kept 2.0.0
        +kept 1.0.0
         
         >>> auto_install_state
         {
        
FAIL

latest (v1.27.0):

acceptance_test.go:1270: Substituted DATABRICKS_CLI_GITHUB_API_URL "$DATABRICKS_HOST" -> "http://127.0.0.1:40559" ("[DATABRICKS_HOST]")
    acceptance_test.go:1270: Substituted DATABRICKS_SKILLS_BASE_URL "$DATABRICKS_HOST" -> "http://127.0.0.1:40559" ("[DATABRICKS_HOST]")
    acceptance_test.go:1402: Diff:
        --- cmd/aitools/auto-install/upgrade/output.txt
        +++ /tmp/TestAcceptcmdaitoolsauto-installupgrade233953583/002/output.txt
        @@ -74,16 +74,18 @@
         === upgrade to 1.33.0 pinned to 0.3.0 over an explicit 0.4.0 install: no downgrade, nothing printed, not retried
         
         >>> DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION=1.33.0 [CLI] jobs list
        +Updated Databricks AI tools for Cursor. Disable: databricks aitools auto-install disable
         
         >>> print_telemetry
        -{"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"KEPT","holdout_arm":"TREATMENT","interactive":false}}
        +{"command":"jobs_list","exit_code":0,"aitools_auto_install_event":{"outcome":"INSTALLED","holdout_arm":"TREATMENT","interactive":false}}
         
         >>> cursor_skills
        +databricks-dropped
         databricks-edited
         databricks-kept
         
         >>> skill_file databricks-kept
        -kept 2.0.0
        +kept 1.0.0
         
         >>> auto_install_state
         {
        
FAIL

@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: b1a67e8

Run: 45260214567

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 272 20 16:54
💚​ aws-windows-latest-4core-16gb 1 274 18 12:03
💚​ azure linux-2core-8gb 1 271 20 13:35
💚​ azure-windows-latest-4core-16gb 1 273 18 12:28
💚​ gcp linux-2core-8gb 1 272 20 16:56
💚​ gcp-windows-latest-4core-16gb 1 274 18 11:01
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 48 slowest tests (at least 2 minutes):
duration env testname
7:53 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
4:35 aws-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsDelete
4:17 azure-windows-latest-4core-16gb TestImportDirWithOverwriteFlag
4:08 aws linux-2core-8gb TestSyncIncrementalFileSync
4:04 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
4:02 azure-windows-latest-4core-16gb TestAccept
3:59 gcp-windows-latest-4core-16gb TestImportDirWithOverwriteFlag
3:56 gcp linux-2core-8gb TestAccept
3:46 gcp-windows-latest-4core-16gb TestSyncFullFileSync
3:44 gcp-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files
3:44 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsDelete
3:40 gcp-windows-latest-4core-16gb TestAccept
3:35 aws-windows-latest-4core-16gb TestAccept
3:35 aws-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files
3:34 aws linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
3:23 aws linux-2core-8gb TestAccept
3:22 gcp linux-2core-8gb TestImportDirDoesNotOverwrite
3:19 azure linux-2core-8gb TestAccept
3:16 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
3:11 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsStat
3:10 azure linux-2core-8gb TestImportDirWithOverwriteFlag
3:00 azure linux-2core-8gb TestExportDir
2:52 azure-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files
2:52 azure linux-2core-8gb TestFilerReadWrite/workspace_files_extensions
2:50 aws-windows-latest-4core-16gb TestFilerWorkspaceNotebook/scalaJupyterNb.ipynb
2:45 gcp linux-2core-8gb TestSyncIncrementalFileSync
2:42 gcp linux-2core-8gb TestFilerWorkspaceNotebook/rNb.r
2:41 aws-windows-latest-4core-16gb TestExportDir
2:31 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsRead
2:31 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
2:30 aws-windows-latest-4core-16gb TestImportDirWithOverwriteFlag
2:29 gcp linux-2core-8gb TestFilerRecursiveDelete/workspace_files
2:28 gcp linux-2core-8gb TestImportDir
2:28 aws linux-2core-8gb TestFilerRecursiveDelete/workspace_files
2:24 azure-windows-latest-4core-16gb TestFilerReadDir/workspace_files_extensions
2:24 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
2:24 azure-windows-latest-4core-16gb TestWorkpaceExportPrintsContents
2:22 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsRead
2:17 aws linux-2core-8gb TestExportDir
2:16 aws-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files_extensions
2:16 aws linux-2core-8gb TestExport
2:15 gcp-windows-latest-4core-16gb TestFilerReadDir/workspace_files
2:10 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsDelete
2:07 gcp linux-2core-8gb TestImportDirWithOverwriteFlag
2:07 gcp linux-2core-8gb TestFilerReadWrite/workspace_files_extensions
2:06 aws-windows-latest-4core-16gb TestImportDir
2:03 aws-windows-latest-4core-16gb TestFilerReadWrite/workspace_files_extensions
2:00 azure-windows-latest-4core-16gb TestFilerReadDir/workspace_files

@simonfaltum simonfaltum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 Automated review from simonfaltum's review agent (pr-review skill) at 046dac1. Each finding was verified against the code; simonfaltum may follow up.

No blocking issues found, approving. 6 non-blocking comment(s) and 2 question(s) below.

This PR makes auto-install keep skills from a newer release instead of installing the older release the CLI is pinned to. It does this through a new UpdateOptions.NoDowngrade, which only auto-install sets. The single-agent raw-skills path works as described, the unit and acceptance tests catch a regression, and CI is green. The open points are in mixed installs: plugin updates are hidden behind KEPT, and a plugin install or a selective install from a newer release blocks the raw skills from updating. There are also a few nits and a question on whether a compatibility pin should still be able to roll back a release that auto-install installed.

Questions

  1. Auto-install now keeps any installed release that is newer than this CLI's pin, but the install state doesn't record how that release got there. Say a skills release turns out to be broken or incompatible, and the compatibility manifest is edited to pin back to an earlier one (the remote control that GetSkillsRef and internal/build/README.md describe). Users who already auto-installed the bad release keep it on their next CLI upgrade, and KEPT settles that version, so only a manual databricks aitools update rolls them back. Is that trade-off intended? Options: record in the state when a release came from an explicit DATABRICKS_SKILLS_REF and refuse only in that case, or keep the current behavior and document that a pin no longer rolls back skills that auto-install installed. (non-blocking)
  2. NoDowngrade is always set from keepModified, which now drives four auto-install behaviors: keeping modified files, skipping the plugin migration, skipping the legacy cleanup, and refusing downgrades. checkSkillsDowngrade's explicit parameter now really means "allow a downgrade". Would renaming them (for example keepModified → auto, explicit → allowDowngrade) make NoDowngrade: f.keepModified read less like a copy-paste slip, or do you prefer the current names? (non-blocking)

Agreeing with existing threads

  • [nice to have] A refused auto-install still runs the plugin updates, then reports KEPT: #7888 (comment)
  • [nit] NoDowngrade doc comment not re-wrapped: #7888 (comment)
  • [nit] Setup telemetry sent to /dev/null instead of a LOG file: #7888 (comment)

Comment thread libs/aitools/installer/update.go Resolved
Comment thread libs/aitools/installer/update.go Resolved
Comment thread libs/aitools/installer/update.go Resolved
Comment thread libs/aitools/installer/update.go Resolved
Comment thread libs/aitools/installer/update_test.go Resolved
anton-107 and others added 2 commits November 23, 2026 20:25
Refuse an older pinned release before fetching its manifest, with a
message that names the kept release and how to install the pinned one.
Report the plugins an update changed even when it then keeps the raw
skills. Give the acceptance gate helper a skills argument, and document
the guard in internal/build/README.md and planTools.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@anton-107
anton-107 requested a review from a team as a code owner November 23, 2026 20:30

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aitools AI tools (databricks aitools) related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants