Skip to content

https://github.com/github/copilot-sdk/issues/251#issuecomment-3906728084 #506

@hugoo0

Description

@hugoo0

We traced this to initializeSession in the CLI. The chain:

  1. SDK sends session.create with customAgents: [...] → CLI sets this.customAgents correctly
  2. initializeSession() then calls updateOptions() multiple times for each feature callback (external tools, permission request, user input request, hooks) — none of these calls include the customAgents key
  3. Inside updateOptions, when e.customAgents !== void 0 is false (i.e. key absent), it fires this.loadCustomAgents()
  4. loadCustomAgents() with Copilot auth (provider is falsy, authInfo is set) fetches org/enterprise agents from the GitHub API → returns [] → overwrites this.customAgents

Each updateOptions call without customAgents triggers a fresh loadCustomAgents(), so the overwrite can happen multiple times.

Workaround until issue is fixed: Removing enableUserInputCallback and enableHooksCallback from the session config skips the updateOptions calls that trigger the overwrite, which remediated the issue for us.

Suggested fix: Skip loadCustomAgents() when agents were explicitly provided at session creation, or (b) pass customAgents through in every updateOptions call from initializeSession.

@knifeyspoony - Is this workaround applicable for DOTNET SDK as well? Also, did you notice any side effects of this workaround?

Originally posted by @ShrayRastogi in #251

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions