fix(design-decision-gate): handle >300-file PRs without HTTP 406 abort#40078
Merged
Conversation
…ch step - Fetch pr-files.json before attempting gh pr diff so file count is known before the diff call that can 406. - Add a FILE_COUNT guard: when >300 files, write a warning notice to pr.diff and emit a ::warning:: annotation instead of calling the GitHub diff API (which returns HTTP 406 for >300-file PRs). - Add file_count and diff_available fields to adr-prefetch-summary.json so the agent knows when the diff was skipped. - Update agent prompt to use pr-files.json (not mcp diff API) when diff_available is false. Fixes: large-PR HTTP 406 causing step exit-1 before agent runs. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… cases Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix pre-fetch ADR gate to tolerate large PRs
fix(design-decision-gate): handle >300-file PRs without HTTP 406 abort
Jun 18, 2026
Collaborator
|
@copilot diff should ignore **/*.lock.yml files |
….yml from PR diffs Replace the two path-specific lock.yml entries with a single `*.lock.yml linguist-generated=true merge=ours` pattern that covers all *.lock.yml files anywhere in the repository. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Done in 3db1be8. Replaced the two path-specific entries ( |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the design decision gate workflow to gracefully handle PRs with very large file counts by avoiding diff retrieval when it would exceed GitHub’s diff limitations.
Changes:
- Skip fetching the full PR diff when the PR changes more than 300 files; emit a notice file instead.
- Add
file_countanddiff_availableto the prefetch summary JSON to guide downstream behavior. - Broaden
.gitattributesrules for*.lock.ymland adjust workflow lockfile handling.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/design-decision-gate.md | Adds file-count check, conditional diff fetch, and propagates file_count/diff_available into the summary + instructions. |
| .github/workflows/design-decision-gate.lock.yml | Regenerates the locked workflow with the new prefetch logic and summary fields. |
| .gitattributes | Broadens *.lock.yml handling and adds an extra workflow lockfile rule. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
Comment on lines
120
to
+122
| --arg threshold "100" \ | ||
| --argjson file_count "$FILE_COUNT" \ | ||
| --argjson diff_available "$(jq -n --argjson fc "$FILE_COUNT" 'if $fc <= 300 then true else false end')" \ |
| @@ -1,8 +1,7 @@ | |||
| .changeset/*.md linguist-generated=true merge=ours | |||
| .github/workflows/*.lock.yml linguist-generated=true merge=ours | |||
| *.lock.yml linguist-generated=true merge=ours | |||
| slides/*.pptx filter=lfs diff=lfs merge=lfs -text | ||
| docs/slides/** filter=lfs diff=lfs merge=lfs -text | ||
|
|
||
| .github/workflows/*.lock.yml linguist-generated=true merge=ours No newline at end of file |
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.
The
Pre-fetch ADR gate PR contextstep calledgh pr diffunconditionally. For PRs with >300 changed files the GitHub diff API returns HTTP 406, andset -euo pipefailkilled the step before the agent could run.Changes
pr-files.json(paginated) is now fetched beforegh pr diffso the file count is known before attempting the diff call.FILE_COUNT > 300, the diff call is skipped entirely; a descriptive notice is written topr.diffand a::warning::annotation is emitted instead of exiting 1.adr-prefetch-summary.jsongains two new fields:file_count— total changed filesdiff_available— boolean (computed viajq -nto avoid shell edge cases)pr.diffnow branches ondiff_available: whenfalse, directs the agent to usepr-files.jsonfor file-level analysis and explicitly suppresses themcp__github__get_pull_request_diffcall (which would also 406)..gitattributes— Replaced the two path-specific*.lock.ymlentries with a single*.lock.yml linguist-generated=true merge=ourspattern so all.lock.ymlfiles anywhere in the repository are collapsed by default in GitHub PR diffs.