Repository navigation
Conversation
The records move from a section of the skills state file to ~/.databricks/aitools/mcp.json. A CLI older than v1.28.0 writes the skills state file back without the section, and its uninstall deletes the file, so the records were lost: remove could no longer remove the servers, and serve no longer refused a profile that points at another host. Records that v1.28.0 wrote are read from the section until the first save, which moves them. The new file has a schema version, and a file from a newer CLI is refused instead of being written back without what this CLI does not know. Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
Regression test report ✅Commit: Selected 10 changed tests (limit=20, 0 not selected) 10 tests: regression=10 unreleased=0 coverage=0 failing=0
TestAccept/cmd/aitools/mcp/add-default-config: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): TestAccept/cmd/aitools/mcp/add-two-agents: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): TestAccept/cmd/aitools/mcp/add-two-profiles: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): TestAccept/cmd/aitools/mcp/add-unparsable-config: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): TestAccept/cmd/aitools/mcp/agent-cli-concurrent-edit: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): TestAccept/cmd/aitools/mcp/list-and-remove: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): TestAccept/cmd/aitools/mcp/list-check: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): TestAccept/cmd/aitools/mcp/login-flips-active: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌main (e6f3460): latest (v1.28.0): 2 more failure details omitted, see the full report in the run. |
Collaborator
✅ Integration test reportCommit: c3d8e68
Top 6 slowest tests (at least 2 minutes):
|
…file The section in the skills state file is no longer removed: a v1.28.0 binary on the same machine still reads it, and removing it could drop a record that binary added later. The records file is kept when it has no servers, so that it stays the only source once it exists. MCP code no longer writes the skills state file at all. A records file from a newer CLI is read for the fields this CLI knows, so serve and list keep working, and add and remove refuse it before they change an agent config. A file without a schema version is refused. Co-authored-by: Isaac <no-reply@databricks.com>
# Conflicts: # acceptance/cmd/aitools/mcp/agent-cli-concurrent-edit/script # acceptance/cmd/aitools/mcp/state-across-cli-versions/output.txt # acceptance/cmd/aitools/mcp/state-across-cli-versions/script # acceptance/cmd/aitools/mcp/state-across-cli-versions/test.toml
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft for a decision: not for review or merge until an option is chosen.
Stacked on #8147, which records the behavior this changes (cases 5 to 7). It is independent of options A (#8150) and B (#8151), which cover the agent configs and the lock: this one covers the MCP install records, and goes with either.
Changes
~/.databricks/aitools/mcp.json. Until now they were themcpsection of the skills state file (~/.databricks/aitools/skills/.state.json, Add MCP state records, drift check and profile binding checks #7537). A CLI that does not know the records never writes the new file, and the MCP commands no longer write the skills state file.addorremovethat saves copies them into the new file. The section is left as it is, so a v1.28.0 binary on the same machine still reads what it wrote."servers": []), so the section is not read again.schema_version(1). A file with a newer version is read for the fields this CLI knows, soserveandlistkeep working, and it is never written:addandremoverefuse it before they change an agent config (... was written by a newer Databricks CLI (schema version 2, this CLI writes 1); upgrade the CLI to add or remove MCP servers). A file without a schema version is refused.The installer package is not changed. It keeps the code that preserves the section in its own saves, which now only matters for records that v1.28.0 wrote.
Why
A CLI older than v1.28.0 has no
mcpfield in its state type and does not check the schema version. Itsaitools install,updateanduninstall --skillswrite the file back without the section, and itsaitools uninstalldeletes a file that holds nothing else. After that,mcp removefinds no server and leaves the entries in the agent configs, andmcp servestarts for a profile that now points at another host, since the record held the host the server was added for. #7537 lists this as a decision to review; #8147 shows it. Two CLI versions on one machine is common: a Homebrew install next to one that a tool or an IDE extension bundles.A second reason: the skills installer and auto-install read and write that same file under their own rules, so an
mcp addthat saved between their read and their write could lose its record. With a file of their own, the records have one group of writers.Decisions to review
serve. The cost of copying: v1.28.0 keeps seeing the records as they were at the copy, and what it adds afterwards is not seen by this CLI.aitools mcpis hidden in v1.28.0.addorremove. A machine that only runsserveandlistafter the upgrade still has them only in the section, where an older CLI can drop them. Copying on a read would close that, and makesservewrite.mcp.jsonnext toauto-install.json, not underskills/.Tests
acceptance/cmd/aitools/mcp/state-across-cli-versions(from acc: record aitools mcp entries lost to concurrent writes and older CLIs #8147) loses itsBadnessandUndefinednotes: after the older CLI's install and uninstall,liststill shows the server,servestill refuses the re-pointed profile with exit 2, andremovetakes the server out of both agent configs. New sections: a fixture with two servers as v1.28.0 wrote them is copied with the recorded host and time and the section stays; the file stays after the last removal; a newer file is listed, refused byaddandremove, and unchanged.serve-binding-errorsstill writes the section by hand, so it covers the read of v1.28.0's records.telemetry/mcp-removewrote the section after the records file existed, and now writes the records file.libs/aitools/mcp:TestSaveStateLeavesSkillsStateFileAlone,TestRecordsSurviveSkillsStateFileOfOlderCLI,TestRecordsOfV1_28AreCopiedNotMoved,TestRecordsFileOfNewerCLIIsReadAndNotWritten,TestRecordsFileWithoutSchemaVersionIsRefused.jqfilter, andadd-two-agentsgains"schema_version": 1../task aitools-quickpasses;TestAccept/cmd/aitoolsandTestAccept/experimental/aitoolspass.Gaps and risks
mcpsection onaitools uninstalland drops the section onaitools uninstall --skills <name>.addorremoveruns can still overwrite each other's save of the records file, and the check for a newer file and the write are two steps.listorservethat has the records file open whileaddreplaces it is not handled specially.🤖 AI agent (fable5.2, isaac_claude)
This pull request and its description were written by Isaac.