Fix chat agent creation not creating with listener#1530
Fix chat agent creation not creating with listener#1530kanushka merged 2 commits intowso2:release/bi-1.8.xfrom
Conversation
📝 WalkthroughWalkthroughThis 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 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.
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