Skip to content

Comments

Fix chat agent creation not creating with listener#1530

Merged
kanushka merged 2 commits intowso2:release/bi-1.8.xfrom
dan-niles:fix-get-available-nodes
Feb 20, 2026
Merged

Fix chat agent creation not creating with listener#1530
kanushka merged 2 commits intowso2:release/bi-1.8.xfrom
dan-niles:fix-get-available-nodes

Conversation

@dan-niles
Copy link
Contributor

@dan-niles dan-niles commented Feb 20, 2026

Purpose

Fixes wso2/product-ballerina-integrator#2531

Fixes chat agent creation flow when it creates a chat agent service with no listener attached.

Screen.Recording.2026-02-20.at.4.40.55.PM.mov

Summary by CodeRabbit

Bug Fixes

  • Improved file path resolution to use absolute path checks for better accuracy
  • Updated agent wizard configuration to correctly set tools and listener properties

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

This pull request fixes the AI chat agent creation path failure by correcting path resolution logic in the RPC manager and adjusting agent template property assignments in the wizard component to use correct data types.

Changes

Cohort / File(s) Summary
Path Resolution Fix
workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts
Replaced relative-path resolution heuristic with absolute-path check using isAbsolute() to properly determine whether to join paths with project root.
Agent Template Property Updates
workspaces/ballerina/ballerina-visualizer/src/views/BI/AIChatAgent/AIChatAgentWizard.tsx
Updated agent node template to set tools as string "[]" instead of empty array; changed listener configuration from array-based assignment (.values) to scalar assignment (.value).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Paths are mended, templates corrected,
The agent's creation now protected,
From absolute checks to proper string forms,
Our chat-bots dance through all their norms!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete, missing most required template sections including Goals, Approach, User stories, Release notes, Documentation, and other critical fields. Complete the PR description by filling in all required template sections, particularly Goals, Approach, Release notes, and Documentation to provide full context.
Out of Scope Changes check ❓ Inconclusive Changes in BiDiagramRpcManager appear tangential to the primary chat agent creation fix; the path resolution change may be a supporting fix but is not directly explained. Clarify the relationship between the BiDiagramRpcManager path handling change and the chat agent creation fix in the PR description or commit messages.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix chat agent creation not creating with listener' is specific and directly relates to the main changes addressing the chat agent creation flow issue.
Linked Issues check ✅ Passed The PR addresses issue #2531 by fixing the chat agent creation path to handle cases where a service is created without a listener, matching the stated objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dan-niles dan-niles marked this pull request as ready for review February 20, 2026 11:11
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts (1)

499-525: LGTM — path.isAbsolute() is the right check here.

The switch from a string-inclusion heuristic to path.isAbsolute() is more correct (handles Windows absolute paths, avoids false matches when a component of the filename matches the project path prefix) and aligns with standard Node.js path-handling idioms.

Worth noting: deleteByComponentInfo (Line 1390) still uses the older !filePath.includes(projectPath) heuristic for the same concept. Not introduced by this PR, but worth a follow-up alignment.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts`
around lines 499 - 525, The review notes getAvailableNodes correctly uses
path.isAbsolute to normalize file paths but deleteByComponentInfo still uses the
fragile !filePath.includes(projectPath) heuristic; update the
deleteByComponentInfo implementation to mirror the normalization logic used in
getAvailableNodes: accept the incoming fileNameOrPath, if not
path.isAbsolute(fileNameOrPath) join it with StateMachine.context().projectPath
to form an absolute filePath, then use that absolute path for
comparisons/deletions instead of relying on includes; locate and modify the
deleteByComponentInfo function to perform this normalization and replace any
includes-based checks with path.isAbsolute handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts`:
- Around line 499-525: The review notes getAvailableNodes correctly uses
path.isAbsolute to normalize file paths but deleteByComponentInfo still uses the
fragile !filePath.includes(projectPath) heuristic; update the
deleteByComponentInfo implementation to mirror the normalization logic used in
getAvailableNodes: accept the incoming fileNameOrPath, if not
path.isAbsolute(fileNameOrPath) join it with StateMachine.context().projectPath
to form an absolute filePath, then use that absolute path for
comparisons/deletions instead of relying on includes; locate and modify the
deleteByComponentInfo function to perform this normalization and replace any
includes-based checks with path.isAbsolute handling.

@kanushka kanushka merged commit 17245f6 into wso2:release/bi-1.8.x Feb 20, 2026
8 checks passed
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.

2 participants