-
Notifications
You must be signed in to change notification settings - Fork 1.6k
graphql query to detect partner agents #2775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add GraphQL queries for fetching assignable actors (suggestedActors and assignableUsers APIs) - Add getAssignableActors method to IOctoKitService interface - Implement dynamic partner agent detection in CopilotCloudSessionsProvider - Add caching mechanism to avoid repeated API calls - Update known Copilot agent logins based on spec - Fall back to hardcoded list when API is unavailable Co-authored-by: joshspicer <[email protected]>
Co-authored-by: joshspicer <[email protected]>
- Create COPILOT_AGENT_METADATA mapping for known Copilot agent logins - Look up `at` values from HARDCODED_PARTNER_AGENTS when available - Preserve the `at` field structure from the hardcoded list Co-authored-by: joshspicer <[email protected]>
- Delete COPILOT_AGENT_METADATA mapping - Simplify getAvailablePartnerAgents to check HARDCODED_PARTNER_AGENTS directly - Check if agent ID or name matches assignable actors - Preserve all fields from HARDCODED_PARTNER_AGENTS including `at` values Co-authored-by: joshspicer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds GraphQL query functionality to detect partner agents (like Copilot, Claude, and Codex) that are available for assignment in a repository. The implementation queries GitHub's assignable actors API to determine which hardcoded partner agents should be shown to users.
Key Changes:
- Adds GraphQL queries to fetch assignable actors from GitHub API with fallback support for older GitHub Enterprise Server instances
- Implements caching of partner agent availability per repository
- Integrates the detection logic into the Copilot Cloud sessions provider to filter available agents
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/platform/github/common/githubAPI.ts |
Adds AssignableActor interface and two new GraphQL query functions for fetching assignable actors with pagination support |
src/platform/github/common/githubService.ts |
Adds getAssignableActors method to the IOctoKitService interface and makes base service properties protected for subclass access |
src/platform/github/common/octoKitServiceImpl.ts |
Implements getAssignableActors with auth handling and fallback logic from suggestedActors to assignableUsers API |
src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts |
Adds assignableActorLogin to partner agents config, implements caching and filtering logic to show only available agents |
src/extension/agents/vscode-node/test/organizationAndEnterpriseAgentProvider.spec.ts |
Updates mock to include stub implementation of new getAssignableActors method |
Comments suppressed due to low confidence (1)
src/platform/github/common/githubAPI.ts:481
- The error handling in the GraphQL query functions doesn't distinguish between different failure modes. When
makeGitHubGraphQLRequestreturns undefined (which happens on non-OK responses or JSON parse errors), the function silently breaks out of the loop and returns whatever actors were accumulated so far. This could lead to incomplete results being cached and used without any indication that the fetch was partial or failed.
Consider logging when a partial result is returned, or propagating the error so callers know the operation didn't complete successfully.
const result = await makeGitHubGraphQLRequest(fetcherService, logService, telemetry, host, query, token, variables);
if (!result?.data?.repository?.suggestedActors) {
break;
}
src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts
Outdated
Show resolved
Hide resolved
| if (!result?.data?.repository?.assignableUsers) { | ||
| break; | ||
| } | ||
|
|
||
| const data = result.data.repository.assignableUsers; |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling in the GraphQL query functions doesn't distinguish between different failure modes. When makeGitHubGraphQLRequest returns undefined (which happens on non-OK responses or JSON parse errors), the function silently breaks out of the loop and returns whatever actors were accumulated so far. This could lead to incomplete results being cached and used without any indication that the fetch was partial or failed.
Consider logging when a partial result is returned, or propagating the error so callers know the operation didn't complete successfully.
This issue also appears in the following locations of the same file:
- line 477
| if (!result?.data?.repository?.assignableUsers) { | |
| break; | |
| } | |
| const data = result.data.repository.assignableUsers; | |
| if (!result) { | |
| logService.warn('[githubAPI] GitHub GraphQL request for assignableUsers returned no result; returning partial list of assignable actors.'); | |
| telemetry.publicLog2?.('githubAPI.assignableUsers.partialResult', { reason: 'noResult' }); | |
| break; | |
| } | |
| const assignableUsers = result.data?.repository?.assignableUsers; | |
| if (!assignableUsers) { | |
| logService.warn('[githubAPI] GitHub GraphQL response for assignableUsers was missing data; returning partial list of assignable actors.'); | |
| telemetry.publicLog2?.('githubAPI.assignableUsers.partialResult', { reason: 'missingAssignableUsers' }); | |
| break; | |
| } | |
| const data = assignableUsers; |
|
@joshspicer I've opened a new pull request, #2776, to work on those changes. Once the pull request is ready, I'll request review from you. |
…vider.ts Co-authored-by: Copilot <[email protected]>
…code-copilot-chat into joshspicer/agents-partner-2
related microsoft/vscode#286170