You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Work diff canvas breaks when the user's Git config sets diff.mnemonicPrefix, color.diff=always or diff.noprefix #279
The Work attempt diff (collect_git_delta in server/work_artifact_registry.py, and collect_diff in server/local_git.py for provider.diff without a ledger delta) should produce a standard a/ / b/ uncolored patch that parse_unified_diff can render, no matter how the user has configured git diff for their own terminal.
The patch commands only pass --no-ext-diff (and collect_diff not even that), so the user's diff configuration leaks into the machine-read patch:
diff.mnemonicPrefix=true (a commonly recommended setting) makes git diff HEAD emit c/ / w/ prefixes. The canvas then shows the file as w/src/app.py, and the real path from changed_files is appended as a second, hunk-less "modified" entry.
color.diff=always wraps every line in ANSI escapes (\x1b[1mdiff --git ...). No line matches a header or hunk, so the canvas shows only hunk-less entries from changed_files with 0 additions and 0 deletions, and the raw patch <pre> in the Work page shows escape codes.
diff.noprefix=true drops the prefixes, so diff --git lines no longer have the shape the parser expects.
diff.external is honored by collect_diff, so the patch returned by provider.diff can be any external tool's output.
Run an attempt that edits a tracked file (for example app.py), then open the attempt diff.
Actual (mnemonicPrefix): two entries, w/app.py with the hunks and app.py with none.
Actual (color.diff=always): one hunk-less entry app.py, additions == 0, deletions == 0.
Expected: one entry app.py with its hunks and counts.
Platform-independent; current main (fdd672e). Reproduced with Git 2.43 and 2.54. Affects any user whose global or repository Git config sets one of the options above.
Sanitized evidence / 错误信息或截图(请先脱敏)
git diff accepts --no-color --src-prefix=a/ --dst-prefix=b/ (and --no-ext-diff), which override these settings for a single command, so the Host can pin the format of the patches it parses without changing the user's configuration.
Related issues or fixes / 相关问题或修复
#274 / #275 fixed a different parser defect in the same diff canvas.
Activity
fix(work): pin the format of patches the Host parses (Code-Amadeus#284)