feat: poll for linked PR after assigning Copilot to issue#1810
Merged
SamMorrowDrums merged 8 commits intomainfrom Jan 16, 2026
Merged
feat: poll for linked PR after assigning Copilot to issue#1810SamMorrowDrums merged 8 commits intomainfrom
SamMorrowDrums merged 8 commits intomainfrom
Conversation
Enhances the assign_copilot_to_issue tool to automatically poll for the PR created by the Copilot coding agent after assignment. Changes: - Add findLinkedCopilotPR() to query issue timeline for CrossReferencedEvent items from PRs authored by copilot-swe-agent - Add polling loop (9 attempts, 1s delay) matching remote server latency - Return structured JSON with PR details when found, or helpful note otherwise - Add PollConfig for configurable polling (used in tests to disable) - Add GraphQLFeaturesTransport for feature flag header support The returned response now includes: - issue_number, issue_url, owner, repo - pull_request object (if found during polling) - Note with instructions to use get_copilot_job_status if PR not yet created
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the assign_copilot_to_issue tool to automatically poll for PRs created by Copilot after issue assignment, providing immediate feedback similar to the remote server's behavior. It introduces polling logic that attempts to find linked PRs up to 9 times with 1-second delays, and changes the response format from plain text to structured JSON.
Changes:
- Adds polling infrastructure with
PollConfigand context helpers for test configurability - Implements
findLinkedCopilotPR()to query issue timeline for PRs fromcopilot-swe-agentbot - Changes response format from plain text to JSON with PR details or helpful instructions
- Adds
GraphQLFeaturesTransportfor reusable GraphQL feature flag header support
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/github/transport.go | Adds new GraphQLFeaturesTransport type for adding GraphQL-Features headers to requests |
| pkg/github/transport_test.go | Comprehensive tests for GraphQLFeaturesTransport behavior including edge cases |
| pkg/github/issues.go | Implements polling logic, timeline query function, and JSON response format |
| pkg/github/issues_test.go | Updates tests to disable polling and verify new JSON response structure |
When polling for a linked PR after assigning Copilot to an issue, we now capture the assignment time before the mutation and filter to only return PRs created after that time. This prevents the tool from incorrectly returning old PRs from previous Copilot assignments.
- Document GraphQLFeaturesTransport is for library consumers - Convert githubv4.Int/String to native Go types in result map - Remove misleading log comment since tool handlers lack logger access
Replace inline GraphQL-Features header logic in bearerAuthTransport with the exported GraphQLFeaturesTransport. This removes code duplication and ensures the transport is actually used, not just exported.
…to_issue Add MCP progress notifications during the PR polling loop to provide real-time status updates while waiting for Copilot to create a PR. Changes: - Use the request parameter to access the ServerSession for notifications - Send an initial progress notification when polling starts - Send progress updates on each polling attempt with attempt count - Only send notifications when progressToken is provided by the client This aligns with the behavior in create_pull_request_with_copilot tool and improves the user experience during the waiting period.
JoannaaKL
approved these changes
Jan 16, 2026
7 tasks
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.
Summary
Enhances the
assign_copilot_to_issuetool to automatically poll for the PR created by the Copilot coding agent after assignment, similar to how the remote server'ssweagentdservice handles job status polling.Why
After assigning Copilot to an issue, users currently have to manually look up the linked PR or use
get_copilot_job_statusseparately. This enhancement provides immediate feedback by polling for the PR and including it in the response.Related to issue tracking for issue assignment improvements.
What changed
findLinkedCopilotPR()function to query issue timeline forCrossReferencedEventitems from PRs authored bycopilot-swe-agentPollConfigstruct withContextWithPollConfig()for test configurability (allows disabling polling in tests)GraphQLFeaturesTransportfor GraphQL feature flag header supportResponse format
When PR is found during polling:
{ "message": "successfully assigned copilot to issue - pull request created", "issue_number": 123, "issue_url": "https://github.com/owner/repo/issues/123", "owner": "owner", "repo": "repo", "pull_request": { "number": 456, "url": "https://github.com/owner/repo/pull/456", "title": "...", "state": "OPEN" } }When PR is not yet created:
{ "message": "successfully assigned copilot to issue - pull request pending", "issue_number": 123, "issue_url": "https://github.com/owner/repo/issues/123", "owner": "owner", "repo": "repo", "note": "The pull request may still be in progress. Use get_copilot_job_status with the pull request number once created, or check the issue timeline for updates." }MCP impact
The tool now returns structured JSON instead of a simple string message, with additional PR information when available.
Prompts tested (tool changes only)
Security / limits
Polling is bounded (max 9 attempts) and uses standard GitHub GraphQL API.
Tool renaming
Lint & tests
./script/lint./script/testDocs