Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 31, 2025

Under-provisioned GitHub MCP permissions previously always failed compilation. Users now get actionable warnings in non-strict mode with suggestions to either add missing permissions or reduce toolset requirements.

Changes

  • Compiler behavior (compiler.go): Under-provisioned permissions emit warnings in non-strict mode, errors in strict mode
  • Warning format (permissions_validator.go): Messages now include two fix options:
    • Add missing permissions to frontmatter
    • Reduce toolsets to match available permissions
  • Tests (permissions_warning_test.go): Coverage for both warning and error modes

Example

Workflow with insufficient permissions:

---
permissions:
  contents: read
tools:
  github:
    toolsets: [repos, issues, pull_requests]
    read-only: false
---

Non-strict mode (default):

warning: Missing required permissions for github toolsets:
  - contents: write (required by repos)
  - issues: write (required by issues)
  - pull-requests: write (required by pull_requests)

To fix this, you can either:

Option 1: Add missing permissions to your workflow frontmatter:
permissions:
  contents: write
  issues: write
  pull-requests: write

Option 2: Reduce the required toolsets in your workflow:
Remove or adjust toolsets that require these permissions:
  - issues
  - pull_requests
  - repos

✓ Compiled 1 workflow(s): 0 error(s), 1 warning(s)

Strict mode (--strict):

error: Missing required permissions for github toolsets:
  ... (same message) ...

✗ Compiled 1 workflow(s): 1 error(s), 0 warning(s)
Original prompt

Treat under provisioned permissions as a warning in non-script mode. Suggest to add missing permissions or reduce the required toolsets.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Oct 31, 2025
Copilot AI and others added 3 commits October 31, 2025 03:04
…n non-strict mode

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Treat under provisioned permissions as a warning in non-script mode Treat under-provisioned permissions as warnings in non-strict mode Oct 31, 2025
Copilot AI requested a review from pelikhan October 31, 2025 03:22
@pelikhan pelikhan marked this pull request as ready for review October 31, 2025 04:11
Copilot AI review requested due to automatic review settings October 31, 2025 04:11
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR changes how the compiler handles under-provisioned GitHub permissions for MCP toolsets. Previously, workflows with insufficient permissions always failed compilation. Now, non-strict mode emits actionable warnings that suggest either adding missing permissions or reducing toolset requirements, while strict mode continues to fail with errors.

Key Changes:

  • Non-strict mode treats missing permissions as warnings instead of errors
  • Warning messages now provide two concrete fix options with examples
  • Strict mode behavior unchanged (still fails compilation)

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/workflow/compiler.go Adds conditional logic to emit warnings in non-strict mode vs errors in strict mode for missing permissions
pkg/workflow/permissions_validator.go Enhances warning message format to include both "add permissions" and "reduce toolsets" options
pkg/workflow/permissions_validator_test.go Updates test expectations to match new warning message format
pkg/workflow/permissions_warning_test.go New comprehensive test suite covering warning/error behavior in both strict and non-strict modes
.github/workflows/example-permissions-warning.md Example workflow demonstrating the new warning behavior with documentation

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

@pelikhan pelikhan enabled auto-merge (squash) October 31, 2025 04:13
@pelikhan pelikhan merged commit 9bf9ee9 into main Oct 31, 2025
47 checks passed
@pelikhan pelikhan deleted the copilot/warn-under-provisioned-permissions branch October 31, 2025 04:13
github-actions bot added a commit that referenced this pull request Oct 31, 2025
This PR updates the documentation based on features merged in the last 24 hours.

## Documentation Updates

### Custom Agent Files (PR #2838, #2837)
- Added comprehensive documentation for custom agent files in the AI Engines reference
- Documented the new imports-based approach for agent files
- Provided migration guide from deprecated `engine.custom-agent` field
- Included examples of creating and using custom agents

### Permission Validation (PR #2843)
- Documented new permission validation behavior in non-strict mode
- Added examples of warning messages when permissions are under-provisioned
- Explained the difference between non-strict and strict mode validation
- Provided actionable guidance for resolving permission warnings

### Agent File Imports (PR #2838)
- Updated Imports reference to explain agent file imports
- Clarified that only one agent file can be imported per workflow
- Cross-referenced Custom Agent Files documentation in Engines reference

## Changes Made

- Updated `docs/src/content/docs/reference/engines.md`:
  - Added "Custom Agent Files" section with creation and usage examples
  - Documented agent file requirements and constraints
  - Provided migration guide from `engine.custom-agent` to `imports`

- Updated `docs/src/content/docs/reference/frontmatter.md`:
  - Added "Permission Validation" subsection under Permissions
  - Documented non-strict mode warning behavior
  - Documented strict mode error behavior
  - Included example warning messages

- Updated `docs/src/content/docs/reference/imports.md`:
  - Added "Agent Files" section
  - Updated "Frontmatter Merging" to mention agent file fields

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants