[UPDATE PRIMITIVE] Resolve workflow-prompt query/pack paths across all workspace folders + include/exclude settings#307
Closed
Copilot wants to merge 2 commits into
Closed
Conversation
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix MCP workflow prompts targeting for multi-root workspaces
[UPDATE PRIMITIVE] Resolve workflow-prompt query/pack paths across all workspace folders + include/exclude settings
Jun 24, 2026
Collaborator
|
Closing this PR as superseded by #308. |
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.
In a multi-root VS Code workspace, the MCP workflow prompts (slash commands) only surfaced and resolved CodeQL queries/packs in the first workspace folder (index 0). This makes the prompt completion providers scan every workspace root and adds two extension settings for explicit, ordering-independent control over resolution roots.
📝 Update Information
Primitive Details
prompt-completions—completeQueryPath,completeSarifPath,completeDatabasePath,completePackRootThis PR is for updating an existing MCP server primitive and must ONLY include these file types:
✅ ALLOWED FILES:
server/src/**/*.ts)server/src/tools/*.ts)server/test/**/*.ts)README.md, server docs)server/src/types/*.ts)server/src/lib/*.ts)package.json,tsconfig.json)🚫 FORBIDDEN FILES:
Rationale: This PR should contain only the files necessary to update and test the primitive.
🚨 PRs that include forbidden files will be rejected and must be revised.
🛑 MANDATORY PR VALIDATION CHECKLIST
BEFORE SUBMITTING THIS PR, CONFIRM:
Update Metadata
queryPackExcludeDirssetting lets users bound🎯 Changes Description
Current Behavior
Completion providers scanned only
getUserWorkspaceDir()(folder index 0). In a multi-root workspace, queries/packs/databases/SARIF in non-first roots were not surfaced. There was no way to explicitly include an out-of-workspace query repo or exclude a root.Updated Behavior
getUserWorkspaceDirs()(readsCODEQL_MCP_WORKSPACE_FOLDERS), de-duplicating results.queryPackIncludeDirs−queryPackExcludeDirs, and feeds them intoCODEQL_MCP_WORKSPACE_FOLDERSandCODEQL_ADDITIONAL_PACKS. Workflow-prompt path resolution already consumes that env var, so include/exclude are honored end-to-end with no new server env var.Motivation
Support the recommended multi-root layout (query repo + analysis-target repo as separate roots) and give users deterministic, folder-order-independent control over query/pack resolution.
🔄 Before vs. After Comparison
Functionality Changes
API Changes
Output Format Changes
No change to completion output shape; the candidate set now spans all resolution roots.
🧪 Testing & Validation
Test Coverage Updates
Validation Scenarios
getUserWorkspaceDirs()fallback togetUserWorkspaceDir().queryPackIncludeDirsadds roots,queryPackExcludeDirsremoves them.queryPackExcludeDirslets users bound scan scope (e.g. drop large/vendor roots).Test Results
GitHub.vscode-codeqldependency extension)📋 Implementation Details
Files Modified
server/src/prompts/prompt-completions.ts(multi-root scans)extensions/vscode/src/bridge/environment-builder.ts(computeResolutionRoots)server/test/src/prompts/prompt-completions.test.ts,extensions/vscode/test/bridge/environment-builder.test.ts,extensions/vscode/test/suite/workspace-scenario.integration.test.tsextensions/vscode/README.md,CHANGELOG.md,extensions/vscode/package.jsonsetting descriptionsCode Changes Summary
Dependencies
🔍 Quality Improvements
Bug Fixes (if applicable)
getUserWorkspaceDirs(); fold include/exclude settings intoCODEQL_MCP_WORKSPACE_FOLDERS/CODEQL_ADDITIONAL_PACKS.CODEQL_MCP_WORKSPACE_FOLDERSis the single source of truth for resolution roots; regression tests assert non-first-folder discovery.Performance Improvements
MAX_FILE_COMPLETIONScap and 5s cache;queryPackExcludeDirsbounds scope.Code Quality Enhancements
🔗 References
Related Issues/PRs
External References
Validation Materials
extensions/vscode/test/fixtures/multi-root-workspace)🚀 Compatibility & Migration
Backward Compatibility
Breaking Changes (if any)
None.
API Evolution
👥 Review Guidelines
For Reviewers
Please verify:
prompt-completions.ts; remaining changes are the intrinsically extension-level fixTesting Instructions
Validation Checklist
workspace-scenariomulti-root assertions on env vars📊 Impact Assessment
Performance Impact
queryPackExcludeDirsServer Impact
AI Assistant Impact
🔄 Deployment Strategy
Rollout Considerations
Post-Deployment Validation
Update Methodology: This update follows best practices: