Conversation
GitHub's unified-diff endpoint (`application/vnd.github.diff`) caps
responses at 20,000 lines and returns HTTP 406 beyond that. Previously,
`jp` would surface that as an opaque error, making large PRs unusable
via the `gh:pr` attachment URI.
When the 406 is detected, the handler now falls back to the paginated
`/pulls/{N}/files` endpoint and synthesizes a unified-diff-like blob
from the per-file `DiffEntry` records. Each file gets the standard `diff
--git a/PATH b/PATH` header plus the patch hunks as returned by GitHub.
Renames and copies include the appropriate `rename from`/ `rename to`
(or `copy from`/`copy to`) markers so downstream consumers can still
identify the nature of each change.
When GitHub omits the `patch` field for a file (binary files or files
exceeding GitHub's per-file limit), a placeholder line is emitted that
surfaces the file status and line counts, ensuring the LLM still knows
the file was modified even without hunks.
The existing exclude-pattern logic applies equally to the fallback path,
so files like `Cargo.lock` or snapshot files are dropped before the
synthesized blob is assembled. A notice is injected into the PR header
whenever the fallback is used, including the count of patch-truncated
files when non-zero.
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
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.
GitHub's unified-diff endpoint (
application/vnd.github.diff) capsresponses at 20,000 lines and returns HTTP 406 beyond that. Previously,
jpwould surface that as an opaque error, making large PRs unusablevia the
gh:prattachment URI.When the 406 is detected, the handler now falls back to the paginated
/pulls/{N}/filesendpoint and synthesizes a unified-diff-like blobfrom the per-file
DiffEntryrecords. Each file gets the standarddiff --git a/PATH b/PATHheader plus the patch hunks as returned by GitHub.Renames and copies include the appropriate
rename from/rename to(or
copy from/copy to) markers so downstream consumers can stillidentify the nature of each change.
When GitHub omits the
patchfield for a file (binary files or filesexceeding GitHub's per-file limit), a placeholder line is emitted that
surfaces the file status and line counts, ensuring the LLM still knows
the file was modified even without hunks.
The existing exclude-pattern logic applies equally to the fallback path,
so files like
Cargo.lockor snapshot files are dropped before thesynthesized blob is assembled. A notice is injected into the PR header
whenever the fallback is used, including the count of patch-truncated
files when non-zero.