openai / openai/codex

GitHub fetch_pr and fetch_commit return invalid unified diffs without file headers

Open
#43,145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI mcp tool-calls
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Problem

The GitHub connector advertises a unified diff string from fetch_pr and fetch_commit. For a four-file change, both return concatenated hunks without diff --git, ---, or +++ file headers. The resulting string cannot be parsed as a unified patch and does not identify which file owns each hunk.

Reproduction

Use public repository openai/codex, merged PR #43126 and commit 008bbd5884122dc95aaece19ecfe0fc6a59dcf36. In Code Mode, call:

const pr = await tools.mcp__codex_apps__github_fetch_pr({
  repo_full_name: "openai/codex", pr_number: 43126
});
const commit = await tools.mcp__codex_apps__github_fetch_commit({
  repo_full_name: "openai/codex",
  commit_sha: "008bbd5884122dc95aaece19ecfe0fc6a59dcf36"
});
const complete = await tools.mcp__codex_apps__github_get_pr_diff({
  repo_full_name: "openai/codex", pr_number: 43126, format: "diff"
});

Inspect each returned structuredContent.diff (accommodate the separate wrapper mismatch in #43132 if necessary).

Tool Diff characters File headers Hunk headers
fetch_pr 7,703 0 5
fetch_commit 7,703 0 5
get_pr_diff 8,319 4 5

Both incomplete strings begin with:

@@ -27,6 +27,7 @@ single_version_override(

Save the strings as text files and run git apply --stat FILE (this parses the patch without applying it). The fetch_pr output fails with exit 128 and patch fragment without header. The get_pr_diff output succeeds with exit 0 and reports four files, 169 insertions and two deletions.

Expected behavior

A field advertised as a unified diff should retain file boundaries and names. Return a complete unified diff, or expose explicitly documented per-file patches with filenames. Cover multi-file commits and PRs with a parser-based regression test.

Environment and scope

Observed September 6, 2026 on macOS 26.6.2, installed Codex CLI 0.153.4, GitHub plugin package 0.1.12-5f7cd798dc99. Refreshing the marketplace package returned the same version and byte-identical files. The package contains connector metadata and assets; the hosted backend version is unknown.

An independent parent agent reproduced the test agent's result. The calls succeeded without tool errors; the defect is in the advertised diff's contents. get_pr_diff supplies a working PR alternative. Root cause and ownership within the hosted connector/result transformation are not established.

Duplicate check

On September 6, 2026, searches across open and closed openai/codex issues found no exact duplicate: "fetch_pr" "diff", "fetch_commit" "diff", and "patch fragment without header" each returned zero issues. Broader header/filename searches did not identify the same defect.

Public source fixture: https://github.com/openai/codex/pull/43126

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the structuredContent.diff from fetch_pr and fetch_commit with get_pr_diff using the openai/codex PR #43126 and commit 008bbd5884122dc95aaece19ecfe0fc6a59dcf36. Run git apply --stat on saved outputs and add a parser-based regression test covering multi-file PRs and commits. Done means returned diffs retain file headers, filenames, and parse successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.