Skip to content

fix(server): keep a/ and b/ prefixes in rendered git patches - #9438

Merged
Yash-Singh1 merged 1 commit into
pingdotgg:mainfrom
Mnigos:diff-panel-duplicate-id
Sep 3, 2026
Merged

fix(server): keep a/ and b/ prefixes in rendered git patches#9438
Yash-Singh1 merged 1 commit into
pingdotgg:mainfrom
Mnigos:diff-panel-duplicate-id

Conversation

@Mnigos

@Mnigos Mnigos commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

When the user's git config sets diff.noprefix or diff.mnemonicPrefix, the patches the server hands to the clients lose their a/ and b/ path prefixes. The diff renderer only recognizes the default prefixes, so every file in such a patch parses with an empty name, and opening the diff panel crashes with CodeView.addItem: duplicate id "" as soon as the diff contains two files. Reloading crashes again immediately because the panel reopens into the same state.

The review preview, untracked, and checkpoint diff commands now pin the prefixes with --src-prefix=a/ --dst-prefix=b/, which wins over the user's config on every git version I could test. Patches that only feed text generation are left alone.

Covered by tests that run the real driver against a repository configured with diff.noprefix=true; both fail without the fix.

Fixes #9427.

Implemented with Claude Code (Claude Fable 5).


Note

Low Risk
Localized VCS diff flag change with regression tests; no auth, data, or API contract changes.

Overview
Fixes broken diff UI when a repo’s Git config sets diff.noprefix or diff.mnemonicPrefix, which strips the default a/ / b/ path prefixes from patches. The client parser only recognizes those prefixes, so files end up with empty names and the diff panel can crash on multi-file diffs.

Server-side git diff calls that feed the review preview, untracked diffs, and checkpoint diffs now pass --src-prefix=a/ and --dst-prefix=b/ via shared PATCH_RENDER_PREFIX_ARGS, overriding user config. Diffs used only for text summaries (e.g. staged commit context) are unchanged.

Integration tests configure diff.noprefix (and mnemonic prefix in the driver test) and assert patches still contain diff --git a/... b/....

Reviewed by Cursor Bugbot for commit 6691bc3. Configure here.

Note

Fix GitVcsDriver patch rendering to keep a/ and b/ prefixes

Git config options like diff.noprefix or diff.mnemonicPrefix could strip or alter the standard a//b/ path prefixes in rendered patches, breaking parsers that expect them.

  • Adds the shared constant PATCH_RENDER_PREFIX_ARGS in GitVcsDriverCore.ts and applies it to checkpoint diffs, working-tree review diffs, branch-range review diffs, and untracked-file (--no-index) review diffs
  • Adds integration tests in CheckpointStore.test.ts and GitVcsDriverCore.test.ts covering diff.noprefix and diff.mnemonicPrefix scenarios
  • Behavioral Change: all rendered checkpoint and review patches now emit standard a//b/ prefixes regardless of repository or global git diff settings
📊 Macroscope summarized 6691bc3. 2 files reviewed, 1 issue evaluated, 1 issue filtered, 0 comments posted

🗂️ Filtered Issues

apps/server/src/vcs/GitVcsDriverCore.ts — 0 comments posted, 1 evaluated, 1 filtered
  • line 58: PATCH_RENDER_PREFIX_ARGS does not disable diff.mnemonicPrefix. Git's documented --default-prefix option is the one that overrides diff.mnemonicPrefix; supplying only custom source/destination prefixes leaves that configuration enabled. Consequently, repositories with diff.mnemonicPrefix=true still emit prefixes such as i/, w/, c/, or o/, which the client parser does not recognize, so a multi-file review/checkpoint patch can again create duplicate empty file IDs and crash the diff panel. [ Out of scope (triage) ]

A user-level diff.noprefix or diff.mnemonicPrefix leaked into the patches the
server hands to the clients. The diff renderer only recognizes git's default
a/ and b/ prefixes, so every file in such a patch parsed with an empty name,
and the diff panel crashed on duplicate ids as soon as a diff contained two
files. Pin the prefixes with --src-prefix/--dst-prefix on the review preview,
untracked, and checkpoint diff commands.

Fixes pingdotgg#9427
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 3, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 6691bc3

Macroscope's review found this PR approvable — This is a small, self-contained server fix that normalizes Git patch prefixes at existing rendering points, with integration coverage for repository prefix settings. It does not introduce a new capability, schema change, deployment change, or static-analysis override.

You can add or adjust custom eligibility rules. Learn more.

@Yash-Singh1
Yash-Singh1 merged commit 36c4e9c into pingdotgg:main Sep 3, 2026
21 checks passed
@Mnigos
Mnigos deleted the diff-panel-duplicate-id branch September 3, 2026 20:26
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 4, 2026
## What's Changed
* fix(web): make right panel tabs easier to scroll by @maria-rcks in pingdotgg/t3code#9461
* fix(web): render transparent previews on white by @UtkarshUsername in pingdotgg/t3code#9463
* fix(mobile): show loading and syncing in the working pill by @juliusmarminge in pingdotgg/t3code#9466
* fix(server): keep a/ and b/ prefixes in rendered git patches by @Mnigos in pingdotgg/t3code#9438
* fix(server): full-access OpenCode threads no longer ask for approvals by @shivamhwp in pingdotgg/t3code#9282
* fix(web): reuse pull request list data while loading by @maria-rcks in pingdotgg/t3code#9467
* feat(web): let users turn off composer collapse on blur and scroll by @juliusmarminge in pingdotgg/t3code#9469

## New Contributors
* @Mnigos made their first contribution in pingdotgg/t3code#9438

**Full Changelog**: pingdotgg/t3code@v0.0.39-nightly.20260903.1272...v0.0.39-nightly.20260903.1273

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.39-nightly.20260903.1273
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: clicked the "diff" button to open diff in right panel and UI crashed with "duplicate id" error

2 participants