Skip to content

Fix code search for case where we can't get a local diff#314286

Merged
mjbvz merged 1 commit into
microsoft:mainfrom
mjbvz:dev/mjbvz/unusual-goldfish
May 5, 2026
Merged

Fix code search for case where we can't get a local diff#314286
mjbvz merged 1 commit into
microsoft:mainfrom
mjbvz:dev/mjbvz/unusual-goldfish

Conversation

@mjbvz
Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz commented May 4, 2026

For #313281

Copilot AI review requested due to automatic review settings May 4, 2026 23:35
@mjbvz mjbvz enabled auto-merge May 4, 2026 23:35
Copy link
Copy Markdown
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 updates Copilot's workspace chunk search fallback path so code search can continue when the workspace diff tracker cannot produce a local diff, which is relevant to the external-ingest work tracked in #313281 for non-standard/virtual file systems.

Changes:

  • Introduces a LocalDiffResult type so local-diff lookup can explicitly return unknown or tooLarge.
  • Changes workspace search to keep running when no concrete diff file list is available instead of bailing out immediately.
  • Adjusts external-ingest/local-result filtering so merge logic can operate with an optional diff pattern.
Show a summary per file
File Description
extensions/copilot/src/platform/workspaceChunkSearch/node/codeSearch/codeSearchChunkSearch.ts Extends local-diff handling and fallback merge behavior in Copilot workspace/code search.

Copilot's findings

Comments suppressed due to low confidence (2)

extensions/copilot/src/platform/workspaceChunkSearch/node/codeSearch/codeSearchChunkSearch.ts:715

  • This fallback only helps after searchWorkspace() has already started, but searchWorkspace() still calls isAvailable() first and isAvailable() still rejects 'unknown'/'tooLarge' diffs unless external ingest is enabled. Because external ingest is off by default, the original 'can't get a local diff' failure still reproduces for the normal code-search-only configuration.
		if (Array.isArray(diffArray)) {
			// Force it to search the local diff too so we can override stale code-search results.
			await raceCancellationError(this._externalIngestIndex.value.updateForceIncludeFiles(diffArray, token), token);
		}

		const externalResult = await this._externalIngestIndex.value.search(sizing, query, innerTelemetryInfo, token);
		if (externalResult) {
			if (!Array.isArray(diffArray)) {
				return { chunks: externalResult, strategyId: 'externalIngest' };

extensions/copilot/src/platform/workspaceChunkSearch/node/codeSearch/codeSearchChunkSearch.ts:710

  • Skipping updateForceIncludeFiles() for non-array diff states leaves whatever files were force-included by the previous successful diff in ExternalIngestIndex. Since this new path later accepts all external-ingest hits when diffFilePattern is undefined, an old diff snapshot can keep overriding current remote results after the local diff becomes unavailable.
		if (Array.isArray(diffArray)) {
			// Force it to search the local diff too so we can override stale code-search results.
			await raceCancellationError(this._externalIngestIndex.value.updateForceIncludeFiles(diffArray, token), token);
		}
  • Files reviewed: 1/1 changed files
  • Comments generated: 1

@@ -568,11 +570,7 @@ export class CodeSearchChunkSearch extends Disposable {
const indexedRepos = allRepos.filter(repo => repo.status === CodeSearchRepoStatus.Ready);

const diffArray = await raceCancellationError(this.getLocalDiff(), token);
@mjbvz mjbvz merged commit 55afbda into microsoft:main May 5, 2026
43 of 45 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.120.0 milestone May 5, 2026
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.

3 participants