Distinguish Copilot licensing errors from GitHub App permission errors#108565
Merged
Distinguish Copilot licensing errors from GitHub App permission errors#108565
Conversation
When GitHub Copilot returns a 403 with "not licensed to use Copilot", the user's account lacks an active Copilot subscription — not a GitHub App permissions issue. Previously, all Copilot 403s were treated as `github_app_permissions` failures, which caused the "Update GitHub App Permissions" modal to be shown incorrectly. Now, 403 responses containing "not licensed" are surfaced as a `generic` failure with a clear licensing message, so the permissions modal is only shown for actual GitHub App permission issues. https://claude.ai/code/session_01AjW2wHdpAqzdugENctTaib
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
The same Copilot 403 handling bug existed in the explorer path
(coding_agent_handoff.py). Licensing errors ("not licensed to use
Copilot") were incorrectly classified as github_app_permissions,
showing the permissions modal instead of a licensing message.
https://claude.ai/code/session_01AjW2wHdpAqzdugENctTaib
sehr-m
approved these changes
Feb 19, 2026
| patch("sentry.seer.autofix.coding_agent.store_coding_agent_states_to_seer"), | ||
| ): | ||
| response = self.get_success_response(self.organization.slug, method="post", **data) | ||
| assert response.data["success"] is True |
Member
There was a problem hiding this comment.
Success should be true and failed count > 1?
success: True when all repos fail is misleading. Change success to be len(successes) > 0 so it's False when no agents launched, and update test assertions accordingly. https://claude.ai/code/session_01AjW2wHdpAqzdugENctTaib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR improves error handling for GitHub Copilot integration failures by distinguishing between two different types of 403 errors:
failure_type: "generic"with a user-friendly message about the missing license.failure_type: "github_app_permissions"to trigger the permissions modal.Previously, all 403 errors were treated as permission issues, which could confuse users whose actual problem was a missing Copilot license rather than app permissions.
Changes
src/sentry/seer/autofix/coding_agent.py: Added logic to check the error message for "not licensed" text when handling 403 responses. If found, treat it as a generic licensing error; otherwise, treat it as a GitHub App permissions issue.tests/sentry/integrations/api/endpoints/test_organization_coding_agents.py: Added test casetest_copilot_not_licensed_403_returns_generic_failure_typeto verify that licensing-related 403 errors return the correct failure type and error message.Test Plan
The new test case verifies that:
failure_type: "generic"Existing tests continue to pass, ensuring backward compatibility with GitHub App permission error handling.
https://claude.ai/code/session_01AjW2wHdpAqzdugENctTaib