Skip to content

aitools: never prompt a coding agent caller in update and uninstall - #7873

Open
anton-107 wants to merge 2 commits into
mainfrom
aitools-update-uninstall-no-agent-prompts
Open

anton-107 wants to merge 2 commits into
mainfrom
aitools-update-uninstall-no-agent-prompts

Conversation

@anton-107

Copy link
Copy Markdown
Contributor

Changes

databricks aitools update and databricks aitools uninstall now treat a coding agent caller as non-interactive, as aitools install already does. An agent is detected through the SDK's agent environment variables (for example CLAUDECODE or CODEX_CI).

 update / uninstall, skills in both global and project scopes, no --scope
-  if !cmdio.IsPromptSupported(ctx)       -> --scope error, else scope picker
+  if !promptsSupported(ctx)              -> note on a terminal, then --scope error
+                                            else scope picker

 uninstall, something to remove
-  if cmdio.IsPromptSupported(ctx)        -> "Proceed?" confirm
+  if promptsSupported(ctx)               -> "Proceed?" confirm
+  else                                   -> note on a terminal, then proceed
  • installPromptsSupported is renamed to promptsSupported, since it now covers install, update, uninstall and mcp add / mcp remove. Its behavior is unchanged: prompts are supported only on a terminal and only when no coding agent is detected.
  • When a prompt is skipped on a terminal because an agent was detected, the command prints No prompts shown because a coding agent (<agent>) was detected. A person working in a shell that inherited an agent env var then knows why the expected prompt is missing. Without a terminal nothing is printed. Install's existing note now starts with the same sentence.
  • The command funnel's interactive field for update and uninstall now comes from promptsSupported, so it reports false for agent callers. That matches what install already reports.

Why

Agents often run commands in a pseudo-terminal (Cursor, or Copilot in the VS Code terminal). In a pseudo-terminal stdin looks like a TTY, but nobody is there to answer a TUI prompt. Install already handles this case. Update and uninstall still showed the scope picker and the "Proceed?" confirm, so an agent run could hang. With this change an agent gets the same behavior as a run without a terminal: when skills are in both scopes it fails fast and asks for --scope, and uninstall goes ahead without confirming.

Tests

  • New unit tests in cmd/aitools/scope_test.go set up an agent caller on a prompt-capable terminal with skills in both scopes. They check that the update and uninstall scope pickers are never shown, that the --scope error comes back with the invalid-flags category, and that the note is printed.
  • New TestUninstallAgentCallerIsNotAskedToConfirm in cmd/aitools/funnel_test.go: an agent caller on a terminal uninstalls without seeing "Proceed?", the note is printed, and the funnel records the run as non-interactive.
  • The existing interactive scope tests now clear agent env vars, so their result no longer depends on the shell they run in.
  • Changelog fragment added under .nextchanges/cli/.

## Changes

`databricks aitools update` and `databricks aitools uninstall` now treat a coding agent caller as non-interactive, as `aitools install` already does. An agent is detected through the SDK's agent environment variables (for example `CLAUDECODE` or `CODEX_CI`).

```diff
 update / uninstall, skills in both global and project scopes, no --scope
-  if !cmdio.IsPromptSupported(ctx)       -> --scope error, else scope picker
+  if !promptsSupported(ctx)              -> note on a terminal, then --scope error
+                                            else scope picker

 uninstall, something to remove
-  if cmdio.IsPromptSupported(ctx)        -> "Proceed?" confirm
+  if promptsSupported(ctx)               -> "Proceed?" confirm
+  else                                   -> note on a terminal, then proceed
```

- `installPromptsSupported` is renamed to `promptsSupported`, since it now covers install, update, uninstall and `mcp add` / `mcp remove`. Its behavior is unchanged: prompts are supported only on a terminal and only when no coding agent is detected.
- When a prompt is skipped on a terminal because an agent was detected, the command prints `No prompts shown because a coding agent (<agent>) was detected.` A person working in a shell that inherited an agent env var then knows why the expected prompt is missing. Without a terminal nothing is printed. Install's existing note now starts with the same sentence.
- The command funnel's `interactive` field for update and uninstall now comes from `promptsSupported`, so it reports `false` for agent callers. That matches what install already reports.

## Why

Agents often run commands in a pseudo-terminal (Cursor, or Copilot in the VS Code terminal). In a pseudo-terminal stdin looks like a TTY, but nobody is there to answer a TUI prompt. Install already handles this case. Update and uninstall still showed the scope picker and the "Proceed?" confirm, so an agent run could hang. With this change an agent gets the same behavior as a run without a terminal: when skills are in both scopes it fails fast and asks for `--scope`, and uninstall goes ahead without confirming.

## Tests

- New unit tests in `cmd/aitools/scope_test.go` set up an agent caller on a prompt-capable terminal with skills in both scopes. They check that the update and uninstall scope pickers are never shown, that the `--scope` error comes back with the invalid-flags category, and that the note is printed.
- New `TestUninstallAgentCallerIsNotAskedToConfirm` in `cmd/aitools/funnel_test.go`: an agent caller on a terminal uninstalls without seeing "Proceed?", the note is printed, and the funnel records the run as non-interactive.
- The existing interactive scope tests now clear agent env vars, so their result no longer depends on the shell they run in.
- Changelog fragment added under `.nextchanges/cli/`.

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

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.

1 participant