Skip to content

Add and remove agent MCP entries through agent CLIs, except Codex - #7595

Merged
simonfaltum merged 1 commit into
mainfrom
aitools-mcp/08b-agent-clis
Nov 19, 2026
Merged

simonfaltum merged 1 commit into
mainfrom
aitools-mcp/08b-agent-clis

Conversation

@simonfaltum

@simonfaltum simonfaltum commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

This pull request is part of the stack that adds the hidden databricks aitools mcp command group; its parent is #7553. aitools mcp add and remove now change the Claude Code, Gemini CLI and Copilot CLI configs through each agent's own MCP command, when that CLI is on PATH. Codex CLI configs are always written directly.

Changes

  • A new entry runs the agent's add command when its config file exists: claude mcp add-json --scope user, gemini mcp add --scope user, or copilot mcp add --tools *. A config file that does not exist yet is written directly, with mode 0600, since the agent's CLI would create it with its own permissions. Afterwards the config file holds the entry asked for, whatever the exit status: a differing entry is replaced, and a missing one is added directly. An entry that already exists is updated by the direct writer.
  • remove runs the CLI's remove for an entry we wrote, when the agent reads that file now. A CLI failure, or an entry left behind, falls back to the direct writer.
  • Symlinked configs, names that start with -, and Codex always use the direct writer.
  • The CLI runs in an empty directory with a 30-second timeout, in the foreground process group so Ctrl-C reaches it.
  • For an agent that locks its config (Claude Code, see Add MCP server config writers for coding agents #7539), only the direct writer takes the lock. It is never held while the agent's CLI runs, since that CLI takes the same lock.

Why

An agent's own CLI writes its config with its own locking and layout, and follows the agent when its file format changes. Codex is the exception. With Codex CLI 0.167.1, codex mcp add and codex mcp remove rewrote every [mcp_servers.*] table of an 11-server config: they dropped enabled = true keys, collapsed multi-line arrays, turned 10 into 10.0, and converted CRLF to LF.

Decisions to review

  • The file decides, not the exit status. Cost: a CLI that writes another file keeps its entry there, and ours is also added to the agent's file.
  • A differing entry is replaced, not refused. Cost: our launch keys win over the CLI's choices.
  • Existing entries use the direct writer, since the add commands replace whole entries. Cost: two paths write one file.
  • Codex always uses the direct writer. Cost: comments inside a Databricks server's own tables are lost on either path.
  • A hung CLI costs the 30-second timeout for each server.
  • On Windows, a .cmd shim gets only arguments without spaces, double quotes or cmd.exe special characters. Other arguments use the direct writer.

Tests

  • libs/aitools/agents covers argv per agent, including a Windows path with spaces. agentconfig/cli_test.go covers each outcome of an add, TestAgentCLIRunsWithoutTheLock the lock, symlinks, missing config files, dash names and the timeout, and the Codex direct writer. libs/process covers WithoutEnv, which ignores case on Windows.
  • acceptance/cmd/aitools/mcp/add-remove-agent-clis covers each agent's argv and the files it wrote.
  • ./task test-exp-aitools passes with BROWSER unset and with BROWSER=none.
  • Not tested: the Copilot and Gemini binaries, which are not installed here, so their argv follows their docs and source. Windows runs, which CI covers. -inprocess mode, which already fails on the base for these tests.

This pull request and its description were written by Isaac.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Commit: 03d0647a9 | 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 (de394ed) latest (v1.27.0)
TestAccept/cmd/aitools/mcp/add-remove-agent-clis ✅ ❌ ❌
TestAccept/cmd/aitools/mcp/add-remove-agent-clis: branch ✅ | main (de394ed) ❌ | latest (v1.27.0) ❌

main (de394ed):

acceptance_test.go:1400: Diff:
        --- cmd/aitools/mcp/add-remove-agent-clis/output.txt
        +++ /tmp/TestAcceptcmdaitoolsmcpadd-remove-agent-clis935995320/002/output.txt
        @@ -67,280 +67,6 @@
         === the argv each agent CLI ran for add
         
         >>> cat agent-calls.log
        -claude
        -	mcp
        -	add-json
        -	--scope
        -	user
        -	genie_one_mcp-logfood
        -	{"args":["aitools","mcp","serve","--profile","logfood","--service","system.ai.genie_one_mcp","--agent","claude-code"],"command":"[CLI]","env":{"DATABRICKS_CONFIG_FILE":"[TEST_TMP_DIR]/.databrickscfg"},"type":"stdio"}
        -gemini
        -	mcp
        -	add
        -	--scope
        -	user
        -	-e
        -	DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg
        -	genie_one_mcp-logfood
        -	[CLI]
        -	--
        -	aitools
        -	mcp
        -	serve
        -	--profile
        -	logfood
        -	--service
        -	system.ai.genie_one_mcp
        -	--agent
        -	gemini
        -copilot
        -	mcp
        -	add
        -	genie_one_mcp-logfood
        -	--tools
        -	*
        -	--env
        -	DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg
        -	--
        -	[CLI]
        -	aitools
        -	mcp
        -	serve
        -	--profile
        -	logfood
        -	--service
        -	system.ai.genie_one_mcp
        -	--agent
        -	copilot
        -claude
        -	mcp
        -	add-json
        -	--scope
        -	user
        -	github-logfood
        -	{"args":["aitools","mcp","serve","--profile","logfood","--service","system.ai.github","--agent","claude-code"],"command":"[CLI]","env":{"DATABRICKS_CONFIG_FILE":"[TEST_TMP_DIR]/.databrickscfg"},"type":"stdio"}
        -gemini
        -	mcp
        -	add
        -	--scope
        -	user
        -	-e
        -	DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg
        -	github-logfood
        -	[CLI]
        -	--
        -	aitools
        -	mcp
        -	serve
        -	--profile
        -	logfood
        -	--service
        -	system.ai.github
        -	--agent
        -	gemini
        -copilot
        -	mcp
        -	add
        -	github-logfood
        -	--tools
        -	*
        -	--env
        -	DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg
        -	--
        -	[CLI]
        -	aitools
        -	mcp
        -	serve
        -	--profile
        -	logfood
        -	--service
        -	system.ai.github
        -	--agent
        -	copilot
        +cat: agent-calls.log: No such file or directory
         
        -=== the config each agent CLI wrote
        -
        ->>> cat home/.claude.json
        -{
        -  "mcpServers": {
        -    "genie_one_mcp-logfood": {
        -      "args": [
        -        "aitools",
        -        "mcp",
        -        "serve",
        -        "--profile",
        -        "logfood",
        -        "--service",
        -        "system.ai.genie_one_mcp",
        -        "--agent",
        -        "claude-code"
        -      ],
        -      "command": "[CLI]",
        -      "env": {
        -        "DATABRICKS_CONFIG_FILE": "[TEST_TMP_DIR]/.databrickscfg"
        -      },
        -      "type": "stdio"
        -    },
        -    "github-logfood": {
        -      "args": [
        -        "aitools",
        -        "mcp",
        -        "serve",
        -        "--profile",
        -        "logfood",
        -        "--service",
        -        "system.ai.github",
        -        "--agent",
        -        "claude-code"
        -      ],
        -      "command": "[CLI]",
        -      "env": {
        -        "DATABRICKS_CONFIG_FILE": "[TEST_TMP_DIR]/.databrickscfg"
        -      },
        -      "type": "stdio"
        -    }
        -  }
        -}
        -
        ->>> cat home/.codex/config.toml
        -[mcp_servers.genie_one_mcp-logfood]
        -args = ["aitools", "mcp", "serve", "--profile", "logfood", "--service", "system.ai.genie_one_mcp", "--agent", "codex"]
        -command = "[CLI]"
        -[mcp_servers.genie_one_mcp-logfood.env]
        -DATABRICKS_CONFIG_FILE = "[TEST_TMP_DIR]/.databrickscfg"
        -
        -[mcp_servers.github-logfood]
        -args = ["aitools", "mcp", "serve", "--profile", "logfood", "--service", "system.ai.github", "--agent", "codex"]
        -command = "[CLI]"
        -[mcp_servers.github-logfood.env]
        -DATABRICKS_CONFIG_FILE = "[TEST_TMP_DIR]/.databrickscfg"
        -
        ->>> cat home/.gemini/settings.json
        -{
        -  "mcpServers": {
        -    "genie_one_mcp-logfood": {
        -      "args": [
        -        "aitools",
        -        "mcp",
        -        "serve",
        -        "--profile",
        -        "logfood",
        -        "--service",
        -        "system.ai.genie_one_mcp",
        -        "--agent",
        -        "gemini"
        -      ],
        -      "command": "[CLI]",
        -      "env": {
        -        "DATABRICKS_CONFIG_FILE": "[TEST_TMP_DIR]/.databrickscfg"
        -      }
        -    },
        -    "github-logfood": {
        -      "args": [
        -        "aitools",
        -        "mcp",
        -        "serve",
        -        "--profile",
        -        "logfood",
        -        "--service",
        -        "system.ai.github",
        -        "--agent",
        -        "gemini"
        -      ],
        -      "command": "[CLI]",
        -      "env": {
        -        "DATABRICKS_CONFIG_FILE": "[TEST_TMP_DIR]/.databrickscfg"
        -      }
        -    }
        -  }
        -}
        -
        ->>> cat home/.copilot/mcp-config.json
        -{
        -  "mcpServers": {
        -    "genie_one_mcp-logfood": {
... (116 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)

latest (v1.27.0):

acceptance_test.go:1400: Diff:
        --- cmd/aitools/mcp/add-remove-agent-clis/output.txt
        +++ /tmp/TestAcceptcmdaitoolsmcpadd-remove-agent-clis77673004/002/output.txt
        @@ -2,345 +2,29 @@
         === add goes through the CLI of claude, gemini and copilot; codex is written directly
         
         >>> [CLI] aitools mcp add --profile logfood --names system.ai.genie_one_mcp,system.ai.github --agents claude-code,codex,gemini,copilot --output json
        -{
        -  "profile": "logfood",
        -  "host": "[DATABRICKS_URL]",
        -  "scope": "global",
        -  "servers": [
        -    {
        -      "name": "genie_one_mcp-logfood",
        -      "service": "system.ai.genie_one_mcp",
        -      "sign_in_required": false,
        -      "agents": [
        -        {
        -          "name": "claude-code",
        -          "status": "installed",
        -          "path": "[TEST_TMP_DIR]/home/.claude.json"
        -        },
        -        {
        -          "name": "codex",
        -          "status": "installed",
        -          "path": "[TEST_TMP_DIR]/home/.codex/config.toml"
        -        },
        -        {
        -          "name": "gemini",
        -          "status": "installed",
        -          "path": "[TEST_TMP_DIR]/home/.gemini/settings.json"
        -        },
        -        {
        -          "name": "copilot",
        -          "status": "installed",
        -          "path": "[TEST_TMP_DIR]/home/.copilot/mcp-config.json"
        -        }
        -      ]
        -    },
        -    {
        -      "name": "github-logfood",
        -      "service": "system.ai.github",
        -      "sign_in_required": true,
        -      "agents": [
        -        {
        -          "name": "claude-code",
        -          "status": "installed",
        -          "path": "[TEST_TMP_DIR]/home/.claude.json"
        -        },
        -        {
        -          "name": "codex",
        -          "status": "installed",
        -          "path": "[TEST_TMP_DIR]/home/.codex/config.toml"
        -        },
        -        {
        -          "name": "gemini",
        -          "status": "installed",
        -          "path": "[TEST_TMP_DIR]/home/.gemini/settings.json"
        -        },
        -        {
        -          "name": "copilot",
        -          "status": "installed",
        -          "path": "[TEST_TMP_DIR]/home/.copilot/mcp-config.json"
        -        }
        -      ]
        -    }
        -  ]
        -}
        +Error: unknown flag: --names
         
        -=== the argv each agent CLI ran for add
        +Usage:
        +  databricks aitools [command]
         
        ->>> cat agent-calls.log
        -claude
        -	mcp
        -	add-json
        -	--scope
        -	user
        -	genie_one_mcp-logfood
        -	{"args":["aitools","mcp","serve","--profile","logfood","--service","system.ai.genie_one_mcp","--agent","claude-code"],"command":"[CLI]","env":{"DATABRICKS_CONFIG_FILE":"[TEST_TMP_DIR]/.databrickscfg"},"type":"stdio"}
        -gemini
        -	mcp
        -	add
        -	--scope
        -	user
        -	-e
        -	DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg
        -	genie_one_mcp-logfood
        -	[CLI]
        -	--
        -	aitools
        -	mcp
        -	serve
        -	--profile
        -	logfood
        -	--service
        -	system.ai.genie_one_mcp
        -	--agent
        -	gemini
        -copilot
        -	mcp
        -	add
        -	genie_one_mcp-logfood
        -	--tools
        -	*
        -	--env
        -	DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg
        -	--
        -	[CLI]
        -	aitools
        -	mcp
        -	serve
        -	--profile
        -	logfood
        -	--service
        -	system.ai.genie_one_mcp
        -	--agent
        -	copilot
        -claude
        -	mcp
        -	add-json
        -	--scope
        -	user
        -	github-logfood
        -	{"args":["aitools","mcp","serve","--profile","logfood","--service","system.ai.github","--agent","claude-code"],"command":"[CLI]","env":{"DATABRICKS_CONFIG_FILE":"[TEST_TMP_DIR]/.databrickscfg"},"type":"stdio"}
        -gemini
        -	mcp
        -	add
        -	--scope
        -	user
        -	-e
        -	DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg
        -	github-logfood
        -	[CLI]
        -	--
        -	aitools
        -	mcp
        -	serve
        -	--profile
        -	logfood
        -	--service
        -	system.ai.github
        -	--agent
        -	gemini
        -copilot
        -	mcp
        -	add
        -	github-logfood
        -	--tools
        -	*
        -	--env
        -	DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg
        -	--
        -	[CLI]
        -	aitools
        -	mcp
        -	serve
        -	--profile
        -	logfood
        -	--service
        -	system.ai.github
        -	--agent
        -	copilot
        +Available Commands:
        +  auto-install Turn the automatic installation of Databricks AI tools on or off
        +  install      Install Databricks skills and plugins for coding agents
        +  list         List installed skills and plugins
        +  uninstall    Uninstall Databricks skills and plugins
        +  update       Update installed skills and plugins
        +  version      Show installed skills and plugins version
         
        -=== the config each agent CLI wrote
        +Flags:
        +  -h, --help[=true|false]   help for aitools
         
        ->>> cat home/.claude.json
        -{
        -  "mcpServers": {
        -    "genie_one_mcp-logfood": {
        -      "args": [
        -        "aitools",
        -        "mcp",
        -        "serve",
        -        "--profile",
        -        "logfood",
        -        "--service",
        -        "system.ai.genie_one_mcp",
        -        "--agent",
        -        "claude-code"
        -      ],
        -      "command": "[CLI]",
        -      "env": {
        -        "DATABRICKS_CONFIG_FILE": "[TEST_TMP_DIR]/.databrickscfg"
        -      },
        -      "type": "stdio"
        -    },
        -    "github-logfood": {
        -      "args": [
... (198 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)

@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 03d0647

Run: 44566191854

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 272 20 16:48
💚​ aws-windows-latest-4core-16gb 1 274 18 11:48
💚​ azure linux-2core-8gb 1 271 20 14:35
💚​ azure-windows-latest-4core-16gb 1 273 18 11:50
💚​ gcp linux-2core-8gb 1 272 20 16:05
💚​ gcp-windows-latest-4core-16gb 1 274 18 9:35
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 40 slowest tests (at least 2 minutes):
duration env testname
5:51 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
5:00 aws linux-2core-8gb TestExportDir
4:20 aws-windows-latest-4core-16gb TestExportDir
4:05 gcp-windows-latest-4core-16gb TestSyncIncrementalFileSync
4:00 aws linux-2core-8gb TestFilerRecursiveDelete/workspace_files
3:57 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsStat
3:52 azure-windows-latest-4core-16gb TestAccept
3:49 gcp-windows-latest-4core-16gb TestAccept
3:31 aws-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsDelete
3:27 gcp linux-2core-8gb TestImportDirDoesNotOverwrite
3:26 aws linux-2core-8gb TestFilerWorkspaceNotebook/rNb.r
3:26 aws linux-2core-8gb TestImportDirWithOverwriteFlag
3:21 aws-windows-latest-4core-16gb TestAccept
3:11 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
3:07 aws linux-2core-8gb TestFilerRecursiveDelete/workspace_files_extensions
2:59 azure linux-2core-8gb TestFilerRecursiveDelete/workspace_files
2:58 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsStat
2:58 aws-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
2:57 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
2:52 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsDelete
2:50 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsDelete
2:47 gcp linux-2core-8gb TestImportDirWithOverwriteFlag
2:39 azure-windows-latest-4core-16gb TestImportDirWithOverwriteFlag
2:38 aws linux-2core-8gb TestSyncIncrementalFileSync
2:37 azure-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files_extensions
2:36 azure linux-2core-8gb TestExportDirWithOverwriteFlag
2:31 gcp-windows-latest-4core-16gb TestFilerWorkspaceNotebook/scalaNb.scala
2:27 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
2:25 azure-windows-latest-4core-16gb TestExportDir
2:24 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsRead
2:21 gcp-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files_extensions
2:19 gcp-windows-latest-4core-16gb TestFilerRecursiveDelete/workspace_files
2:18 gcp linux-2core-8gb TestFilerWorkspaceNotebook/sqlJupyterNotebook.ipynb
2:16 azure linux-2core-8gb TestFilerWorkspaceNotebook/sqlNb.sql
2:13 gcp-windows-latest-4core-16gb TestExportDir
2:09 aws-windows-latest-4core-16gb TestFilerReadWrite/workspace_files_extensions
2:07 azure-windows-latest-4core-16gb TestImportDirDoesNotOverwrite
2:02 aws linux-2core-8gb TestFilerWorkspaceNotebook/sqlJupyterNotebook.ipynb
2:01 aws linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
2:01 aws linux-2core-8gb TestImportDir

@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from 7122f6a to 93e536b Compare November 13, 2026 09:48
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from 1abf7d0 to 6b41591 Compare November 13, 2026 15:05
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from 3ed1398 to 8cca61b Compare November 13, 2026 15:06
@pietern pietern added the aitools AI tools (databricks aitools) related changes label Nov 16, 2026
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from 8cca61b to 50318b1 Compare November 16, 2026 12:47
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from 6b41591 to 48208cf Compare November 16, 2026 12:47
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from 50318b1 to f46d6a0 Compare November 16, 2026 13:19
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from 48208cf to 922dad8 Compare November 16, 2026 13:19
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from f46d6a0 to d049189 Compare November 16, 2026 13:32
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch 2 times, most recently from 7e7f6c7 to 865e2f5 Compare November 16, 2026 14:49
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch 2 times, most recently from 6955d59 to 84abb41 Compare November 16, 2026 15:14
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from 0952a73 to 1f42a46 Compare November 16, 2026 15:53
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch 2 times, most recently from 190f3cb to fdc9d71 Compare November 17, 2026 10:52
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from 1f42a46 to d94c24d Compare November 17, 2026 10:52
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from fdc9d71 to fc23170 Compare November 17, 2026 11:21
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from 0fb469a to 8237caa Compare November 17, 2026 12:02
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from fc23170 to 0d214eb Compare November 17, 2026 12:02
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from 8237caa to 32552ca Compare November 17, 2026 12:36
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from 0d214eb to 2a05c5e Compare November 17, 2026 12:36
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from 32552ca to bb76f49 Compare November 17, 2026 15:11
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from 2a05c5e to 1c32739 Compare November 17, 2026 15:11
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from aa07488 to c22861c Compare November 17, 2026 18:54
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from a9d81d9 to f9ba127 Compare November 17, 2026 18:54
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from c22861c to 55915b3 Compare November 17, 2026 18:57
@simonfaltum simonfaltum changed the title Add and remove agent MCP entries through the agent's own CLI Add and remove agent MCP entries through agent CLIs, except Codex Nov 17, 2026
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from 10594fe to b4386f3 Compare November 17, 2026 19:58
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch 2 times, most recently from 8c7ea9b to 160e62d Compare November 17, 2026 22:17
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from b4386f3 to 114dcaf Compare November 17, 2026 22:17
@simonfaltum
simonfaltum marked this pull request as ready for review November 18, 2026 16:21
@simonfaltum
simonfaltum requested review from a team and lennartkats-db as code owners November 18, 2026 16:21

func TestMain(m *testing.M) {
// No agent CLI is on PATH unless a test puts one there, so no test runs a host CLI.
agents.LookPath = func(string) (string, error) { return "", exec.ErrNotFound }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

TestMain calls m.Run() but doesn't pass its return value to os.Exit. Without os.Exit(m.Run()), test failures in this package exit 0 and CI reports PASS. Should be os.Exit(m.Run()).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since Go 1.15, when TestMain returns, the test binary passes the result of m.Run() to os.Exit itself, so a failing test still exits non-zero. libs/localenv/main_test.go uses the same form. No change.

// https://learn.chatgpt.com/docs/config-file/config-advanced and
// https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-config-dir-reference.
const (
claudeHomeEnv = "CLAUDE_CONFIG_DIR"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new claudeHomeEnv and geminiHomeEnv constants are used in claudeConfigDir, claudeMCPPath, geminiConfigDir, the MCP spec entries, and mcpHomeEnvs, but mcpHomeDefaults at line 121 still has the string literals "CLAUDE_CONFIG_DIR" and "GEMINI_CLI_HOME". Can you update the map to use the constants, as it already does for codexHomeEnv and copilotHomeEnv?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in 686894a.

@anton-107 anton-107 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.

Approving. I found nothing that blocks the merge.

Merge risk: easy to undo. aitools mcp is still hidden. Every write through an agent's CLI is checked by reading the file back, and the direct writer fixes any mismatch. Each agent's file stays in that agent's own valid format. Reverting this PR just sends every agent back to the direct writer.

What I checked

  • ./cmd/aitools/..., ./libs/aitools/... and ./libs/process/... unit tests, plus TestAccept/cmd/aitools, all pass on 686894a.
  • I ran the real Claude Code CLI (2.1.325) against a throwaway HOME. claude mcp add-json --scope user writes the entry as expected. It also works with CLAUDECODE=1 set, which is the likely real case: databricks aitools mcp add run from inside a Claude Code session.
  • Gemini's argv matches upstream packages/cli/src/commands/mcp/add.ts. There, -e is nargs: 1, populate-- appends the arguments after --, and env values are split with split('=') keeping only two parts. So sending values that contain = to the direct writer is the right call.
  • Previous round: both bot comments were handled correctly. The constants were fixed in 686894a, and os.Exit(m.Run()) hasn't been needed since Go 1.15.

Non-blocking notes

  • Running claude also applies Claude's own startup migrations to .claude.json. On a bare {} file it added machineID, userID, migrationVersion and similar keys. That's harmless for real users, whose file already has them, but it does go beyond writing the one entry.
  • buildFakeAgentCLIs now runs on every non-in-process acceptance run, even when no cmd/aitools test is selected. It runs in parallel so the cost is small, but it could be skipped when the selection doesn't need it.
  • agents.LookPath is now an exported, mutable package variable, used only so tests in other packages can stub it. That's fine for now, but it's a test hook in the package's public API.

@simonfaltum

Copy link
Copy Markdown
Member Author

Thanks for running the real CLI!

  • Startup migrations: right, claude mcp add-json runs Claude's own startup code. A real user's file already has those keys, so I've left it.
  • buildFakeAgentCLIs: it runs in parallel with the rest of the setup, so I've left it until it shows up in the run time.
  • agents.LookPath: agreed it's a test hook. I'll leave it until another package needs a cleaner seam.

@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from 6957247 to edbd091 Compare November 19, 2026 11:42
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from 686894a to 8898daf Compare November 19, 2026 11:42
@simonfaltum

Copy link
Copy Markdown
Member Author

Heads-up after the restack onto main. With #7539's lock and this PR's CLI path together, Upsert and RemoveAt would have held Claude Code's lock while claude mcp add-json or remove ran, and Claude's CLI takes that same lock. Now only the direct writer takes it (upsertDirect, putDirect and removeDirect, through lockFor), never while the agent's CLI runs. TestAgentCLIRunsWithoutTheLock checks that for add and remove. Apart from that, the PR is unchanged, now as one commit on main.

@simonfaltum
simonfaltum force-pushed the aitools-mcp/08-challenge branch from edbd091 to 22ff1dc Compare November 19, 2026 15:49
Base automatically changed from aitools-mcp/08-challenge to main November 19, 2026 16:24
One commit for the restack onto main. The individual commits, up to 686894a, are in the pull request's history.

Co-authored-by: Isaac <no-reply@databricks.com>
@simonfaltum
simonfaltum force-pushed the aitools-mcp/08b-agent-clis branch from 8898daf to 03d0647 Compare November 19, 2026 16:25
@simonfaltum
simonfaltum added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit fd2f501 Nov 19, 2026
28 checks passed
@simonfaltum
simonfaltum deleted the aitools-mcp/08b-agent-clis branch November 19, 2026 17:04
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

❌ Integration test report

Commit: fd2f501

Run: 44573221306

Env 💥​PANIC ❌​FAIL 🟨​KNOWN 🤯​MISS 💚​RECOVERED ✅​pass 🙈​skip Time
💥​ aws linux-2core-8gb 1 2 336 20 1271 1413 320:00
💥​ aws-windows-latest-4core-16gb 1 2 2 283 18 1240 1441 320:00
💥​ azure linux-2core-8gb 1 6 323 14 1266 1421 320:00
💥​ azure-windows-latest-4core-16gb 1 3 254 17 1251 1449 319:59
💥​ gcp linux-2core-8gb 1 2 352 18 1244 1419 320:00
💥​ gcp-windows-latest-4core-16gb 1 2 341 20 1169 1447 320:00
521 interesting tests: 490 MISS, 10 KNOWN, 10 RECOVERED, 6 FAIL, 5 PANIC
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 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/apps/compute_size ✅​p 🤯​M ✅​p ✅​p ✅​p ✅​p
🤯​ TestAccept/bundle/apps/compute_size/DMS= ✅​p 🤯​M ✅​p ✅​p ✅​p ✅​p
🤯​ TestAccept/bundle/apps/compute_size/DMS=true ✅​p 🤯​M ✅​p ✅​p ✅​p ✅​p
🤯​ TestAccept/bundle/apps/job_permissions 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/apps/job_permissions/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/apps/job_permissions/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_doesnot_exist 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_doesnot_exist/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_doesnot_exist/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_not_deployed 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_not_deployed/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_not_deployed/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cli_defaults 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/cli_defaults/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cli_defaults/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_cross_target 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_cross_target/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_cross_target/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_permissions 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_permissions/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_permissions/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/config_edits 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/config_edits/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/config_edits/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/dashboard_etag 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/dashboard_etag/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/dashboard_etag/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/flushed_cache 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/flushed_cache/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/flushed_cache/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/formatting_preserved 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/formatting_preserved/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/formatting_preserved/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_fields 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/job_fields/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_fields/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_multiple_tasks 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/job_multiple_tasks/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_multiple_tasks/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_params_variables 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/job_params_variables/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_params_variables/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_pipeline_task 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/job_pipeline_task/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_pipeline_task/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/json_status_missing_state 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/json_status_missing_state/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/json_status_missing_state/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/json_status_selectors 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/json_status_selectors/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/json_status_selectors/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/multiple_files 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/multiple_files/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/multiple_files/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/multiple_resources 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/multiple_resources/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/multiple_resources/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/output_json 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/output_json/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/output_json/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/output_no_changes 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/output_no_changes/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/output_no_changes/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/pipeline_fields 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/pipeline_fields/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/pipeline_fields/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/policy_injected_cluster_fields 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/policy_injected_cluster_fields/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/policy_injected_cluster_fields/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/resolve_variables 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/resolve_variables/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/resolve_variables/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/select_basic 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/select_basic/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/select_basic/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/select_multiple 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/select_multiple/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/select_multiple/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/skip_deployment 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/skip_deployment/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/skip_deployment/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/skip_permissions 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/skip_permissions/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/skip_permissions/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/target_override 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/target_override/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/target_override/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/task_rename_revert 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/task_rename_revert/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/task_rename_revert/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/debug/fetch-repository-info 🤯​M 🤯​M 🤯​M ✅​p 🤯​M 🤯​M
🤯​ TestAccept/bundle/debug/fetch-repository-info/DMS= 🤯​M 🤯​M 🤯​M ✅​p 🤯​M 🤯​M
🤯​ TestAccept/bundle/debug/fetch-repository-info/DMS=true 🤯​M 🤯​M 🤯​M ✅​p 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle/DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC=/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle/DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC=/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle/DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC=true/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle/DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC=true/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/files/no-snapshot-sync 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/files/no-snapshot-sync/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/files/no-snapshot-sync/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/basic 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/basic/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/breakglass 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/breakglass/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/can-manage 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/can-manage/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/destroy-redeploy 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/destroy-redeploy/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/dev-mode 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/dev-mode/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/legacy-state 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/legacy-state/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/missing-snapshot 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/missing-snapshot/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/no-artifacts 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/no-artifacts/DMS=/READPLAN= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/no-artifacts/DMS=/READPLAN=1 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/permissions-change 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/permissions-change/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/select 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/select/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/mlops-stacks 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/mlops-stacks/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/mlops-stacks/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/spark-jar-task 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/spark-jar-task/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/spark-jar-task/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/alert 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/alert/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/alert/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/catalog 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/catalog/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/catalog/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/cluster 🤯​M 🤯​M 🤯​M 🤯​M ✅​p 🤯​M
🤯​ TestAccept/bundle/deployment/bind/cluster/DMS= 🤯​M 🤯​M 🤯​M 🤯​M ✅​p 🤯​M
🤯​ TestAccept/bundle/deployment/bind/cluster/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M ✅​p 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard/DMS=/READPLAN= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard/DMS=/READPLAN=1 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard/DMS=true/READPLAN= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard/DMS=true/READPLAN=1 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
Top 50 slowest tests (at least 2 minutes):
duration env testname
16:39 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=
14:47 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
12:01 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
11:52 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
11:13 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
10:32 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
10:30 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
10:25 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
10:24 gcp linux-2core-8gb TestAccept/bundle/resources/schemas/rename_then_change/DMS=true
10:21 azure linux-2core-8gb TestAccept/bundle/resources/schemas/rename_then_change/DMS=
10:03 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
10:01 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
9:58 aws linux-2core-8gb TestAccept/bundle/resources/schemas/rename_then_change/DMS=true
9:42 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
9:32 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
9:31 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
9:28 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
9:24 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
9:15 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
9:15 azure linux-2core-8gb TestAccept/bundle/templates/default-python/combinations/classic/DLT=yes/DMS=/NBOOK=yes/PY=yes/READPLAN=1
9:02 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
8:48 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
8:46 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=true
8:42 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=true
8:42 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=
8:42 aws-windows-latest-4core-16gb TestAccept/bundle/resources/postgres_branches/update_protected/DMS=
8:39 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=
8:37 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
8:37 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
8:28 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/schemas/rename_then_change/DMS=
8:13 gcp linux-2core-8gb TestAccept/bundle/templates/default-python/integration_classic/DMS=/UV_PYTHON=3.9
8:07 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=true
8:04 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=
8:02 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/schemas/rename_then_change/DMS=true
7:57 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true
7:56 gcp linux-2core-8gb TestAccept/bundle/templates/default-python/combinations/classic/DLT=no/DMS=/NBOOK=no/PY=yes/READPLAN=1
7:49 azure-windows-latest-4core-16gb TestAccept/bundle/resources/schemas/rename_then_change/DMS=true
7:48 azure-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
7:45 azure linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
7:40 azure-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/deploy/simple/DMS=true
7:38 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
7:34 azure-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/deploy/simple/DMS=
7:28 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
7:28 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=true
7:24 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=
7:22 azure linux-2core-8gb TestAccept/bundle/resources/schemas/rename_then_change/DMS=true
7:19 azure linux-2core-8gb TestAccept/pipelines/run/refresh-flags
7:16 aws linux-2core-8gb TestAccept/bundle/resources/materialization_sets/immutable/DMS=true
7:02 gcp linux-2core-8gb TestAccept/bundle/resources/materialization_sets/immutable/DMS=true
7:01 azure linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
(372 table rows omitted to keep the report under 60000 bytes)

idelafuente-oc pushed a commit to idelafuente-oc/cli that referenced this pull request Nov 20, 2026
This pull request is part of the stack that adds the hidden `databricks
aitools mcp` command group. It sits on databricks#7595, which adds and removes
agent MCP entries through each agent's own CLI.

`databricks aitools mcp add` and `remove` stopped in a terminal with
"interactive selection is not available yet" when a flag was missing.
This PR replaces that stopgap with pickers. Runs without a terminal keep
their flags and output.

## Changes
- In a terminal, `add` asks for the profile, the services and the agents
that the flags do not give. The profile resolves as it does without a
terminal, so the picker runs only where that stops with several
profiles.
- `add` has its own agent picker rather than `install`'s. Like the other
`mcp` pickers, Esc cancels it, and its help says enter confirms.
- At the catalog and schema prompt, Esc stops listing, as an empty
answer does, and keeps the picks of the pages already shown. Ctrl-C
still aborts the add.
- A picker cancelled with Esc leaves nothing on screen.
- A run that picks its services checks the profile and chooses the
agents before it connects. A missing profile or no agent is refused
without a request. A picked service whose recorded entry points at
another host is refused after the pick, before anything is written.
- The service picker marks services the profile already has as
`(installed)`, unchecked. "Another schema..." lists another catalog and
schema and keeps the checks.
- The profile picker rows have no `[default]` mark.
- The plan says `add`, `re-assert` (only when the write leaves the entry
as it is), `update` or `replace`. An agent whose config cannot be read
is shown with the reason.
- `add` asks `Proceed?` only when a picker made a choice. For each
sign-in-required server it installed, it asks "Sign in now?" unless the
caller is already signed in. Ctrl-C stops the remaining questions and
prints the login command of each server still to sign in.
- In a terminal, `remove` with none of `--names`, `--profile` or `--all`
shows the installed servers and asks `Proceed?` before removing the
picked ones.
- `add --no-login` skips the sign-in question that a terminal asks for
each sign-in-required server it installed. It cannot be combined with
`--login`. Without a terminal, `add` already does not sign in.
- An empty pick in the service picker prints `No servers selected.` and
exits 0 without writing anything. It used to fail with INVALID_FLAGS.
- The pickers share `install`'s picker model, from databricks#7721: `runPicker`
runs a built picker, `newPicker` takes the search func (nil for none),
and the model gains an `onKey` hook and a search check that allows none.

## Why
Choosing servers needs their descriptions and sign-in requirements,
which the workspace knows and the flags do not show.

## Decisions to review
- Agents are chosen before the services, so a missing agent or a broken
profile is reported before any request. Cost: the agent question comes
first.
- Esc at the catalog and schema prompt stops listing instead of aborting
the add, so the picks already shown are kept. Cost: an Esc meant to
abort keeps those picks; Ctrl-C aborts.
- `add` has its own agent picker, so the two copies can drift apart.
- A picked service is checked against its recorded entry only after the
pick, so one stale entry of another service does not stop the picker.
- Installed services are checkable rows, not disabled rows, because the
picker library has no disabled options. Checking one re-asserts its
entry, as `add --names` does.
- `--name` without `--names` is refused rather than offered a
single-select picker.

## Tests
- `mcp_pickers_test.go` covers the service and profile pickers, the
agent picker's failed check and Esc, the location prompt's Esc, and the
remove picker's refusal. `mcp_add_test.go` runs an interactive `add`
through the prompt seams: refusals make no request, a changed host is
refused after the pick, and a fully specified run asks only the sign-in
question. `TestMcpAddPickerEmptyPickAddsNothing` covers the empty pick,
and `TestValidateMCPAddFlags` the `--login` and `--no-login` conflict.
- `mcp_remove_test.go` runs the remove picker end to end, including a
declined confirmation.
- `./task test-exp-aitools` passes. `go test -race ./cmd/aitools/
./libs/aitools/... ./libs/cmdio/` and `GOOS=windows` vet pass.
- Not tested: a real terminal and a live workspace. The prompts are
covered through their seams.

## How to review
Small edits outside the feature, about 15 lines in `libs/cmdio/`
(`io.go`, `prompt.go`, `select.go`), `cmd/aitools/mcp.go`,
`uninstall.go`, and the moved `multiSelectHelp` constant in
`install.go`. Read closely: `cmd/aitools/mcp_pickers.go`, the `add` flow
in `cmd/aitools/mcp_add.go` (agent choice at its interactive branch,
before the service pick), and `cmd/aitools/mcp_remove.go`.

This pull request and its description were written by Isaac.

Co-authored-by: Isaac <no-reply@databricks.com>
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.

4 participants