Skip to content

fix(roadmap): the MCP key gate reads any quoted tuple #4255

Closed

Description

@dan-petty

Problem

The MCP exposure key gate flags any quoted string tuple in the Feasibility or task text of a plan as a key of CONST_MCP_EXPOSURE_TABLE. A tuple that belongs to another table is refused.

Evidence: the live run of the stage job on item #4062 (2026-11-09, model Sonnet) ended with this refusal: "The plan cites the MCP exposure table key ("reset_logfire_bridge",), but CONST_MCP_EXPOSURE_TABLE does not have it." The tuple ("reset_logfire_bridge",) is an entry of another table in tests/conftest.py. The plan did not talk about the MCP exposure table.

Where: _mcp_exposure_problems and _QUOTED_TUPLE in src/devops_cli/roadmap/stage/stage_commands.py. The check runs on every quoted tuple of every citation text, with no context. The requirement "Resolve cited MCP exposure keys" in openspec/specs/roadmap-stage/spec.md says "each quoted tuple key that a plan cites" as an exposure table key.

Expected

The gate reads a quoted tuple only where the plan talks about the MCP exposure table: the sentence that holds the tuple names CONST_MCP_EXPOSURE_TABLE or the words "exposure table". A quoted tuple in any other sentence is not an MCP key and is not checked. The reason: a quoted tuple is a common Python literal (a fixture table, a parameter list), and the key shape of the table is only a command path.

Acceptance criteria

  • A unit test builds a plan whose Feasibility sentence says: "The fixture table in tests/conftest.py lists ("reset_logfire_bridge",)." command_citation_problems returns no problem. Command: uv run devops ci test tests/roadmap/stage/test_roadmap_stage_command_citations.py. It fails today.
  • The tests "an unknown key is refused" and "a known key is accepted" use a sentence that names the exposure table, and still pass.
  • The spec requirement says where the gate reads a quoted tuple. Command: uv run devops openspec check.
  • The golden set of the stage eval still passes. Command: uv run devops roadmap eval stage --replay.

Existing tool considered

The standard library re and ast that the gate uses now. No new library. The change adds one sentence-level condition and deletes no code.

Cost

  • Tokens to build: low.
  • Tokens to keep and to fix: low.
  • Elapsed time: about 45 minutes.

Related

#4204, #4170, #3529 (the stage job and its gates). #3302 (the citation gate).

Proposed design

Problem statement

The MCP exposure key gate checks every quoted string tuple in the Feasibility and task text of a plan against CONST_MCP_EXPOSURE_TABLE. A tuple that belongs to another table, such as ("reset_logfire_bridge",) in tests/conftest.py, makes the stage job refuse the plan. The gate must read a quoted tuple only in a sentence that talks about the MCP exposure table.

Acceptance criteria

Requirement: Resolve cited MCP exposure keys

The plan check SHALL resolve a quoted tuple key against CONST_MCP_EXPOSURE_TABLE only when the sentence that holds the tuple names CONST_MCP_EXPOSURE_TABLE or the words "exposure table".

Scenario: A tuple of another table is not checked

  • WHEN A plan Feasibility sentence says: The fixture table in tests/conftest.py lists ("reset_logfire_bridge",).
  • THEN command_citation_problems returns no problem.

Requirement: Resolve cited MCP exposure keys

The plan check SHALL refuse a quoted tuple that is not a key of CONST_MCP_EXPOSURE_TABLE when its sentence names the exposure table.

Scenario: An unknown key in an exposure table sentence is refused

  • WHEN A plan cites the exposure table key ("ai", "ast-graph") in a sentence that says exposure table.
  • THEN command_citation_problems returns one problem that names ("ai", "ast-graph").

Requirement: Resolve cited MCP exposure keys

The plan check SHALL accept a quoted tuple that is a key of CONST_MCP_EXPOSURE_TABLE when its sentence names the exposure table.

Scenario: A known key in an exposure table sentence is accepted

  • WHEN A plan cites the exposure table key ("ai", "ast", "graph") in a sentence that says exposure table.
  • THEN command_citation_problems returns no problem.

Requirement: Resolve cited MCP exposure keys

The plan check MUST judge each sentence alone, so that an exposure table sentence does not make a tuple in the next sentence an MCP key.

Scenario: The next sentence holds a foreign tuple

  • WHEN A Feasibility text says: The exposure table is read. The fixture lists ("reset_logfire_bridge",).
  • THEN command_citation_problems returns no problem.

Requirement: Resolve cited MCP exposure keys

The change SHALL keep the stage eval golden set passing and SHALL keep the requirement text of the living spec in step with the gate.

Scenario: The offline checks pass

  • WHEN The replay of the stage eval and the OpenSpec check run offline.
  • THEN uv run devops roadmap eval stage --replay and uv run devops openspec check both exit 0.

Existing Tool Considered

No library covers this need. The gate already uses the standard library re and ast, and the change adds one sentence-level condition to that code. Cost to build: low tokens, about 45 minutes, and no new dependency.

Key questions

  • Where does the gate check every quoted tuple today?: _mcp_exposure_problems in src/devops_cli/roadmap/stage/stage_commands.py runs _QUOTED_TUPLE over the whole text of each citation. It has no context check. command_citation_problems calls it for every text from _proposal_citation_texts. [sources: src/devops_cli/roadmap/stage/stage_commands.py, tests/roadmap/stage/test_roadmap_stage_command_citations.py, openspec/specs/roadmap-stage/spec.md]
  • How does the gate decide that a tuple talks about the MCP exposure table?: Split the text into sentences with a regular expression on a sentence end followed by white space. Check a tuple only in a sentence that holds CONST_MCP_EXPOSURE_TABLE or the words "exposure table" with no case. This is the rule of the issue Expected section. A tuple in a sentence with no such name is skipped. Non-goal: a tuple whose exposure table mention sits in another sentence is not checked. (best practice) [sources: src/devops_cli/roadmap/stage/stage_commands.py, openspec/specs/roadmap-stage/spec.md]
    • Chosen: Sentence-level condition with re. Matches the issue text, adds no dependency, and keeps the change small in the module that holds the gate.
    • Rejected: Check the whole citation text for the exposure table name. A long text that names the table once would still make every foreign tuple in it a refused key.
    • Rejected: Add a natural language sentence splitter library. The rule needs only a simple split. A library adds a dependency for no gain.
    • Rejected: Drop the tuple check. It loses the refusal of a made-up key such as ("ai", "ast-graph"), which the living spec requires.
  • Which tests and spec text change?: The tests an unknown key is refused and a known key is accepted in tests/roadmap/stage/test_roadmap_stage_command_citations.py use a sentence that names the exposure table. A new test covers the foreign tuple. The requirement Resolve cited MCP exposure keys is modified through a MODIFIED spec delta, because the base spec already holds that name. (best practice) [sources: tests/roadmap/stage/test_roadmap_stage_command_citations.py, openspec/specs/roadmap-stage/spec.md]
    • Chosen: MODIFIED requirement in the spec delta. The base spec already has the requirement name, so an ADDED requirement would be refused.
    • Rejected: ADDED requirement with a new name. It would leave the old requirement text, which says each quoted tuple, in conflict with the new rule.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 9, 2026
  2. dan-petty commented on Nov 9, 2026

    @dan-petty
    OwnerAuthor

    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/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. A false positive blocks valid plans at the stage gate, but a rephrase avoids it and no data is lost.
    • Value: Medium. It removes a recurring false refusal that wastes a review round and delays a plan.
    • Effort: Low. The change adds one sentence-level condition and deletes no code, about 45 minutes.
    • Related: fix(roadmap): Verify a claimed member against the staged source #3458, which asks for a different change. Both fix the stage plan gate reading text too broadly, but #3458 fixes member-claim verification while this fixes MCP exposure key tuple matching.
  3. added
    priority/p2-medium
    owner/agent
    on Nov 9, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 9, 2026
  5. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

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

  6. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 9, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 9, 2026
  8. devops-cli-service commented on Nov 9, 2026

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

    @devops-cli-service
    Contributor

    Live since 2026-11-09 21:51 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/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions