Skip to content

SDK permission callback binding lost in headless mode after reconnections #300

@PureWeen

Description

@PureWeen

Problem

The copilot SDK's internal permission system returns denied-no-approval-rule-and-could-not-request-from-user when the permission callback binding is lost in headless persistent mode. PolyPilot correctly sets AutoApprovePermissions on all session configs, but the headless server loses the binding after reconnections.

Symptoms

  • Tool executions return "Permission denied and could not request permission from user"
  • Intermittent — happens after the persistent server has been running for a while
  • Pattern: 2-4 consecutive denials, sometimes with an OK interspersed

Current workaround

Root cause

SDK source at /opt/homebrew/lib/node_modules/@github/copilot/sdk/index.js:

  • pW() handles permission results, Fmr() handles the no-approval-rule case
  • The permission callback registered via OnPermissionRequest appears to be lost server-side

Desired fix

Fix the SDK to maintain the permission callback binding across reconnections in headless mode. This would eliminate the need for client-side detection and recovery.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternalUpstream bug or dependency issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions