-
Notifications
You must be signed in to change notification settings - Fork 21
✨ add solution server #547
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
WalkthroughThis update introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant VSCodeExtension
participant SolutionServerClient
participant SolutionServer
VSCodeExtension->>SolutionServerClient: connect()
SolutionServerClient->>SolutionServer: MCP connect (HTTP streaming)
SolutionServer-->>SolutionServerClient: Connection established
VSCodeExtension->>SolutionServerClient: setClientId(uuid)
VSCodeExtension->>SolutionServerClient: getServerCapabilities()
SolutionServerClient->>SolutionServer: MCP call "get_capabilities"
SolutionServer-->>SolutionServerClient: Capabilities JSON
VSCodeExtension->>SolutionServerClient: createIncident(incident)
SolutionServerClient->>SolutionServer: MCP call "create_incident"
SolutionServer-->>SolutionServerClient: Incident ID
VSCodeExtension->>SolutionServerClient: createSolution(incidentIds, changeSet, reasoning, hintIds)
SolutionServerClient->>SolutionServer: MCP call "create_solution"
SolutionServer-->>SolutionServerClient: Solution ID
VSCodeExtension->>SolutionServerClient: getBestHint(ruleset, violation)
SolutionServerClient->>SolutionServer: MCP call "get_best_hint"
SolutionServer-->>SolutionServerClient: Hint JSON
VSCodeExtension->>SolutionServerClient: disconnect()
SolutionServerClient->>SolutionServer: MCP disconnect
Assessment against linked issues
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
214e9c9
to
c949ef7
Compare
Signed-off-by: David Zager <[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.
Actionable comments posted: 9
🧹 Nitpick comments (3)
agentic/src/workflows/interactiveWorkflow.ts (1)
368-380
: Consider controlling debug logging with a log level configuration.The extensive debug logging with
[DEBUG]
prefixes might be too verbose for production. Consider using a logging framework or configuration to control log verbosity.- console.log(`[DEBUG] Edge function called with state:`, { + if (this.debugMode || process.env.DEBUG) { + console.log(`[DEBUG] Edge function called with state:`, {Apply similar conditional logging to other debug statements in this method.
Also applies to: 388-389, 398-399, 405-406, 408-409, 413-416
agentic/src/clients/solutionServerClient.ts (2)
51-57
: Consider making MCP client capabilities configurable.The capabilities object is currently hardcoded in the constructor. If different capabilities might be needed in the future, consider accepting them as an optional parameter.
- constructor(serverUrl: string, enabled: boolean = true) { + constructor(serverUrl: string, enabled: boolean = true, capabilities?: any) { this.serverUrl = serverUrl; this.enabled = enabled; + this.capabilities = capabilities || { + roots: { + listChanged: false, + }, + sampling: {}, + };Then use
this.capabilities
when creating the client.
73-73
: Remove redundant optional chaining operator.The
mcpClient
is already checked for null above, so the optional chaining operator is unnecessary.- await this.mcpClient?.connect(new StreamableHTTPClientTransport(new URL(this.serverUrl))); + await this.mcpClient.connect(new StreamableHTTPClientTransport(new URL(this.serverUrl)));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (16)
agentic/src/clients/solutionServerClient.ts
(1 hunks)agentic/src/index.ts
(1 hunks)agentic/src/nodes/analysisIssueFix.ts
(10 hunks)agentic/src/schemas/analysisIssueFix.ts
(2 hunks)agentic/src/types.ts
(2 hunks)agentic/src/workflows/interactiveWorkflow.ts
(3 hunks)package.json
(1 hunks)shared/src/types/types.ts
(4 hunks)vscode/package.json
(2 hunks)vscode/src/commands.ts
(5 hunks)vscode/src/data/virtualStorage.ts
(2 hunks)vscode/src/extension.ts
(5 hunks)vscode/src/extensionState.ts
(1 hunks)vscode/src/utilities/configuration.ts
(2 hunks)vscode/src/utilities/typeGuards.ts
(2 hunks)webview-ui/package.json
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
vscode/src/extensionState.ts (2)
vscode/src/client/analyzerClient.ts (1)
AnalyzerClient
(35-546)agentic/src/clients/solutionServerClient.ts (1)
SolutionServerClient
(28-417)
agentic/src/types.ts (1)
agentic/src/clients/solutionServerClient.ts (1)
SolutionServerClient
(28-417)
vscode/src/utilities/typeGuards.ts (1)
shared/src/types/types.ts (1)
GetSolutionResult
(82-87)
agentic/src/schemas/analysisIssueFix.ts (1)
shared/src/types/types.ts (1)
EnhancedIncident
(40-53)
agentic/src/nodes/analysisIssueFix.ts (1)
agentic/src/clients/solutionServerClient.ts (2)
SolutionServerClient
(28-417)GetBestHintResult
(16-19)
agentic/src/clients/solutionServerClient.ts (1)
shared/src/types/types.ts (2)
EnhancedIncident
(40-53)SuccessRateMetric
(20-23)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Build (windows)
- GitHub Check: Build (macos)
- GitHub Check: Build (linux)
🔇 Additional comments (29)
webview-ui/package.json (1)
28-28
: Verify the framer-motion package version and security status.Please ensure the specified version is valid and check for any known security vulnerabilities in this version.
#!/bin/bash # Description: Verify framer-motion package version and check for security advisories # Check for the latest version on npm curl -s https://registry.npmjs.org/framer-motion/latest | jq '.version' # Check for security advisories npm audit --package-lock-only --audit-level=moderate 2>/dev/null || echo "npm audit not available, checking manually" # Get package info to verify 11.18.2 exists curl -s https://registry.npmjs.org/framer-motion/11.18.2 | jq '.version // "Version not found"'agentic/src/index.ts (1)
4-4
: Export addition looks good.The export follows the established pattern and properly exposes the SolutionServerClient functionality.
Let me verify that the exported module exists and contains the expected exports:
#!/bin/bash # Description: Verify the solutionServerClient module exists and exports are valid # Check if the solutionServerClient file exists fd -t f "solutionServerClient" agentic/src/clients/ --exec echo "Found: {}" # Check for TypeScript class and interface definitions ast-grep --pattern 'export class SolutionServerClient { $$$ }' ast-grep --pattern 'export interface $_ { $$$ }'agentic/src/types.ts (2)
5-5
: Import addition is correct.The import properly brings in the SolutionServerClient type for use in the interface.
73-73
: ```shell
#!/bin/bashFind all call sites of the init method to verify they supply the new property
echo "===== All .init( calls ====="
rg -n --color=never ".init(" -B 2 -A 3echo -e "\n===== init({...}) object-literal calls ====="
rg -n --color=never "init(\s*{" -B 1 -A 4</details> <details> <summary>vscode/src/extensionState.ts (2)</summary> `7-7`: **Import update is correct.** Properly imports the SolutionServerClient alongside existing imports. --- `14-14`: ```shell #!/bin/bash # Locate the VSCode extension activation entrypoint rg -l "export (async )?function activate" --type ts # Show context around the activate() implementation to inspect ExtensionState construction rg -n "export (async )?function activate" -C 5 # Find where SolutionServerClient is instantiated rg -n "new SolutionServerClient" # Find where AnalyzerClient is instantiated rg -n "new AnalyzerClient"
vscode/src/data/virtualStorage.ts (2)
66-66
: Let's locate theSolutionResponse
declaration and allclientId
usages to confirm type support and consistency:#!/bin/bash # 1. Find where SolutionResponse is declared rg -n "interface SolutionResponse" -g '*.ts' rg -n "type SolutionResponse" -g '*.ts' # 2. Check if clientId appears on SolutionResponse rg -n "SolutionResponse.*clientId" -g '*.ts' # 3. Locate all clientId references in data/virtualStorage.ts rg -n "clientId" -g 'vscode/src/data/virtualStorage.ts'
43-43
: ```shell
#!/bin/bashInspect type definitions in shared/src/types/types.ts
rg -A5 -B5 "export interface GetSolutionResult" shared/src/types/types.ts
rg -A5 -B5 "export interface SolutionResponse" shared/src/types/types.ts
rg -A5 -B5 "export interface Solution" shared/src/types/types.ts
rg -n "clientId" shared/src/types/types.tsInspect the two conversion functions in virtualStorage.ts
rg -A5 -B5 "toLocalFromGetSolutionResult" vscode/src/data/virtualStorage.ts
rg -A5 -B5 "toLocalFromSolutionResponse" vscode/src/data/virtualStorage.ts</details> <details> <summary>package.json (3)</summary> `40-40`: **LGTM: Workspace configuration properly updated.** The addition of the "agentic" workspace correctly integrates the new package into the monorepo structure. --- `45-45`: **LGTM: Build dependency properly configured.** Including "agentic" in the postinstall script ensures the package is built after workspace dependencies are installed. --- `50-52`: **LGTM: Development workflow properly configured.** The concurrent development setup correctly includes the new agentic workspace alongside existing workspaces. </details> <details> <summary>vscode/src/commands.ts (5)</summary> `68-68`: **LGTM: UUID import added for client identification.** The import supports the client ID generation functionality for solution server integration. --- `131-132`: **LGTM: Client ID generation and assignment.** The unique client ID generation and assignment to the solution server client properly establishes client identity for each solution request. --- `163-163`: **LGTM: Solution server client passed to agent.** The solutionServerClient is correctly passed to the agent initialization, enabling the agent to interact with the solution server. --- `357-357`: **LGTM: Client ID included in solution response.** The clientId is properly included in the solution response, maintaining traceability throughout the solution lifecycle. --- `264-264`: **Minor formatting improvement.** The added blank line improves code readability by separating logical sections. </details> <details> <summary>vscode/src/utilities/typeGuards.ts (3)</summary> `13-13`: **LGTM: Type guard destructuring updated for clientId.** The destructuring correctly includes the new clientId field from the GetSolutionResult interface. --- `19-19`: **LGTM: Client ID validation added.** The string validation for clientId is appropriate and consistent with the UUID format used for client identification. --- `67-69`: **LGTM: Solution response type guard updated.** The addition of clientId validation to the SolutionResponse type guard maintains consistency with the updated interface. </details> <details> <summary>agentic/src/schemas/analysisIssueFix.ts (2)</summary> `28-28`: **LGTM: Output hints field added.** The `outputHints` field as an array of numbers appropriately stores hint identifiers from the solution server, supporting the enhanced solution generation process. --- `19-19`: I’ll search the entire repo (including workflow files) for any references to the new `inputIncidents` field to confirm it’s being used end-to-end. ```shell #!/bin/bash # Search for inputIncidents usages in code and workflows echo "🔍 Scanning all files for 'inputIncidents'…" rg -n "inputIncidents" . echo echo "🔍 Scanning YAML workflows for 'inputIncidents'…" rg -n "inputIncidents" --glob "*.yml" --glob "*.yaml"
vscode/package.json (3)
480-486
: LGTM: Solution server URL configuration added.The configuration property is well-structured with a sensible default localhost URL and appropriate description.
487-493
: LGTM: Solution server enable/disable configuration.The boolean configuration with default
false
is appropriate for a new feature, allowing users to opt-in to the solution server functionality.
677-677
: Verify MCP SDK version and security.Ensure the Model Context Protocol SDK version is current and free from security vulnerabilities.
#!/bin/bash # Description: Check the latest version and security status of @modelcontextprotocol/sdk # Expected: Get version info and security advisories # Check latest version on npm curl -s https://registry.npmjs.org/@modelcontextprotocol/sdk | jq '.["dist-tags"].latest' # Check for known vulnerabilities npm audit --audit-level=moderate --json | jq '.vulnerabilities'vscode/src/utilities/configuration.ts (1)
33-36
: Configuration accessors implementation looks good!The new configuration accessors for solution server settings follow the established patterns in the file correctly, with appropriate default values.
Also applies to: 130-135
vscode/src/extension.ts (1)
130-130
: Let’s pull in the actualconnect()
implementation for clarity:#!/bin/bash file="agentic/src/clients/solutionServerClient.ts" echo "=== connect() occurrences ===" grep -n "connect(" "$file" || true if line=$(grep -n "connect(" "$file" | head -n1 | cut -d: -f1); then start=$((line-5)) (( start < 1 )) && start=1 end=$((line+20)) echo -e "\n--- Showing lines $start to $end ---" sed -n "${start},${end}p" "$file" else echo "No connect() method found." fishared/src/types/types.ts (1)
20-24
: Type definitions are well-structured and backward compatible!The new interfaces and type extensions properly use optional fields to maintain backward compatibility. The naming conventions are consistent with the existing codebase.
Also applies to: 45-46, 52-52, 78-80, 86-86, 94-96, 110-110
agentic/src/workflows/interactiveWorkflow.ts (1)
247-247
: State structure migration looks correct!The change from
inputIncidentsDescription
string toinputIncidents
array properly supports structured incident data handling.Also applies to: 255-255, 382-383, 396-396
agentic/src/nodes/analysisIssueFix.ts (1)
180-205
: Hint fetching implementation looks good!The deduplication logic using Set and the violation key pattern is well-implemented. Error handling for individual hint failures is appropriate.
Signed-off-by: David Zager <[email protected]>
Signed-off-by: David Zager <[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.
Actionable comments posted: 0
♻️ Duplicate comments (3)
agentic/src/nodes/analysisIssueFix.ts (3)
99-99
: Remove unnecessary null check for required constructor parameter.The
solutionServerClient
is a required constructor parameter and cannot be null/undefined at runtime.- if ( - this.solutionServerClient && - state.inputFileUri && + if ( + state.inputFileUri &&
105-109
: Add error handling for individual incident creation failures.Using
Promise.all
means that if any single incident creation fails, the entire batch will be rejected, potentially losing all successfully created incident IDs.- const incidentIds = await Promise.all( - state.inputIncidents.map((incident) => - this.solutionServerClient.createIncident(incident), - ), - ); + const incidentIdPromises = state.inputIncidents.map(async (incident) => { + try { + return await this.solutionServerClient.createIncident(incident); + } catch (error) { + console.error(`Failed to create incident: ${error}`); + return null; + } + }); + const incidentIds = (await Promise.all(incidentIdPromises)) + .filter((id): id is number => id !== null);
140-140
: Use console.error for missing required fields.This aligns with the previous reviewer's suggestion to use
console.error()
instead ofconsole.warn()
for this critical validation failure.- console.error("Missing required fields for solution creation"); + console.error("Missing required fields for solution creation");
🧹 Nitpick comments (1)
agentic/src/nodes/analysisIssueFix.ts (1)
191-216
: Consider optimizing hint fetching with concurrent requests.The current implementation fetches hints sequentially, which could be slow when processing multiple unique violation types. Consider using concurrent requests for better performance.
- for (const incident of state.inputIncidents) { - // Check if we need to get a hint for this violation type - if (incident.ruleset_name && incident.violation_name) { - const violationKey = `${incident.ruleset_name}::${incident.violation_name}`; - - if (!seenViolationTypes.has(violationKey)) { - seenViolationTypes.add(violationKey); - try { - const hint = await this.solutionServerClient.getBestHint( - incident.ruleset_name, - incident.violation_name, - ); - if (hint) { - hints.push(hint); - } - } catch (error) { - console.warn(`Failed to get hint for ${violationKey}: ${error}`); - } - } - } - } + // Collect unique violation types + for (const incident of state.inputIncidents) { + if (incident.ruleset_name && incident.violation_name) { + const violationKey = `${incident.ruleset_name}::${incident.violation_name}`; + if (!seenViolationTypes.has(violationKey)) { + seenViolationTypes.add(violationKey); + } + } + } + + // Fetch hints concurrently + const hintPromises = Array.from(seenViolationTypes).map(async (violationKey) => { + const [rulesetName, violationName] = violationKey.split('::'); + try { + return await this.solutionServerClient.getBestHint(rulesetName, violationName); + } catch (error) { + console.warn(`Failed to get hint for ${violationKey}: ${error}`); + return null; + } + }); + + const hintResults = await Promise.all(hintPromises); + hints.push(...hintResults.filter((hint): hint is GetBestHintResult => hint !== null));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
agentic/src/nodes/analysisIssueFix.ts
(11 hunks)agentic/src/workflows/interactiveWorkflow.ts
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- agentic/src/workflows/interactiveWorkflow.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Build (windows)
- GitHub Check: Build (macos)
- GitHub Check: Build (linux)
🔇 Additional comments (1)
agentic/src/nodes/analysisIssueFix.ts (1)
245-250
: Well-structured prompt enhancement with incidents and hints.The updated prompt construction properly enumerates incidents with line numbers and conditionally includes hints, improving the AI's context for generating solutions.
Fixes #483
Summary by CodeRabbit
New Features
Bug Fixes
Chores