Skip to content

fix(mcp): bound the GitHub MCP tools longer than a GitHub read #4784

Closed

Description

@dan-petty

Problem Description

The GitHub session waits at most DEFAULT_GH_SESSION_READ_TIMEOUT_SECONDS (60 s) for each read (#4626). Many MCP tools of CONST_MCP_EXPOSURE_TABLE (src/devops_cli/config/constants.py) run a devops gh or devops pr command that reads GitHub, with a bound of 60 s or 30 s. The owner rule of 2026-11-11 says that each inner timeout is shorter than the call around it, with a margin. A bound that is equal to the read bound or shorter breaks the rule: the dispatch can stop first with exit code 124 Command timed out, and the GitHubUnreadError of the read is lost.

Census on main (CONST_MCP_EXPOSURE_TABLE, entries with a bound of 60 s or less): 23 gh tools and 11 pr tools. The census does not show which of them read GitHub; the item decides each one. Example: ("gh", "issues", "status"), 60.0 runs the same command as resource://gh/issues/status, which reads the issues through the GitHub session.

#4678 fixes the 4 resource://gh/ resources of the MCP server only.

Reproduction Steps

  1. Read CONST_MCP_EXPOSURE_TABLE in src/devops_cli/config/constants.py.
  2. Find the gh and pr tools whose bound is 60.0 or 30.0.
  3. Compare each bound with DEFAULT_GH_SESSION_READ_TIMEOUT_SECONDS (60 s) in src/devops_cli/config/defaults.py.

Expected vs Actual Behavior

Expected: each MCP tool whose command reads GitHub has a bound that is longer than the session read bound, with a margin, and the chain test tests/github/test_github_session_timeouts.py holds it.

Actual: 34 gh and pr tools have a bound of 60 s or less. The table also holds the bounds as numbers with no name.

Environment Diagnostics

devops-cli main, after #4678.

Logs, Traces, or Terminal Output

None. The census reads the source.

Source: #4678

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

Proposed design

Problem statement

The GitHub session stops a read at 60 s. Many gh and pr MCP tools use a dispatch bound of 60 s or 30 s. The dispatch can stop first with exit 124 Command timed out, and the GitHubUnreadError of the read is lost. The change gives each GitHub-reading MCP tool a named bound of 300 s, and the chain test holds it.

Acceptance criteria

Requirement: GitHub MCP tools use a named bound

Each gh and pr tool in CONST_MCP_EXPOSURE_TABLE SHALL use the named bound CONST_MCP_GITHUB_TOOL_TIMEOUT_SECONDS.

Scenario: The GitHub MCP rows use the named bound

  • WHEN The test reads every gh and pr row of CONST_MCP_EXPOSURE_TABLE.
  • THEN Each row's timeout equals CONST_MCP_GITHUB_TOOL_TIMEOUT_SECONDS, and that value is 300.0.

Requirement: GitHub MCP tools outlast a GitHub read

Each gh and pr MCP tool MUST have a dispatch bound that is longer than DEFAULT_GH_SESSION_READ_TIMEOUT_SECONDS.

Scenario: A short GitHub MCP bound fails

  • WHEN A gh or pr row has a timeout at or below DEFAULT_GH_SESSION_READ_TIMEOUT_SECONDS.
  • THEN The chain test fails and names the command path and its timeout.

Requirement: A write tool also outlasts a GitHub read

A gh or pr MCP tool that writes to GitHub SHALL also have a dispatch bound longer than the GitHub session read bound.

Scenario: A write tool gets the GitHub MCP bound

  • WHEN The test reads the gh issue close row and the pr ready row.
  • THEN Each row has the timeout CONST_MCP_GITHUB_TOOL_TIMEOUT_SECONDS, above 60 s.

Requirement: The chain test holds the GitHub MCP table

The chain test tests/github/test_github_session_timeouts.py SHALL check each gh and pr row against DEFAULT_GH_SESSION_READ_TIMEOUT_SECONDS.

Scenario: The chain test covers the exposure table

  • WHEN The chain test runs with the exposure table.
  • THEN The test passes when every gh and pr row is above 60 s, and fails on a row at or below 60 s.

Existing Tool Considered

The alternatives check of 2026-11-14 returned none and found no tool. No open, maintained library covers a project-specific MCP timeout table. The change edits one constant, the gh and pr rows of CONST_MCP_EXPOSURE_TABLE, and the existing chain test. The written cost is one small pull request, with one constant, the table rows and one test. The project keeps this table for every MCP tool, so the change adds no new subsystem to keep.

Key questions

  • Which MCP tools read GitHub?: All gh and pr rows read GitHub. A write command reads GitHub before it writes. The change applies the GitHub MCP bound to every gh and pr row. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/commands/pr.py, src/devops_cli/github/issues.py, docs/adr/0006-github-session-requests-go-through-gidgethub.md]
    • Chosen: All gh and pr rows. Every command in these groups sends at least one GitHub request. A write command reads before it writes, so the read bound applies.
    • Rejected: Only rows with read_only=True. The read_only flag says the tool writes nothing. It does not say the tool reads nothing. A write tool would keep the 60 s risk.
    • Rejected: Audit each command separately. No gh or pr command avoids GitHub, so the audit adds work with no different result.
  • What margin above the 60 s GitHub read does the change use?: Use 300 s. The existing MCP read bound is 300 s, and resource://gh/ reads already use it. The margin is 240 s. (best practice) [sources: src/devops_cli/config/defaults.py, tests/github/test_github_session_timeouts.py, docs/adr/0006-github-session-requests-go-through-gidgethub.md]
    • Chosen: 300 s, the existing MCP read bound. The chain test already holds DEFAULT_GH_SESSION_READ_TIMEOUT_SECONDS below DEFAULT_MCP_TOOL_TIMEOUT_SECONDS (300 s). The margin is 240 s.
    • Rejected: 120 s. It leaves 60 s. The project has no evidence for this margin, and it is below the existing MCP read bound.
    • Rejected: 90 s. It leaves 30 s. A slow GitHub read can take almost 60 s, so this margin is too small.
    • Rejected: Keep 60 s. It is equal to the read bound, so the dispatch can stop first and break the owner rule.
  • How does the table name its GitHub MCP bound?: Add CONST_MCP_GITHUB_TOOL_TIMEOUT_SECONDS to src/devops_cli/config/constants.py with 300.0, and use it for every gh and pr row. constants.py cannot import defaults.py, because defaults.py imports constants.py. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/config/defaults.py]
    • Chosen: Add a new constant in constants.py. The table lives in constants.py. The constant gives the bound one name and keeps the import direction.
    • Rejected: Import DEFAULT_MCP_TOOL_TIMEOUT_SECONDS into constants.py. defaults.py imports constants.py, so this import is circular.
    • Rejected: Leave 300.0 literals in the table. The issue reports that the table holds bare numbers with no name. A literal leaves that problem in place.
  • How does the chain test cover the exposure table?: Extend tests/github/test_github_session_timeouts.py with a loop over the gh and pr rows. Keep the existing strict less-than test. (best practice) [sources: tests/github/test_github_session_timeouts.py]
    • Chosen: Extend the existing chain test. The issue names this test. It already holds the inner-shorter-than-outer rule, so the MCP table chain belongs there.
    • Rejected: Add a new test file. It duplicates the chain test and splits the timeout rule across two files.
    • Rejected: Change only the table values. No test would stop a later row at 60 s or less.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/bug
    scope/mcp
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 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/mcp. The (mcp) scope of the title gives the scope.
    • Priority: P2-Medium. 34 tools lose their GitHubUnreadError when the dispatch bound fires first, but the system still returns a timeout exit code.
    • Value: Medium. Users get a generic exit 124 instead of the specific GitHub error on 34 tools, which hinders diagnosis.
    • Effort: Low. The change updates 34 numeric bounds in one constants table and adjusts one chain test.
    • Related: fix(github): bound the GitHub session read at 60 seconds #4626, which asks for a different change. Both items work on the timeout layering rule; #4626 set the inner 60 s bound, the candidate fixes the outer MCP tool bounds to exceed it.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. dan-petty commented on Nov 14, 2026

    @dan-petty
    OwnerAuthor

    Cannot build as written without a design: the item asks to decide, for each of 34 gh/pr MCP tools, whether its command reads GitHub, then to give each read a bound above DEFAULT_GH_SESSION_READ_TIMEOUT_SECONDS and a chain in tests/github/test_github_session_timeouts.py, and to replace the table's bare numbers with names. The table also mixes reads and writes with the same 60 s bound. No refine block names the classification or the margin (10 s, 20 s, or a ratio), so a change would guess the owner's rule. Refine the item with the read/write list and the margin, or split it: (1) name the bounds, (2) raise the read tools, (3) add the chain test.

  6. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches found general MCP timeout guidance and SDK/FastMCP per-tool timeout settings (e.g. server-side tool_timeout_seconds, per-server timeout fields), but none of them covers this need. The issue is an internal change to devops-cli's own CONST_MCP_EXPOSURE_TABLE bounds and a chain test in tests/github/test_github_session_timeouts.py, which no external tool or library provides.

    Tool: none found

    Lacks:

    • Raising the 34 gh/pr MCP tool bounds in CONST_MCP_EXPOSURE_TABLE above DEFAULT_GH_SESSION_READ_TIMEOUT_SECONDS with a margin
    • Deciding which of the 34 tools actually read GitHub, so their bound exceeds the session read bound
    • A chain test in tests/github/test_github_session_timeouts.py that holds the inner-shorter-than-outer rule
    • Naming the bare numeric bounds in the table
    • The read/write classification and the margin value, which the issue itself does not define

    Searches run:

    • FastMCP tool timeout parameter, results: 5
    • MCP server tool timeout configuration per-tool timeout, results: 5
    • MCP Python SDK tool timeout per tool decorator, results: 5
    • devops-cli MCP server gh tools exposure table, results: 5
    • library enforce nested timeout inner timeout shorter than outer call, results: 5
    • mcp python sdk server tool timeout setting, results: 5

    Sources:

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

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

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    Live since 2026-11-18 13:25 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/mcpsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions