Skip to content

docs: Add Permission Handling section to all language READMEs#1

Merged
jamesmontemagno merged 1 commit intoupdate-readmes-with-permsfrom
copilot/update-readmes-for-permissions
Mar 17, 2026
Merged

docs: Add Permission Handling section to all language READMEs#1
jamesmontemagno merged 1 commit intoupdate-readmes-with-permsfrom
copilot/update-readmes-for-permissions

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 17, 2026

onPermissionRequest is a required parameter when creating or resuming sessions, but it was undocumented in the config tables and absent from all Quick Start examples — causing confusing runtime errors for new users.

Changes

  • All 4 READMEs (Node.js, Go, Python, .NET)
    • New ## Permission Handling section covering: built-in approve-all helper, custom per-kind handlers, result kind reference table, resume session usage, and cross-reference to per-tool skipPermission
    • Added onPermissionRequest / OnPermissionRequest / on_permission_request as Required in SessionConfig and ResumeSessionConfig docs
    • Updated Quick Start examples to include the required handler

Per-language API

Language Approve-all helper Custom handler type
Node.js approveAll (request, invocation) => PermissionRequestResult
Go copilot.PermissionHandler.ApproveAll PermissionHandlerFunc
.NET PermissionHandler.ApproveAll PermissionRequestHandler delegate
Python PermissionHandler.approve_all sync or async callable

Example (Go):

session, err := client.CreateSession(ctx, &copilot.SessionConfig{
    Model:               "gpt-5",
    OnPermissionRequest: copilot.PermissionHandler.ApproveAll, // or custom handler
})

// Custom: deny shell commands, approve everything else
OnPermissionRequest: func(req copilot.PermissionRequest, _ copilot.PermissionInvocation) (copilot.PermissionRequestResult, error) {
    if req.Kind == copilot.KindShell {
        return copilot.PermissionRequestResult{Kind: copilot.PermissionRequestResultKindDeniedInteractivelyByUser}, nil
    }
    return copilot.PermissionRequestResult{Kind: copilot.PermissionRequestResultKindApproved}, nil
},

Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com>
@jamesmontemagno jamesmontemagno changed the base branch from main to update-readmes-with-perms March 17, 2026 22:01
@jamesmontemagno jamesmontemagno marked this pull request as ready for review March 17, 2026 22:01
@jamesmontemagno jamesmontemagno merged commit 7ce5033 into update-readmes-with-perms Mar 17, 2026
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