Skip to content

fix(mcp): pr_check_readiness is read-only in the exposure table but can resolve threads #3235

Closed
2 of 2 issues completed

Description

@dan-petty

Problem

CONST_MCP_EXPOSURE_TABLE marks pr_check_readiness as read-only. Its --auto-resolve option resolves review threads on GitHub. That is a write. A role server that selects tools by the read-only flag would offer a write to a model.

Found by the agent that built the role-scoped MCP servers (#3219, PR #3233). That change leaves pr_check_readiness out of every job role table to stay safe.

Evidence

  • src/devops_cli/config/constants.py: the pr check-readiness row of CONST_MCP_EXPOSURE_TABLE.
  • devops pr check-readiness --help lists --auto-resolve.

Fix

Mark the tool as not read-only, or remove --auto-resolve from the published schema. Add a check that fails when a read-only tool has an option whose help text says it resolves, writes, deletes or creates.

Acceptance criteria

  1. No tool with a write option is flagged read-only.
  2. A test reads the published schema of every read-only tool and fails on a write option.

Related: #3219, #3222.

Alternatives check of 2026-11-05: none.
Tool: none found.

Proposed design

Problem statement

The MCP exposure table marks pr check-readiness as read-only, but the command has a --auto-resolve option that resolves review threads. The published schema decides whether a role server can pass that option. No test checks that a read-only tool's published schema has no write option. The stage job found that the issue premise does not hold at the staging commit, so the change must test the schema and align the flag with it.

Acceptance criteria

Requirement: Readiness flag follows published schema

The pr check-readiness row of CONST_MCP_EXPOSURE_TABLE SHALL set its read-only flag to False when the published MCP schema exposes the auto_resolve option, and to True when the schema omits it.

Scenario: Flag matches auto_resolve exposure

  • WHEN the test reads the pr check-readiness row and the published MCP schema
  • THEN the read-only flag is False exactly when the schema includes auto_resolve

Requirement: Auto-resolve option stays available

The pr check-readiness command SHALL keep the --auto-resolve option for CLI callers.

Scenario: CLI help lists auto-resolve

  • WHEN the help of pr check-readiness is read
  • THEN the help lists --auto-resolve

Requirement: Read-only tools reject write options

A test SHALL read every read-only tool's published schema and fail on a case-insensitive word match of a write verb in an option description.

Scenario: Write verb in a read-only schema

  • WHEN a read-only tool has an option description with resolve, write, delete or create, or an inflection
  • THEN the test fails and names the tool and the option

Requirement: Current read-only schemas pass

The published schemas of the read-only tools SHALL pass the write-option test with the current CONST_MCP_EXPOSURE_TABLE.

Scenario: Current table passes

  • WHEN the write-option test runs against the current CONST_MCP_EXPOSURE_TABLE
  • THEN the test passes

Existing Tool Considered

No open, maintained tool covers the need. The alternatives check found none: general MCP security scanners validate annotation fields or scan a running server, and none reads this repository's CONST_MCP_EXPOSURE_TABLE or its generated FastMCP schema option help text. The change builds a repository-specific invariant test. Written cost: about 5,000 tokens and under two hours to build, keep and fix.

Key questions

  • Should pr check-readiness be marked not read-only, or should --auto-resolve leave the published schema?: Neither unconditionally. The test SHALL compare the table's read-only flag with the published schema. Set the flag to False when the schema exposes auto_resolve; keep True when the schema omits it. Keep the CLI option. This avoids a false premise and makes the flag match what a role server can call. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/ai/mcp/generator.py, src/devops_cli/commands/pr.py]
    • Chosen: Schema-driven flag. The stage job found the premise does not hold at the staging commit, so the proposal cannot assume that the schema exposes auto_resolve. The test sets the flag from the schema.
    • Rejected: Always mark not read-only. This changes the flag even when the published schema omits the write option, and it repeats the premise that the stage job rejected.
    • Rejected: Remove auto_resolve from the published schema. This hides a real CLI write and removes a capability. If the schema already omits the option, it changes nothing.
  • What rule detects a write option in a read-only tool's published schema?: Scan every option description in each read-only tool's published schema. Fail on a case-insensitive word match of resolve, write, delete or create, or an inflection. Name the tool and the option. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/ai/mcp/generator.py, tests/ai/mcp/test_fastmcp_contracts.py]
    • Chosen: Scan option descriptions for write verbs. The issue defines the signal as help text, and the schema copies it into option descriptions. It catches --auto-resolve and neutral option names.
    • Rejected: Scan option names only. A neutral name such as --auto-resolve still writes, and a name can mislead.
    • Rejected: Scan only pr check-readiness. The invariant covers every read-only tool, and the issue asks for that test.
  • Where does the test get the published schema?: The MCP generator builds the published schema from CONST_MCP_EXPOSURE_TABLE. The test reads that generated schema, not the table alone or the CLI help text. [sources: src/devops_cli/ai/mcp/generator.py, src/devops_cli/config/constants.py]
  • What does CONST_MCP_EXPOSURE_TABLE hold for pr check-readiness at the refined commit?: The row holds True for the read-only flag at commit 7072e35. The stage job found the premise does not hold at the staging commit, so the test must read the generated schema and not trust this row alone. [sources: src/devops_cli/config/constants.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Sub-issues

Sub-issues

2 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. added
    type/bug
    scope/mcp
    status/new
    value/medium
    effort/low
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/mcp. The (mcp) scope of the title gives the scope.
    • Priority: P2-Medium. A misclassified tool can expose a write to a model expecting read-only, but it is a single entry fix with a clear scope.
    • Value: Medium. Correct tool classification prevents role servers from offering unintended write operations.
    • Effort: Low. One constant entry change plus one validation test.
    • Related: feat(mcp): mcp tools declare ToolAnnotations, and mutating tools require approval in devops-cli's own agent loop #857, which asks for a different change. Both address MCP tool safety classification; #857 adds ToolAnnotations and an approval flow, while this candidate fixes the exposure table flag and adds a schema validation test.
  3. added
    priority/p2-medium
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  4. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 7072e35 (see proposed design in issue body).

  5. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    The stage job returned the item to New. The premise of the issue does not hold at the staging commit, so the job planned no change and opened no pull request.

    Evidence:

    x

  6. added
    status/new
    and removed
    status/ready
    on Nov 2, 2026
  7. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Tool: none found

    Lacks:

    • No tool reads this repository's CONST_MCP_EXPOSURE_TABLE or its generated FastMCP schema to check that a read-only-flagged tool has no write option.
    • General MCP security scanners and annotation guides validate annotation fields (readOnlyHint/destructiveHint) against each other or scan a running server for tool poisoning, not option help text of CLI-derived tools.
    • The issue needs a repository-specific invariant test (write verb in a read-only tool's option help text) plus a one-row table fix; that must be built in the repository.

    Searches run:

    • MCP tool annotations readOnlyHint validation linter
    • MCP server security scanner detect write tools read-only
    • python library validate MCP tool schema options read-only write verbs test

    Sources:

    Checked on 2026-11-05. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    status/ready
    and removed
    status/new
    on Nov 5, 2026
  9. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at d254410 (see proposed design in issue body).

  10. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 5, 2026
  11. removed
    status/in-review
    on Nov 5, 2026
  12. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor
  13. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-05 16:42 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/mcptype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions