Skip to content

docs: surface allowed-teams in agentic mentions config docs#40421

Merged
pelikhan merged 2 commits into
mainfrom
copilot/awf-feature-surfacing-surface-allowed-teams
Jun 20, 2026
Merged

docs: surface allowed-teams in agentic mentions config docs#40421
pelikhan merged 2 commits into
mainfrom
copilot/awf-feature-surfacing-surface-allowed-teams

Conversation

Copilot AI commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

The allowed-teams option added to safe-outputs.mentions in #40368 was missing from .github/aw/safe-outputs-runtime.md — the doc surface agents read when authoring workflows — meaning agents had no way to discover or use the feature.

Changes

  • .github/aw/safe-outputs-runtime.md — updated the mentions: entry:
    • Added allowed-teams: to the YAML example with both resolution formats
    • Added prose on runtime team-membership resolution, bot exclusion, and org/team-slug vs bare team-slug semantics
    • Added read:org scope caveat with token alternatives (github-token: / github-app:) and graceful-degradation behavior
safe-outputs:
  mentions:
    allow-team-members: true
    allow-context: true
    allowed: [copilot, user1]
    allowed-teams:               # Allow all members of named GitHub teams
      - myorg/eng                # org/team-slug format (cross-org)
      - reviewers                # bare team-slug (uses current repo's org)
    max: 50

allowed-teams requires read:org scope. GITHUB_TOKEN does not include it; supply a PAT, fine-grained PAT with "Members" read, or a GitHub App token. On failure the workflow continues without those team members in the allowlist.

…-runtime.md

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Surface allowed-teams mentions option in agentic docs docs: surface allowed-teams in agentic mentions config docs Jun 20, 2026
Copilot AI requested a review from pelikhan June 20, 2026 03:44
@pelikhan pelikhan marked this pull request as ready for review June 20, 2026 05:36
Copilot AI review requested due to automatic review settings June 20, 2026 05:36
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #40421 does not have the 'implementation' label and has 0 new lines of code in business logic directories (only 1 file changed, a docs/markdown update).

@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped.

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.

Pull request overview

Updates the safe-outputs runtime reference documentation to surface the previously-added safe-outputs.mentions.allowed-teams option so workflow authors (and agents) can discover and use team-based mention allowlisting.

Changes:

  • Adds allowed-teams to the safe-outputs.mentions YAML example.
  • Documents runtime team membership resolution semantics (org-qualified vs bare slugs, bot exclusion).
  • Documents the read:org requirement and token alternatives, including graceful-degradation behavior.
Show a summary per file
File Description
.github/aw/safe-outputs-runtime.md Documents mentions.allowed-teams usage, semantics, and required token scope for runtime resolution.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment on lines 151 to +153
- Team members include collaborators with any permission level (excluding bots unless explicitly listed)
- Context mentions include issue/PR authors, assignees, and commenters
- `allowed-teams` resolves team membership from the GitHub API at runtime; bot accounts are excluded. Use `org/team-slug` for cross-org teams or a bare `team-slug` to resolve against the current repository's organization.
- Team members include collaborators with any permission level (excluding bots unless explicitly listed)
- Context mentions include issue/PR authors, assignees, and commenters
- `allowed-teams` resolves team membership from the GitHub API at runtime; bot accounts are excluded. Use `org/team-slug` for cross-org teams or a bare `team-slug` to resolve against the current repository's organization.
- **`allowed-teams` requires `read:org` scope.** The default `GITHUB_TOKEN` does **not** include this scope. Provide a classic PAT with `read:org`, a fine-grained PAT with the "Members" permission (read), or a GitHub App installation token with the "Members" permission (read) via `safe-outputs.github-token:` or `safe-outputs.github-app:`. If the token lacks the required scope, team lookup fails with a warning and the workflow continues without those team members in the allowlist.
@github-actions github-actions Bot mentioned this pull request Jun 20, 2026

@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 /grill-with-docs — approving with two minor suggestions.

📋 Key Themes & Highlights

Suggestions

  • Line 146 — (cross-org) label: org/team-slug is the fully-qualified form that works for any org (including the current one), not only cross-org situations. A label like # fully-qualified form (works for any org) is more accurate.
  • Line 154 — dense scope-caveat bullet: The single bullet covers scope requirement, GITHUB_TOKEN limitation, three token alternatives, and graceful-degradation in one sentence. Splitting into two bullets would match the existing doc style and be easier to parse.

Positive Highlights

  • ✅ Both resolution formats (org/team-slug and bare team-slug) shown with inline comments
  • read:org scope requirement and all three token alternatives clearly documented
  • ✅ Graceful-degradation behaviour captured — agents know the workflow won't fail on missing scope
  • ✅ Terminology (safe-outputs.github-token:, safe-outputs.github-app:) is consistent with existing doc entries

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 61.3 AIC · ⌖ 7.4 AIC · ⊞ 6.9K

allow-context: true # Allow mentions from event context (default: true)
allowed: [copilot, user1] # Always allow specific users/bots
allowed-teams: # Allow all members of named GitHub teams
- myorg/eng # org/team-slug format (cross-org)

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.

[/grill-with-docs] The (cross-org) label is slightly misleading: org/team-slug is the fully-qualified form that works for any org, not only cross-organization ones — you'd write myorg/eng even when your repo already lives in myorg.\n\n

\n💡 Suggested wording\n\nyaml\n - myorg/eng # fully-qualified form (works for any org)\n - reviewers # bare team-slug (resolves against current repo's org)\n\n\nThe current (cross-org) label could lead an agent to believe org/team-slug is only for cross-organization scenarios, rather than the general explicit-qualifier form.\n\n

- Team members include collaborators with any permission level (excluding bots unless explicitly listed)
- Context mentions include issue/PR authors, assignees, and commenters
- `allowed-teams` resolves team membership from the GitHub API at runtime; bot accounts are excluded. Use `org/team-slug` for cross-org teams or a bare `team-slug` to resolve against the current repository's organization.
- **`allowed-teams` requires `read:org` scope.** The default `GITHUB_TOKEN` does **not** include this scope. Provide a classic PAT with `read:org`, a fine-grained PAT with the "Members" permission (read), or a GitHub App installation token with the "Members" permission (read) via `safe-outputs.github-token:` or `safe-outputs.github-app:`. If the token lacks the required scope, team lookup fails with a warning and the workflow continues without those team members in the allowlist.

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.

[/grill-with-docs] This bullet does a lot of work in one sentence: scope requirement, GITHUB_TOKEN limitation, three token alternatives, and graceful-degradation behaviour. Consider splitting it for easier agent and human parsing.\n\n

\n💡 Suggested split\n\nmarkdown\n - **`allowed-teams` requires `read:org` scope.** The default `GITHUB_TOKEN` does **not** include this scope; supply a classic PAT with `read:org`, a fine-grained PAT with the "Members" permission (read), or a GitHub App installation token with the "Members" permission (read) via `safe-outputs.github-token:` or `safe-outputs.github-app:`.\n - If the token lacks `read:org`, team lookup fails with a warning and the workflow continues without those team members in the allowlist (graceful degradation).\n\n\nThis mirrors the existing doc style where requirement and fallback behaviour are separate bullets.\n\n

@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.

🔎 Code quality review by PR Code Quality Reviewer · 122.9 AIC · ⌖ 7.83 AIC · ⊞ 5.1K


- Team members include collaborators with any permission level (excluding bots unless explicitly listed)
- Context mentions include issue/PR authors, assignees, and commenters
- `allowed-teams` resolves team membership from the GitHub API at runtime; bot accounts are excluded. Use `org/team-slug` for cross-org teams or a bare `team-slug` to resolve against the current repository's organization.

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.

org/team-slug is mislabeled as a "cross-org" format — it is the fully-qualified format that works for any org (same or different), and restricting its description to cross-org will cause agents to avoid it for same-org teams.

💡 Suggested fix

The current prose:

Use org/team-slug for cross-org teams or a bare team-slug to resolve against the current repository's organization.

Should read something like:

Use the fully-qualified org/team-slug form for explicit org targeting (or when the same team-slug exists in multiple orgs), or a bare team-slug to implicitly resolve against the current repository's organization.

The inline YAML comment on the myorg/eng example (# org/team-slug format (cross-org)) has the same problem — update to # fully-qualified org/team-slug format.

Why it matters for agents: An agent following this doc will only use org/team-slug when it knows it's targeting a different org, defaulting to bare slugs otherwise. If the same slug resolves differently across orgs the token has access to, or the author simply wants explicit org binding, they have no signal from this doc that the qualified form is valid for their case.

- Team members include collaborators with any permission level (excluding bots unless explicitly listed)
- Context mentions include issue/PR authors, assignees, and commenters
- `allowed-teams` resolves team membership from the GitHub API at runtime; bot accounts are excluded. Use `org/team-slug` for cross-org teams or a bare `team-slug` to resolve against the current repository's organization.
- **`allowed-teams` requires `read:org` scope.** The default `GITHUB_TOKEN` does **not** include this scope. Provide a classic PAT with `read:org`, a fine-grained PAT with the "Members" permission (read), or a GitHub App installation token with the "Members" permission (read) via `safe-outputs.github-token:` or `safe-outputs.github-app:`. If the token lacks the required scope, team lookup fails with a warning and the workflow continues without those team members in the allowlist.

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.

Three precision gaps in the scope/permissions caveat sentence that will cause agents to misread this when creating tokens or diagnosing failures.

💡 Breakdown and suggested fix

1. read:org "scope" conflation across token types

The sentence leads with "allowed-teams requires read:org scope" and then lists fine-grained PATs and GitHub Apps. Classic PATs use OAuth scopes (read:org); fine-grained PATs and GitHub App installation tokens use permissions, not scopes. An agent creating a fine-grained PAT will look for a read:org scope entry in the GitHub UI and not find one.

Suggested split:

  • Classic PAT: read:org scope
  • Fine-grained PAT: organization Members permission (read)
  • GitHub App: organization Members permission (read)

2. Fine-grained PAT "Members" needs "organization-level" qualifier

GitHub fine-grained PATs separate repository-level and organization-level permissions. "Members" exists only under organization permissions, not repository permissions. Without the qualifier, an agent enabling permissions for a fine-grained PAT will look in the wrong section.

3. Graceful degradation is stated only for scope failure, not team-not-found

"If the token lacks the required scope, team lookup fails with a warning and the workflow continues without those team members in the allowlist."

This implies graceful degradation is scoped only to auth failures. A typo in a team slug (reviewes instead of reviewers) also silently produces no members with no hard error. Agents have no guidance that a misconfigured slug produces an identical silent outcome and cannot be detected from workflow failure alone. The sentence should generalize: "If team lookup fails for any reason (missing scope, non-existent team, rate limit), the workflow continues..."

@pelikhan pelikhan merged commit e1d2f30 into main Jun 20, 2026
46 checks passed
@pelikhan pelikhan deleted the copilot/awf-feature-surfacing-surface-allowed-teams branch June 20, 2026 05:58
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.

3 participants