Normalize scalar allowed-repos in GitHub guard policies by Copilot · Pull Request #70346 · github/gh-aw · GitHub
Skip to content

Normalize scalar allowed-repos in GitHub guard policies - #70346

Open
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-allowed-repos-policy-issue
Open

pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-allowed-repos-policy-issue

Conversation

Copilot AI commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

A single repository string in tools.github.allowed-repos passed strict compilation but produced a policy rejected by gh-proxy at startup.

  • Policy generation: Wrap non-keyword strings in one-element arrays across MCP gateway, CLI proxy, and DIFC proxy policies.
  • Compatibility: Preserve all, public, and existing arrays; apply the same normalization to the deprecated repos alias.
  • Regression coverage: Cover repository names, wildcard patterns, expressions, keywords, and lists across all three policy builders.

For allowed-repos: ${{ github.repository }}, the generated policy becomes:

{"allow-only":{"min-integrity":"approved","repos":["${{ github.repository }}"]}}

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix allowed-repos policy rejection at start-up Normalize scalar allowed-repos in GitHub guard policies Oct 19, 2026
Copilot AI requested a review from pelikhan October 19, 2026 19:54
@pelikhan
pelikhan marked this pull request as ready for review October 19, 2026 20:11
Copilot AI max review requested due to automatic review settings October 19, 2026 20:11
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · haiku45 · 4.4 AIC · ⌖ 15.1 AIC · ◇ 1.72 AIC · ⊞ 9.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · gpt56 · 5.8 AIC · ⌖ 5.43 AIC · ⊞ 14.7K · ◷

Generated by Ponytail Reviewer for #70346

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd (bug-fix classification: scalar allowed-repos values were not normalized to arrays before being handed to gh-proxy, which produced a policy string instead of the array gh-proxy expects).

📋 Analysis

Root cause fix

The fix in tools_validation_github.go is precise: normalizeGitHubRepositoryInReposScope now wraps any non-keyword scalar string (owner/repo, owner/*, and the ${{ github.repository }} expression) in a one-element array, while still passing through the all/public keywords unchanged. This matches the root cause described in the linked issue (#70267) rather than papering over a single symptom.

Test coverage (/tdd)

TestGitHubGuardPolicyRepositoryScopes is a strong addition: it exercises both field aliases (allowed-repos/repos), the all/public keywords, the ${{ github.repository }} expression, owner wildcards, prefix wildcards, plain []string and []any YAML-parsed lists -- and runs every case through all three policy builders (MCP gateway, CLI proxy, DIFC proxy) via table-driven subtests. That's exactly the kind of regression coverage that should prevent this class of bug from resurfacing, and the existing hardcoded-JSON assertions in compiler_difc_proxy_test.go / copilot_github_mcp_test.go were correctly updated in lockstep.

Scope

Checked for silent breakage in related call sites (deriveSafeOutputsGuardPolicyFromGitHub, transformRepoPattern, enclave guard-policy builders, docs) -- none depend on the unwrapped scalar shape, so this change is safely isolated to the three policy builders it targets.

No actionable issues found -- this is a tightly scoped, well-tested fix. Approving.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 73.9 AIC · ⌖ 14.8 AIC · ⊞ 10.1K
Comment /matt to run again

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The localized fix preserves supported inputs and includes targeted regression coverage, with no blocking issues identified.

No open issues 🎉

What changed in this PR

Fixes #70267 by normalizing scalar repository scopes in gh-aw’s generated guard policies, preventing proxy startup rejection.

Changes:

  • Wraps non-keyword strings in arrays while preserving all, public, and existing lists.
  • Covers both allowed-repos and deprecated repos across all three policy builders.
File Description
pkg/​workflow/​tools_validation_github.go Normalizes scalar repository scopes.
pkg/​workflow/​copilot_github_mcp_test.go Updates the expected repository policy format.
pkg/​workflow/​compiler_difc_proxy_test.go Adds cross-builder regression coverage and updates expectations.

Review effort: Max

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check agent (FAILURE): https://github.com/github/gh-aw/actions/runs/39317229982/job/118282483337.
  3. Fix failing check conclusion (FAILURE): https://github.com/github/gh-aw/actions/runs/39317229982/job/118284573134.

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: 3698c90
Sous-chef work: 34f38971738f6a752a646bd7797a6c8d47fb096e4eb6f91e946a91255433c8c4 51e2287c3d1ee41b7e13769862add61dcd292a623cf943abc5968c984e246bcf
Sous-chef state: a8c4e29663a236855b524ab618a71db25ae3f5a4b4b7599f5cbc597c7fd72542

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 11.4 AIC · ⌖ 6.82 AIC · ⊞ 1.1K · ◷
Comment /souschef to run again

…epos-policy-issue

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes....

Merged current main in b3dfabc. The failed agent run used unavailable copilot/gpt-5.4; main now updates the PR Code Quality Reviewer to copilot/gpt-5, and conclusion was downstream of that agent failure. Local focused guard-policy tests and make lint pass. The progress gate’s impacted tests pass, but its custom linter reports existing findings in tools_validation_github.go also present on main. No review threads were open to resolve. CI was not triggered; a maintainer must re-run it.

@pelikhan

Copy link
Copy Markdown
Collaborator

update spec

@pelikhan

Copy link
Copy Markdown
Collaborator

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allowed-repos as a single repository string compiles, but gh-proxy rejects the policy at start-up

4 participants