fix: pre-fetch review comments and allow astral.sh in responder#186
Open
fix: pre-fetch review comments and allow astral.sh in responder#186
Conversation
MCP pull_request_read returns [] inside the agent sandbox. This has never worked reliably in our repo. The working runs used web_fetch as a fallback, but the agent doesn't consistently fall back. Fix: add a shared import (fetch-review-comments.md) with a steps: block that runs gh api graphql BEFORE the agent starts, writing threads to /tmp/gh-aw/review-data/unresolved-threads.json. The agent reads the file instead of querying MCP or the API. This follows the pattern used by github/gh-aw's own workflows (copilot-pr-data-fetch.md). Related: #180 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The responder couldn't run ruff/uv in the sandbox because astral.sh (where uv and ruff binaries are hosted) was blocked by the firewall. This caused the agent to push code without lint validation, resulting in E741 violations on PR #177. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Flatten comments.nodes wrapper in jq filter so the agent gets a
clean comments array instead of GraphQL's { nodes: [...] } nesting.
Matches the pattern used in gh-aw's own discussions-data-fetch.md.
- Bump reviewThreads(first: 50) to first: 100 (GitHub GraphQL max).
This is a bandaid — proper cursor-based pagination is tracked in
#185 but not worth the complexity yet since our PRs have 1-5
threads.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes reliability issues in the review-responder gh-aw workflow by pre-fetching PR review threads via GraphQL (avoiding an intermittent MCP empty-result bug) and by allowing astral.sh so the agent can download/run the Astral Python toolchain (uv, ruff) inside the sandbox.
Changes:
- Add a shared workflow import to fetch and persist unresolved review threads to
/tmp/gh-aw/review-data/unresolved-threads.json. - Update
review-responderto import the pre-fetch step, read the local JSON file instead of MCP/REST, and allowastral.sh. - Recompile the locked workflow YAML.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.github/workflows/shared/fetch-review-comments.md |
New shared import that queries GraphQL for review threads and writes unresolved threads JSON for the agent to consume. |
.github/workflows/review-responder.md |
Imports the pre-fetch step, switches instructions to read pre-fetched JSON, and adds astral.sh to the network allowlist. |
.github/workflows/review-responder.lock.yml |
Updated compiled workflow reflecting the import, allowlist changes, and new pre-fetch step. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Same firewall gap as the responder (#183). Both workflows instruct the agent to run uv/ruff/pytest inside the sandbox, but astral.sh was blocked. The agents were never actually running CI — the PR body claims like 'All 416 tests pass' were written without executing any tools. Confirmed by checking logs: zero matches for uv/ruff/pytest in implementer run 23334098536. Closes #184 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The tools.bash block in the shared import caused the compiled lock file to switch from --allow-all-tools to a restricted shell allowlist that excluded uv/ruff/pyright/pytest. The agent would still be unable to run CI even with astral.sh allowed. Removing the tools block restores --allow-all-tools since the steps block runs as a workflow step, not inside the agent sandbox. Also removed 2>&1 from the gh api call — stderr was being mixed into the JSON output file, which would corrupt it if gh emitted warnings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Bump comments(first: 10) to comments(first: 100) so threads with many comments aren't truncated. - Replace silent jq fallback (2>/dev/null || echo []) with explicit error handling — step now fails loudly if jq can't parse the GraphQL response instead of silently writing empty array. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
Fixes #180 (MCP returns empty review comments), #183 (astral.sh blocked by firewall), and #184 (audit all workflows for missing network domains).
Problem
Three issues prevented the gh-aw agents from working correctly:
MCP read failure: The GitHub MCP
pull_request_readtool returns empty[]for review comments inside the gh-aw agent sandbox. This is a known issue confirmed by the gh-aw team. The responder could never find comments to address.Cannot run lint:
astral.sh(whereuvandruffbinaries are hosted) was blocked by the firewall. All three code-writing workflows (responder, ci-fixer, implementer) were instructed to runuv run ruff checkbut could not. The agents skipped validation and pushed unverified code. PR body claims like "All 416 tests pass" were written without actually running tests — confirmed by checking agent logs (zero matches for uv/ruff/pytest).Audit: All 6 workflows audited. The 3 that write code (responder, ci-fixer, implementer) now have
astral.sh. The other 3 (code-health, quality-gate, test-analysis) only review/file issues and do not need it.Solution
Pre-fetch pattern (fixes #180)
Created a shared import (
.github/workflows/shared/fetch-review-comments.md) that runs before the agent starts:gh api graphqlto fetch all review threads with resolution statuscomments.nodeswrapper into clean arrays/tmp/gh-aw/review-data/unresolved-threads.jsonThis mirrors the pattern used in
github/gh-awowncopilot-pr-data-fetch.md.Network fix (fixes #183, #184)
Added
"astral.sh"tonetwork.allowedin all three code-writing workflows:review-responder.mdci-fixer.mdissue-implementer.mdChanges
.github/workflows/shared/fetch-review-comments.md— pre-fetch shared import.github/workflows/review-responder.md— addedimports:,astral.sh, updated step 3.github/workflows/ci-fixer.md— addedastral.shto network.github/workflows/issue-implementer.md— addedastral.shto networkTesting
Tested pre-fetch on two PRs (before jq/pagination fixes, both successful):
Known limitations
Related issues