-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Bug Report
Reported by: EMU (Enterprise Managed User) account users
Description
EMU users are reporting that /share gist fails with a rate limit error when attempting to create a secret gist:
✗ Failed to share session: HttpError: Rate Limit Exceeded - https://docs.github.com/rest
Analysis
The /share gist flow in src/cli/commands/slashCommands.ts calls shareSessionToGist() which uses the user's OAuth token (obtained via device flow with scope read:user,read:org,repo,gist) to create a gist via POST /gists through Octokit in src/cli/github/client.ts.
The current getGistToken() validation checks:
- User is logged in
- Host is not
*.ghe.com(GHE Cloud with data residency) - Token is non-null
There is no EMU-specific handling. EMU accounts on github.com pass all three checks, but may be subject to enterprise policies that restrict gist creation or impose different rate limits. The GitHub API may return a misleading "Rate Limit Exceeded" error instead of a clear 403/policy error.
Relevant Code
src/cli/commands/slashCommands.ts—getGistToken()(line ~2909) andexecuteShareGistCommand()(line ~2959)src/cli/github/client.ts—createGist()(line ~160)src/core/github/gitHubApi.ts— OAuth scope:read:user,read:org,repo,gist(line ~65)
Questions to Investigate
- Do EMU enterprise policies block gist creation, and does the API surface this as a rate limit error?
- Should we detect EMU accounts and show a more helpful error message (e.g., "Your enterprise may restrict gist creation — try
/share fileinstead")? - Is the Copilot CLI OAuth token treated differently for EMU users w.r.t. API rate limits?
Reproduction
- Log in to Copilot CLI with an EMU account on
github.com - Start a session and have some conversation
- Run
/share gist - Observe "Rate Limit Exceeded" error
Expected Behavior
Either gist creation succeeds, or the user gets a clear, actionable error message explaining why it failed (e.g., enterprise policy restriction) with a suggestion to use /share file as a fallback.