Skip to content

Commit 88b4550

Browse files
bradygasterCopilot
andauthored
docs(gh-aw): fix setup guide contradictions and sync enlistment guidance (#2153)
Resolve a set of contradictions/unreliable instructions in the public Agentic Workflows setup guide (docs/src/content/docs/guide/gh-aw.md): - Clarify the Profile A (least-privilege, recommended) Actions permission setting and what remains manual under it; add an explicit opt-in Profile B (automatic PR creation) section with its coupled security tradeoff instead of silently enabling it. - Remove unconditional safe-update approval from the executable quick start; approval now requires verifying the report contains exactly SQUAD_GITHUB_APP_PRIVATE_KEY, SQUAD_GITHUB_TOKEN, and bradygaster/squad/.github/actions/squad-init, otherwise stop. - Replace the broken `gh pr edit --add-reviewer @copilot` with a verified Copilot-as-Bot GraphQL requestReviewsByLogin/botLogins request plus a manual UI fallback (both quick-start and full-steps flows). - Make SQUAD_SHA discovery immutable: remove prose claiming quick start resolves dev automatically; require a maintainer-approved SHA. - Make quick start rerunnable/safe: validate a clean working tree and reuse an existing bootstrap branch instead of failing. - Replace the incomplete 7/8-workflow, 5/17-runtime-resource inventory loop with the manifest-backed squad-install-verifier.mjs --verify-install check (8 workflows / 17 shared runtime resources). - Correct the least-privilege fallback lifecycle: bootstrap opens/ reuses a signed fallback issue, a human opens the Cast PR, and Squad Bootstrap must be manually re-dispatched to create the linked research-proposal issue; make this explicit in the quick-start outcome narrative. - Align the /squad implement and troubleshooting prose with the Profile A/B framing so it no longer recommends disabling PR creation while also claiming automatic implementation PRs. Sync the canonical enlistment guidance (.squad-templates/skills/gh-aw-enlistment/SKILL.md) and its 4 mirrors with the same Copilot-as-Bot GraphQL reviewer-request fix (verified via scripts/sync-templates.mjs --sync), and regenerate workflows/squad-workflows.manifest.json's enlistment-skill digest via squad-install-verifier.mjs --write-source. Update the two directly-related documentation contract tests: - test/gh-aw-enlistment-skill.test.ts: match the renamed Profile A heading used as a test slice boundary. - test/standalone-release-workflow.test.ts: assert the new requestReviewsByLogin/copilot-pull-request-reviewer approach instead of the removed --add-reviewer command. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent ebf1564 commit 88b4550

9 files changed

Lines changed: 262 additions & 60 deletions

File tree

‎.squad-templates/skills/gh-aw-enlistment/SKILL.md‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,27 @@ gh pr create \
382382
--base "${default_branch}" \
383383
--title "ci: add Squad agentic workflow" \
384384
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
385-
gh pr edit --add-reviewer @copilot
385+
386+
# Copilot's review identity is a GraphQL Bot, not a User/Team — the REST
387+
# `gh pr edit --add-reviewer @copilot` path silently no-ops for it. Request the
388+
# review through the verified GraphQL path instead:
389+
pr_node_id="$(gh pr view --json id --jq '.id')"
390+
gh api graphql -f query='
391+
mutation($pr: ID!) {
392+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
393+
pullRequest { number }
394+
}
395+
}' -f pr="${pr_node_id}" || echo "Could not request a Copilot review via GraphQL; open the PR in the GitHub UI and add Copilot as a reviewer manually (Reviewers -> Copilot)." >&2
386396
gh pr checks --watch
387397
```
388398

389399
- Open the PR against the **runtime-captured** `${default_branch}`, not a hardcoded
390400
`main`.
391-
- Request Copilot review, address feedback, and wait for required checks.
401+
- Request Copilot review via the GraphQL `requestReviewsByLogin` mutation
402+
(never the REST `--add-reviewer` shortcut, which silently no-ops for the
403+
Copilot Bot reviewer), address feedback, and wait for required checks. If
404+
the GraphQL call fails, add Copilot as a reviewer manually from the PR's
405+
GitHub UI.
392406

393407
### 9. Verify the native review contract after merge
394408

@@ -497,7 +511,13 @@ git push -u origin HEAD
497511
gh pr create --base "${default_branch}" \
498512
--title "ci: add Squad agentic workflow" \
499513
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
500-
gh pr edit --add-reviewer @copilot # then wait for review + checks; DO NOT merge
514+
pr_node_id="$(gh pr view --json id --jq '.id')"
515+
gh api graphql -f query='
516+
mutation($pr: ID!) {
517+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
518+
pullRequest { number }
519+
}
520+
}' -f pr="${pr_node_id}" # Bot-aware review request; then wait for review + checks; DO NOT merge
501521
```
502522

503523
### ✓ Correct: STOP on an undocumented safe-update entry

‎docs/src/content/docs/guide/gh-aw.md‎

Lines changed: 143 additions & 42 deletions
Large diffs are not rendered by default.

‎packages/squad-cli/templates/skills/gh-aw-enlistment/SKILL.md‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,27 @@ gh pr create \
382382
--base "${default_branch}" \
383383
--title "ci: add Squad agentic workflow" \
384384
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
385-
gh pr edit --add-reviewer @copilot
385+
386+
# Copilot's review identity is a GraphQL Bot, not a User/Team — the REST
387+
# `gh pr edit --add-reviewer @copilot` path silently no-ops for it. Request the
388+
# review through the verified GraphQL path instead:
389+
pr_node_id="$(gh pr view --json id --jq '.id')"
390+
gh api graphql -f query='
391+
mutation($pr: ID!) {
392+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
393+
pullRequest { number }
394+
}
395+
}' -f pr="${pr_node_id}" || echo "Could not request a Copilot review via GraphQL; open the PR in the GitHub UI and add Copilot as a reviewer manually (Reviewers -> Copilot)." >&2
386396
gh pr checks --watch
387397
```
388398

389399
- Open the PR against the **runtime-captured** `${default_branch}`, not a hardcoded
390400
`main`.
391-
- Request Copilot review, address feedback, and wait for required checks.
401+
- Request Copilot review via the GraphQL `requestReviewsByLogin` mutation
402+
(never the REST `--add-reviewer` shortcut, which silently no-ops for the
403+
Copilot Bot reviewer), address feedback, and wait for required checks. If
404+
the GraphQL call fails, add Copilot as a reviewer manually from the PR's
405+
GitHub UI.
392406

393407
### 9. Verify the native review contract after merge
394408

@@ -497,7 +511,13 @@ git push -u origin HEAD
497511
gh pr create --base "${default_branch}" \
498512
--title "ci: add Squad agentic workflow" \
499513
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
500-
gh pr edit --add-reviewer @copilot # then wait for review + checks; DO NOT merge
514+
pr_node_id="$(gh pr view --json id --jq '.id')"
515+
gh api graphql -f query='
516+
mutation($pr: ID!) {
517+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
518+
pullRequest { number }
519+
}
520+
}' -f pr="${pr_node_id}" # Bot-aware review request; then wait for review + checks; DO NOT merge
501521
```
502522

503523
### ✓ Correct: STOP on an undocumented safe-update entry

‎packages/squad-sdk/templates/skills/gh-aw-enlistment/SKILL.md‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,27 @@ gh pr create \
382382
--base "${default_branch}" \
383383
--title "ci: add Squad agentic workflow" \
384384
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
385-
gh pr edit --add-reviewer @copilot
385+
386+
# Copilot's review identity is a GraphQL Bot, not a User/Team — the REST
387+
# `gh pr edit --add-reviewer @copilot` path silently no-ops for it. Request the
388+
# review through the verified GraphQL path instead:
389+
pr_node_id="$(gh pr view --json id --jq '.id')"
390+
gh api graphql -f query='
391+
mutation($pr: ID!) {
392+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
393+
pullRequest { number }
394+
}
395+
}' -f pr="${pr_node_id}" || echo "Could not request a Copilot review via GraphQL; open the PR in the GitHub UI and add Copilot as a reviewer manually (Reviewers -> Copilot)." >&2
386396
gh pr checks --watch
387397
```
388398

389399
- Open the PR against the **runtime-captured** `${default_branch}`, not a hardcoded
390400
`main`.
391-
- Request Copilot review, address feedback, and wait for required checks.
401+
- Request Copilot review via the GraphQL `requestReviewsByLogin` mutation
402+
(never the REST `--add-reviewer` shortcut, which silently no-ops for the
403+
Copilot Bot reviewer), address feedback, and wait for required checks. If
404+
the GraphQL call fails, add Copilot as a reviewer manually from the PR's
405+
GitHub UI.
392406

393407
### 9. Verify the native review contract after merge
394408

@@ -497,7 +511,13 @@ git push -u origin HEAD
497511
gh pr create --base "${default_branch}" \
498512
--title "ci: add Squad agentic workflow" \
499513
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
500-
gh pr edit --add-reviewer @copilot # then wait for review + checks; DO NOT merge
514+
pr_node_id="$(gh pr view --json id --jq '.id')"
515+
gh api graphql -f query='
516+
mutation($pr: ID!) {
517+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
518+
pullRequest { number }
519+
}
520+
}' -f pr="${pr_node_id}" # Bot-aware review request; then wait for review + checks; DO NOT merge
501521
```
502522

503523
### ✓ Correct: STOP on an undocumented safe-update entry

‎templates/skills/gh-aw-enlistment/SKILL.md‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,27 @@ gh pr create \
382382
--base "${default_branch}" \
383383
--title "ci: add Squad agentic workflow" \
384384
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
385-
gh pr edit --add-reviewer @copilot
385+
386+
# Copilot's review identity is a GraphQL Bot, not a User/Team — the REST
387+
# `gh pr edit --add-reviewer @copilot` path silently no-ops for it. Request the
388+
# review through the verified GraphQL path instead:
389+
pr_node_id="$(gh pr view --json id --jq '.id')"
390+
gh api graphql -f query='
391+
mutation($pr: ID!) {
392+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
393+
pullRequest { number }
394+
}
395+
}' -f pr="${pr_node_id}" || echo "Could not request a Copilot review via GraphQL; open the PR in the GitHub UI and add Copilot as a reviewer manually (Reviewers -> Copilot)." >&2
386396
gh pr checks --watch
387397
```
388398

389399
- Open the PR against the **runtime-captured** `${default_branch}`, not a hardcoded
390400
`main`.
391-
- Request Copilot review, address feedback, and wait for required checks.
401+
- Request Copilot review via the GraphQL `requestReviewsByLogin` mutation
402+
(never the REST `--add-reviewer` shortcut, which silently no-ops for the
403+
Copilot Bot reviewer), address feedback, and wait for required checks. If
404+
the GraphQL call fails, add Copilot as a reviewer manually from the PR's
405+
GitHub UI.
392406

393407
### 9. Verify the native review contract after merge
394408

@@ -497,7 +511,13 @@ git push -u origin HEAD
497511
gh pr create --base "${default_branch}" \
498512
--title "ci: add Squad agentic workflow" \
499513
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
500-
gh pr edit --add-reviewer @copilot # then wait for review + checks; DO NOT merge
514+
pr_node_id="$(gh pr view --json id --jq '.id')"
515+
gh api graphql -f query='
516+
mutation($pr: ID!) {
517+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
518+
pullRequest { number }
519+
}
520+
}' -f pr="${pr_node_id}" # Bot-aware review request; then wait for review + checks; DO NOT merge
501521
```
502522

503523
### ✓ Correct: STOP on an undocumented safe-update entry

‎test/gh-aw-enlistment-skill.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ describe('gh-aw-enlistment skill', () => {
497497

498498
const setupSection = guide.slice(
499499
guide.indexOf('### Enable GitHub Issues'),
500-
guide.indexOf('### Allow workflow-created pull requests'),
500+
guide.indexOf('### Set Actions pull-request permissions (Profile A, recommended)'),
501501
);
502502
expect(setupSection).toContain(
503503
'test "$(gh api "repos/${owner_repo}" --jq \'.has_issues\')" = "true" || {',

‎test/standalone-release-workflow.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,8 @@ describe('automated package publication', () => {
703703
expect(ghAwGuide).toContain('gh aw compile --strict --approve');
704704
expect(ghAwGuide).toContain('gh aw compile --strict');
705705
expect(ghAwGuide).toContain('gh pr create');
706-
expect(ghAwGuide).toContain('gh pr edit --add-reviewer @copilot');
706+
expect(ghAwGuide).toContain('requestReviewsByLogin');
707+
expect(ghAwGuide).toContain('copilot-pull-request-reviewer');
707708
expect(ghAwGuide).toContain('gh pr checks --watch');
708709
expect(ghAwGuide).toContain('.github/aw/');
709710
expect(ghAwGuide).toContain('`.vscode/settings.json`');

‎workflows/skills/gh-aw-enlistment/SKILL.md‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,27 @@ gh pr create \
382382
--base "${default_branch}" \
383383
--title "ci: add Squad agentic workflow" \
384384
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
385-
gh pr edit --add-reviewer @copilot
385+
386+
# Copilot's review identity is a GraphQL Bot, not a User/Team — the REST
387+
# `gh pr edit --add-reviewer @copilot` path silently no-ops for it. Request the
388+
# review through the verified GraphQL path instead:
389+
pr_node_id="$(gh pr view --json id --jq '.id')"
390+
gh api graphql -f query='
391+
mutation($pr: ID!) {
392+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
393+
pullRequest { number }
394+
}
395+
}' -f pr="${pr_node_id}" || echo "Could not request a Copilot review via GraphQL; open the PR in the GitHub UI and add Copilot as a reviewer manually (Reviewers -> Copilot)." >&2
386396
gh pr checks --watch
387397
```
388398

389399
- Open the PR against the **runtime-captured** `${default_branch}`, not a hardcoded
390400
`main`.
391-
- Request Copilot review, address feedback, and wait for required checks.
401+
- Request Copilot review via the GraphQL `requestReviewsByLogin` mutation
402+
(never the REST `--add-reviewer` shortcut, which silently no-ops for the
403+
Copilot Bot reviewer), address feedback, and wait for required checks. If
404+
the GraphQL call fails, add Copilot as a reviewer manually from the PR's
405+
GitHub UI.
392406

393407
### 9. Verify the native review contract after merge
394408

@@ -497,7 +511,13 @@ git push -u origin HEAD
497511
gh pr create --base "${default_branch}" \
498512
--title "ci: add Squad agentic workflow" \
499513
--body "Installs and strictly compiles the supported Squad GH-AW workflows."
500-
gh pr edit --add-reviewer @copilot # then wait for review + checks; DO NOT merge
514+
pr_node_id="$(gh pr view --json id --jq '.id')"
515+
gh api graphql -f query='
516+
mutation($pr: ID!) {
517+
requestReviewsByLogin(input: { pullRequestId: $pr, botLogins: ["copilot-pull-request-reviewer"] }) {
518+
pullRequest { number }
519+
}
520+
}' -f pr="${pr_node_id}" # Bot-aware review request; then wait for review + checks; DO NOT merge
501521
```
502522

503523
### ✓ Correct: STOP on an undocumented safe-update entry

‎workflows/squad-workflows.manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
"name": "gh-aw-enlistment",
226226
"source": "workflows/skills/gh-aw-enlistment/SKILL.md",
227227
"destination": ".github/skills/gh-aw-enlistment/SKILL.md",
228-
"sha256": "fc6b63c3156d7861d28fcf459abee9e7f041d3581516ec38a684d5a902a27ac5"
228+
"sha256": "dcf8b2975ecfd049f1689a4f68c183b074cebbd7455c19af680e25af673f1c5c"
229229
}
230230
],
231231
"bootstrap": {

0 commit comments

Comments
 (0)