Skip to content

LLM outputs backslashes instead of backticks in create_pull_request body, causing path prompts and control character corruption #2016

@m-nash

Description

@m-nash

Description

When creating pull requests via the create_pull_request MCP tool, the PR body sometimes contains backslash-delimited code spans (\code\) instead of backtick-delimited spans (`code`). This causes two problems:

  1. False path detection: The Copilot CLI interprets \RequestReviewAsync\ etc. as Windows file paths and prompts the user to "allow paths" for strings that are not paths
  2. Control character corruption: Backslash sequences that happen to match C-style escapes get interpreted as control characters:
    • \a (e.g. \auto_execute) → U+0007 (bell)
    • \r (e.g. \request_review) → carriage return → newline
    • \t (e.g. \task_complete) → tab (U+0009)
    • \v (e.g. \volatile) → vertical tab (U+000B)
    • \n → newline (U+000A)
    • \b → backspace (U+0008)

Reproduction

This is intermittent — some PRs are clean while others are affected. Examples from https://github.com/m-nash/pr-copilot:

Analysis

  1. The GitHub MCP server’s CreatePullRequest handler is a clean pass-through — it takes the body parameter and sends it directly to github.NewPullRequest.Body with no transformation
  2. The corruption originates upstream, likely either:
    • The LLM itself generates \code\ instead of `code` in the JSON tool call arguments (intermittently)
    • Or something in the CLI’s JSON parsing/argument extraction converts backticks to backslashes
  3. The C-style escape interpretation (\a→bell, \v→vtab) suggests a non-standard string processing step, since these are NOT valid JSON escape sequences (\a and \v are C escapes, not JSON)

Evidence that the LLM generates backslashes

When the issue occurs, the user is prompted to "allow paths" for the backslash-delimited strings in the body argument. This confirms the \ characters are present in the tool call arguments before they reach the MCP server.

Expected behavior

  • PR bodies should preserve backtick-delimited code spans as-is
  • Strings like \RequestReviewAsync\ in tool arguments should not trigger path access prompts
  • No C-style escape interpretation should be applied to PR body text

Environment

  • Copilot CLI on Windows
  • GitHub MCP server (latest)
  • Affects create_pull_request tool body parameter

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions