Skip to content

fix(mcp): mark the tools that write local state not read-only - #4942

Merged
dan-petty merged 5 commits into
mainfrom
fix/3642-local-writers-not-read-only
Nov 12, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/3642-local-writers-not-read-only

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Six MCP tools write local state or a file, but CONST_MCP_EXPOSURE_TABLE marked them read-only: ai_quiesce, ai_resume, ai_failover, ai_gateway_failover, review_export_feedback and ai_ingest_library. A role server, a client and the run tool of the stage planner choose commands by this flag, so a model could make a write that the flag hid. The requirement mcp-read-only-hint-agrees-with-no-external-request now says that the no-external-request class names external requests only: the tool of such a command is read-only only when the command writes no local state and no file. The ratchet test names the local writers in CONST_MCP_LOCAL_WRITERS and fails on a flag that disagrees, and on a stale entry. The six rows and docs/MCP_TOOLS.md now show the tools as not read-only.

Closes #3642

Change: openspec/changes/archive/2026-11-12-3642-tools-that-write-local-state-are/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/mcp Model Context Protocol tools, system resources, and prompts labels Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test record

Fail-to-pass, uv run devops ci fail-to-pass --base origin/main on the final code:

  failed on base: tests.invariants.test_dry_run_class_ratchet::test_a_no_external_request_tool_is_read_only_exactly_when_its_command_writes_nothing (assert ['MCP tool fo...e or a file.'] == [])
  passed on base: tests.invariants.test_dry_run_class_ratchet::test_a_local_writer_outside_the_exposure_table_is_reported
  passed on base: tests.invariants.test_dry_run_class_ratchet::test_a_command_that_writes_nothing_with_a_tool_that_is_not_read_only_is_reported
  passed on base: tests.invariants.test_dry_run_class_ratchet::test_a_local_writer_with_a_read_only_tool_is_reported
  passed on base: tests.invariants.test_dry_run_class_ratchet::test_dry_run_class_ratchet_repository_invariant
  passed on base: tests.invariants.test_dry_run_class_ratchet::test_ratchet_fails_when_command_lacks_class_and_not_in_gaps
  passed on base: tests.invariants.test_dry_run_class_ratchet::test_ratchet_fails_when_gap_entry_is_not_a_command
  passed on base: tests.invariants.test_dry_run_class_ratchet::test_ratchet_fails_when_request_plan_lacks_dry_run
  passed on base: tests.invariants.test_dry_run_class_ratchet::test_ratchet_fails_when_classified_command_remains_in_gaps
1 failed on base (1 failed and 8 passed in tests/invariants/test_dry_run_class_ratchet.py; 0 errored).

The three audit tests pass on base because they test the audit function that this change adds to the test module. The repository test fails on base with the six local writers that the table marked read-only.

Local checks on the final code, after the rebase onto main:

  • uv run devops ci test tests/invariants/test_dry_run_class_ratchet.py tests/ai/mcp/test_mcp_read_only_write_options.py tests/ai/mcp/test_mcp_tool_registry.py tests/ai/mcp/test_mcp_roles.py tests/roadmap/stage/test_stage_run_allowlist.py tests/ai/mcp/test_mcp_exposure_table.py tests/commands/test_mcp_tools_and_schema_export.py: 224 passed.
  • Before the rebase, also tests/roadmap/stage/test_roadmap_stage_command_citations.py, tests/ai/mcp/test_ai_gateway.py, tests/ai/controller/test_ai_controller.py, tests/ai/mcp/test_mcp_tool_argv.py and tests/ai/mcp/test_path_confinement.py with the files above: 373 passed.
  • uv run devops ci --check --only lint,format,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures: all rows pass.
  • uv run devops docs generate --check: all documentation files are up to date.
  • uv run mypy src/devops_cli/config/constants.py: no issues.

Notes

  • The issue names five tools. ai_ingest_library is a sixth member of the same set: devops ai ingest library writes the contract of the package to the library contracts directory, also when the MCP tool gives no output directory. A read of all 39 no-external-request rows of the table found no other command that writes local state or a file.
  • The run tool of the stage planner allows only the read-only rows of the table, so the six commands leave its allow-list. src/devops_cli/roadmap/stage/ does not change.
  • Open pull request feat(git): refuse a push that does not hold origin/main #4879 changes other lines of src/devops_cli/config/constants.py.
  • No live step is necessary.

@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 06:10
@dan-petty
dan-petty merged commit 6d93d77 into main Nov 12, 2026
24 checks passed
@dan-petty
dan-petty deleted the fix/3642-local-writers-not-read-only branch November 12, 2026 06:13
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.117.0](v0.116.2...v0.117.0)
(2026-11-12)


### Features

* **git:** refuse a push that does not hold origin/main
([#4879](#4879))
([f55a20b](f55a20b)),
closes [#4670](#4670)


### Bug Fixes

* **k8s:** replace the SearXNG worker before its memory limit
([#4951](#4951))
([95abe10](95abe10))
* **mcp:** mark the tools that write local state not read-only
([#4942](#4942))
([6d93d77](6d93d77))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/mcp Model Context Protocol tools, system resources, and prompts type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(mcp): tools that write local state are flagged read-only

1 participant