Skip to content

update_issue body is capped at 10 KB while create_issue / add_comment allow 65 KB #45787

Description

@sg650

update_issue body is capped at 10 KB while create_issue / add_comment allow 65 KB

Summary

The update_issue safe-output rejects any body larger than 10 KB with a JSON-RPC
validation error, even though the handler-level validation already permits up to
MaxBodyLength (65000). The sibling outputs create_issue and add_comment accept
bodies up to 65536. The discrepancy comes from a single missing maxLength on the
update_issue.body property in the MCP tool input schema.

Observed on v0.82.x; the schema omission is still present on main at time of writing.

Reproduction

A scheduled/dispatch workflow that maintains a large "dashboard" issue by replacing its
body each run:

---
on:
  workflow_dispatch:
permissions:
  contents: read
  issues: write
engine: copilot
safe-outputs:
  update-issue:
    target: "*"
    body:
---

# Repro

Call `update_issue(issue_number=<N>, operation="replace", body="<Markdown body larger than 10 KB>")`
— e.g. a generated table that renders to ~12 KB.

Expected: the issue body is replaced (up to the documented ~65 KB limit).

Actual: the call is rejected before it reaches the handler:

-32602: Input string parameter(s) exceed the 10 KB limit for tool 'update_issue': 'body' (11899 bytes)

The identical body submitted via create_issue or add_comment succeeds. (A body under
10 KB updates fine, which is why this only surfaces once the content grows.)

Root cause

The MCP call-time validator validateStringInputLengths
(actions/setup/js/mcp_scripts_validation.cjs) applies a 10 KB default cap
(MAX_STRING_INPUT_BYTES = 10 * 1024, "SM-IS-01") to every top-level string argument —
but explicitly skips any field that declares its own maxLength:

// Skip fields with an explicit maxLength — handler-level validation enforces their limit.
if (typeof schema.maxLength === "number") {
  continue;
}

In the tool input schema (actions/setup/js/safe_outputs_tools.json, generated from
pkg/workflow/js/safe_outputs_tools.json), the body field declares maxLength for some
issue-writing tools but not for update_issue:

tool body.maxLength in tool schema subject to 10 KB pre-check?
create_issue 65536 no (skipped)
add_comment 65536 no (skipped)
update_issue (absent) yes → capped at 10 KB

Because update_issue.body has no maxLength, it falls through to the 10 KB default and is
rejected at MCP-call time — before it ever reaches the handler. The handler-level config
already allows the full body length: pkg/workflow/safe_outputs_validation_config.go
defines update_issue.body as {Type: "string", Sanitize: true, MaxLength: MaxBodyLength}
(65000), identical to create_issue and add_comment. So the 10 KB rejection is purely an
artifact of the missing schema annotation, not an intended limit for issue bodies.

The error surfaces from actions/setup/js/mcp_server_core.cjs (and the HTTP transport
mcp_scripts_mcp_server_http.cjs), which call validateStringInputLengths(args, tool.inputSchema).

Implementation plan

  1. Add maxLength to update_issue.body in the tool schema
    (pkg/workflow/js/safe_outputs_tools.json, and regenerate/mirror
    actions/setup/js/safe_outputs_tools.json):

    • Set body.maxLength to 65536, matching create_issue and add_comment.
    • This makes validateStringInputLengths skip the 10 KB default for update_issue.body,
      deferring to the handler-level cap (MaxBodyLength = 65000) that is already enforced.
  2. Add regression coverage
    (actions/setup/js/safe_output_type_validator.test.cjs or the nearest existing
    validation test):

    • Assert an update_issue call with a body between 10 KB and 65 KB is accepted at
      MCP-call time (no -32602).
    • Assert a body over the handler-level MaxBodyLength is still rejected (by the
      handler), so the real cap is unchanged.
    • Optionally, a schema-consistency test asserting every issue/comment-writing tool that
      declares a body string field also declares body.maxLength, to prevent regressions
      for other tools.
  3. Follow project guidelines

    • Run make agent-finish (or the repo's equivalent) before completing.
    • Keep the change scoped to the schema + tests; no change to MAX_STRING_INPUT_BYTES or
      the validator logic is needed — the skip path already exists.

Suggested labels

bug, mcp

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions