Skip to content

Coding Agent UI: Closed pull requests are not detected as closed#8485

Merged
alexr00 merged 2 commits intomainfrom
alexr00/issue8482
Feb 6, 2026
Merged

Coding Agent UI: Closed pull requests are not detected as closed#8485
alexr00 merged 2 commits intomainfrom
alexr00/issue8482

Conversation

@alexr00
Copy link
Member

@alexr00 alexr00 commented Feb 6, 2026

Fixes #8482

Copilot AI review requested due to automatic review settings February 6, 2026 15:19
@alexr00 alexr00 enabled auto-merge (squash) February 6, 2026 15:19
@alexr00 alexr00 self-assigned this Feb 6, 2026
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 6, 2026
Copy link
Contributor

Copilot AI left a 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 fixes issue #8482 where closed pull requests are incorrectly shown as open in the Coding Agent UI. The root cause is that GitHub's search API can return stale results that don't match the requested state qualifier. The fix adds a post-filtering step to ensure only PRs with the correct state are displayed.

Changes:

  • Added getStateFromQuery() utility function to parse state qualifiers from GitHub search queries
  • Post-filter PR search results to exclude PRs whose state doesn't match the query

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/github/utils.ts Added getStateFromQuery() function to extract state qualifier (open/closed/merged) from search queries using regex pattern matching
src/github/folderRepositoryManager.ts Added post-filtering logic in getPullRequestsForCategory() to filter PRs based on the state extracted from the query
Comments suppressed due to low confidence (1)

src/github/utils.ts:1668

  • The new getStateFromQuery function lacks test coverage. Given that the codebase has tests for other utility functions in src/test/github/utils.test.ts (e.g., getPRFetchQuery and sanitizeIssueTitle), tests should be added for this new function. Consider adding test cases for:
  • Queries with is:open, is:closed, and is:merged
  • Queries without a state qualifier
  • Queries with state qualifiers in different positions (start, middle, end)
  • Case insensitivity (IS:OPEN, Is:Closed, etc.)
  • Queries with multiple state qualifiers (should match the first one)
  • Edge cases like "is:opened" or "is:merge" (should return undefined)
export function getStateFromQuery(query: string): GithubItemStateEnum | undefined {
	const match = query.match(/(?:^|\s)is:(?<state>open|closed|merged)(?:\s|$)/i);
	if (!match?.groups?.state) {
		return undefined;
	}
	switch (match.groups.state.toLowerCase()) {
		case 'open':
			return GithubItemStateEnum.Open;
		case 'closed':
			return GithubItemStateEnum.Closed;
		case 'merged':
			return GithubItemStateEnum.Merged;
		default:
			return undefined;
	}
}

@alexr00 alexr00 merged commit d6f00fe into main Feb 6, 2026
6 checks passed
@alexr00 alexr00 deleted the alexr00/issue8482 branch February 6, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coding Agent UI: Closed pull requests are not detected as closed

3 participants