Problem
When a workflow runs on a pull_request event on a public repository, the MCP gateway's auto-default policy sets min-integrity: approved. However, the triggering PR itself typically has unapproved integrity (it hasn't been approved yet — that's usually what the workflow is trying to do). This creates a chicken-and-egg problem: the agent cannot read the PR it was triggered to review because the PR does not yet meet the minimum integrity threshold.
Observed Behavior
PR: github/gh-aw#23425
Workflow: Smoke Claude (PR review bot)
Run: https://github.com/github/gh-aw/actions/runs/23707807704
Review: github/gh-aw#23425 (review)
The review posted by the workflow contains:
🔒 Integrity filter blocked 1 item
The workflow auto-defaulted min-integrity to approved because gh-aw is a public repository:
Configured min-integrity: (not set)
min-integrity not configured — automatically setting to 'approved' for public repository
Root Cause
The integrity labeling chain works like this:
- Public repo → no explicit
min-integrity → auto-defaults to approved
- Triggering PR →
pull_request_read calls get_pull_request_facts → gets author_association → maps to integrity level
- Unreviewed PR → has
unapproved integrity (no approving review yet)
- Guard evaluates:
unapproved < approved → blocked
The guard logic in tool_rules.rs correctly assigns integrity based on review state:
merged → merged integrity
- Has approving review → approved integrity
- No approving review → unapproved (or contributor-floor based on author_association)
This is correct behavior for the guard, but creates a usability problem for PR-triggered workflows on public repos.
Impact
Any PR-triggered workflow on a public repo that:
- Does NOT explicitly set
min-integrity in its frontmatter
- Needs to read the triggering PR (which is almost all PR workflows)
...will have the triggering PR blocked by the auto-applied approved minimum integrity policy. This affects PR review bots, CI check workflows, and any workflow that reads PR content to generate feedback.
Proposed Fix
The fix should be in the MCP gateway (gh-aw-mcpg), specifically in the integrity filtering logic. The triggering context should receive special treatment:
Option A: Exempt the triggering PR from integrity filtering
When the guard evaluates pull_request_read for the same PR that triggered the workflow, it should bypass the min-integrity check. The rationale: the workflow was intentionally triggered by this PR event, so blocking it from reading the trigger defeats the purpose.
Implementation: The gateway already knows the triggering context via GITHUB_EVENT_NAME, GITHUB_EVENT_PATH, and the PR number from the event payload. When pull_request_read targets the same owner/repo#number as the triggering event, skip the integrity floor check.
Option B: Set triggering PR integrity to the workflow's own integrity level
Instead of exempting, set the triggering PR's integrity to match the workflow's configured min-integrity. This preserves the filtering semantics while ensuring the trigger is always readable.
Option C: Lower auto-default for PR-triggered workflows
When a workflow is triggered by pull_request, auto-default min-integrity to unapproved instead of approved. This is the simplest fix but reduces the security posture for all PR-triggered workflows on public repos.
Recommendation
Option A is recommended — it's the most targeted fix. The triggering event is the workflow's reason for existing; blocking it is always wrong regardless of integrity level. Options B and C have broader side effects.
Artifacts
Problem
When a workflow runs on a
pull_requestevent on a public repository, the MCP gateway's auto-default policy setsmin-integrity: approved. However, the triggering PR itself typically has unapproved integrity (it hasn't been approved yet — that's usually what the workflow is trying to do). This creates a chicken-and-egg problem: the agent cannot read the PR it was triggered to review because the PR does not yet meet the minimum integrity threshold.Observed Behavior
PR: github/gh-aw#23425
Workflow: Smoke Claude (PR review bot)
Run: https://github.com/github/gh-aw/actions/runs/23707807704
Review: github/gh-aw#23425 (review)
The review posted by the workflow contains:
The workflow auto-defaulted
min-integritytoapprovedbecausegh-awis a public repository:Root Cause
The integrity labeling chain works like this:
min-integrity→ auto-defaults toapprovedpull_request_readcallsget_pull_request_facts→ getsauthor_association→ maps to integrity levelunapprovedintegrity (no approving review yet)unapproved < approved→ blockedThe guard logic in
tool_rules.rscorrectly assigns integrity based on review state:merged→ merged integrityThis is correct behavior for the guard, but creates a usability problem for PR-triggered workflows on public repos.
Impact
Any PR-triggered workflow on a public repo that:
min-integrityin its frontmatter...will have the triggering PR blocked by the auto-applied
approvedminimum integrity policy. This affects PR review bots, CI check workflows, and any workflow that reads PR content to generate feedback.Proposed Fix
The fix should be in the MCP gateway (gh-aw-mcpg), specifically in the integrity filtering logic. The triggering context should receive special treatment:
Option A: Exempt the triggering PR from integrity filtering
When the guard evaluates
pull_request_readfor the same PR that triggered the workflow, it should bypass the min-integrity check. The rationale: the workflow was intentionally triggered by this PR event, so blocking it from reading the trigger defeats the purpose.Implementation: The gateway already knows the triggering context via
GITHUB_EVENT_NAME,GITHUB_EVENT_PATH, and the PR number from the event payload. Whenpull_request_readtargets the sameowner/repo#numberas the triggering event, skip the integrity floor check.Option B: Set triggering PR integrity to the workflow's own integrity level
Instead of exempting, set the triggering PR's integrity to match the workflow's configured min-integrity. This preserves the filtering semantics while ensuring the trigger is always readable.
Option C: Lower auto-default for PR-triggered workflows
When a workflow is triggered by
pull_request, auto-defaultmin-integritytounapprovedinstead ofapproved. This is the simplest fix but reduces the security posture for all PR-triggered workflows on public repos.Recommendation
Option A is recommended — it's the most targeted fix. The triggering event is the workflow's reason for existing; blocking it is always wrong regardless of integrity level. Options B and C have broader side effects.
Artifacts
guards/github-guard/rust-guard/src/labels/tool_rules.rs:191-230min-integrity: approvedfor public repos when not configured