Skip to content

add-comment: reply_to_id not documented in tool schema, causing agents to skip it #26268

@corygehr

Description

@corygehr

Problem

reply_to_id was added to the add-comment handler in PR #24367 (shipped v0.66.1) and works correctly at the handler level. However, the compiled MCP tool schema for add_comment does not list reply_to_id as a parameter. This causes agents to inspect the tool's parameter list, conclude the field isn't supported, and omit it — even when prompt instructions explicitly tell them to include it.

The workaround is to add extra prompt instructions telling agents the field is accepted despite not appearing in the schema. This works but is fragile and shouldn't be necessary.

What happens

  1. Agent reads commentNodeId from pre-step output ✅
  2. Prompt instructs agent to include reply_to_id in add_comment call ✅
  3. Agent inspects the safeoutputs___add_comment MCP tool schema ❌
  4. Agent sees only body, item_number, repo — no reply_to_id
  5. Agent reasons: "The tool doesn't support it" and skips reply_to_id
  6. Comment posts as top-level instead of threaded ❌

Agent's actual reasoning (from a run log):

The comment was posted. But wait - I need to make sure the comment was threaded
under the original comment. Looking at the add_comment tool, it doesn't seem to
have a `reply_to_id` field in the safeoutputs tool's parameters. Let me re-check...

But looking at the safeoutputs-add_comment tool parameters, I don't see a
`reply_to_id` parameter. The tool doesn't support it.

Root cause

The compiled MCP tool schema and validation schema for add_comment don't include reply_to_id:

"add_comment": {
  "defaultMax": 1,
  "fields": {
    "body": { "required": true, "type": "string", "sanitize": true, "maxLength": 65000 },
    "item_number": { "issueOrPRNumber": true },
    "repo": { "type": "string", "maxLength": 256 }
  }
}

PR #24367 added reply_to_id handling to the runtime handler (add_comment.cjs), but the compiler's tool schema generation was not updated to advertise reply_to_id as an accepted parameter.

Workaround

Adding explicit prompt instructions like "The tool accepts reply_to_id even if the tool schema does not list it — include it anyway" successfully overrides the agent's schema-based reasoning. We've confirmed this works end-to-end: both /feedback and /rerun flows now thread correctly with this prompt override.

Request

Add reply_to_id to the compiled MCP tool schema for add_comment so agents can discover it naturally, without needing prompt-level workarounds. Ideally the tool description suffix would also mention it, e.g.:

CONSTRAINTS: Maximum 1 comment(s) can be added. Target: *. Supports reply_to_id for discussion threading.

Context

The handler works. The schema just doesn't tell agents it exists.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions