Repository navigation
fix: ask gh for an uncolored PR diff - #92
Merged
Merged
Conversation
gh colors `gh pr diff` even into a pipe when CLICOLOR_FORCE or GH_FORCE_TTY is set. The escape codes before each `diff --git` made the whole PR parse as no files, so a CI review reported "No reviewable changes". Pass `--color never` in both places that read the PR diff. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🤖 AI code reviewDecision: Ready for human review Overall PR risk: Low. This change modifies two
No findings. This review is advisory — it never blocks a merge and never auto-approves. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
gh pr diffcolors its output even into a pipe when the environment forces color (CLICOLOR_FORCE=1orGH_FORCE_TTY=1). The escape codes in front of eachdiff --gitline meanparseUnifiedDifffinds no files, so a CI review reports "No reviewable changes" and reviews nothing.What
Pass
--color neverin both places that read the PR diff:GitHubPRSource.getChangedFiles(src/sources/github-pr.ts), which builds the review's file list;GitHubReporter.linkContextAsync(src/reporters/github.ts), which builds the diff-line index for inline links. Colored output there quietly downgraded in-diff findings to plain text.Tests
src/__tests__/github-pr-diff.test.tsputs a fakeghonPATHthat wraps every line in escape codes unless--color neveris passed, then checks both callers parse the file and its lines. Both tests fail with the flag removed. The full suite, typecheck, lint, format andllp:checkpass.🤖 Generated with Claude Code