Skip to content

Require onPermissionRequest handler, auto-inject via CopilotManager#10

Merged
kawax merged 2 commits intomainfrom
copilot/update-permission-request-handling
Feb 25, 2026
Merged

Require onPermissionRequest handler, auto-inject via CopilotManager#10
kawax merged 2 commits intomainfrom
copilot/update-permission-request-handling

Conversation

Copy link
Contributor

Copilot AI commented Feb 25, 2026

Follows official SDK PRs #554 and #555 — makes onPermissionRequest mandatory on session creation/resume. To avoid burdening Laravel users who call Copilot::run()/Copilot::start(), the Manager auto-injects PermissionHandler::approveAll() by default.

Changes

  • Client.createSession() / resumeSession() — config param is now required (no default), throws InvalidArgumentException if onPermissionRequest is missing. Always calls registerPermissionHandler() unconditionally.
  • CopilotClient contract — removed = [] defaults from createSession and resumeSession signatures
  • CopilotManager — new ensurePermissionHandler() injects PermissionHandler::approveAll() when handler is absent and config('copilot.permission_approve') is true
  • config/copilot.php — added permission_approve option (default true via COPILOT_PERMISSION_APPROVE env)
  • docs/jp/permission-request.md — rewritten to reflect auto-approve default, direct Client usage requirement, and custom-tool permission kind from PR #555

Usage

// Facade: works without explicit handler (auto-approved by default)
$response = Copilot::run(prompt: 'Hello');

// Direct Client: handler is required (matches official SDK)
$session = $client->createSession([
    'onPermissionRequest' => PermissionHandler::approveAll(),
]);

// Opt out of auto-approve via config
// config/copilot.php: 'permission_approve' => false

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/copilot_internal/user
    • Triggering command: /home/REDACTED/.local/bin/copilot copilot --headless --stdio --log-level info (http block)
    • Triggering command: /home/REDACTED/.local/bin/copilot copilot --headless --stdio --log-level info ash stty n/stty (http block)
    • Triggering command: /home/REDACTED/.local/bin/copilot copilot --headless --stdio --log-level info pilot-sdk/vendor/bin/stty stty ndor/bin/stty (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Client.createSession() and resumeSession() now require onPermissionRequest
  (matching official SDK PR #554)
- CopilotManager auto-injects PermissionHandler::approveAll() based on
  config('copilot.permission_approve') setting (default: true)
- Added permission_approve config option to config/copilot.php
- Updated CopilotClient contract to remove default params
- Updated docs/jp/permission-request.md documentation
- Added tests for missing permission handler validation
- Updated existing tests to provide onPermissionRequest handler

Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>
Copilot AI changed the title [WIP] Update permission request handling in SDK Require onPermissionRequest handler, auto-inject via CopilotManager Feb 25, 2026
Copilot AI requested a review from kawax February 25, 2026 03:11
@kawax kawax marked this pull request as ready for review February 25, 2026 03:48
@kawax kawax merged commit a438c6d into main Feb 25, 2026
5 checks passed
@kawax kawax deleted the copilot/update-permission-request-handling branch February 25, 2026 03:48
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