Skip to content

[BUG] Onboarding wizard's tool checkboxes never show as checked, and repeated clicks silently multiply MCP connections#2411

Description

@entee28

馃搵 Prerequisites

  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, you agree to follow our Code of Conduct
  • I am using the latest version of the software
  • I have tried to clear cache/cookies or used incognito mode (if ui-related)
  • I can consistently reproduce this issue

馃幆 Affected Service(s)

UI Service

馃殾 Impact/Severity

Minor inconvenience

馃悰 Bug Description

In the onboarding wizard's Step 3: Select Tools (ui/src/components/onboarding/steps/ToolSelectionStep.tsx), the tool checkboxes never visually reflect whether a tool is actually selected, and clicking an already-selected tool doesn't deselect it - every click keeps adding.

Root cause: toolResponseMatchesTool (line 38-46) compared tool.mcpServer.name === toolResponse.server_name with strict string equality. But toolResponseToAgentTool (in ui/src/lib/toolUtils.ts) strips the namespace when building a Tool from a namespaced server ref - e.g. server ref "kagent/kagent-tool-server" becomes mcpServer.name = "kagent-tool-server". So the stored tool's mcpServer.name ("kagent-tool-server") is compared against the raw API ref ("kagent/kagent-tool-server"), which never matches. This made isToolSelected() return false unconditionally for every K8s tool:

  • The <Checkbox checked={isToolSelected(tool)} .../> never rendered as checked, however many times you clicked it.
  • handleToolToggle's own isSelected check used the same broken comparison, so it always took the "add" branch - it could never take the "remove" branch, even for a tool that was already selected.

Compounding this, handleToolToggle also pushed a brand-new Tool object per click instead of merging picks that share an MCP server into one entry's toolNames array (unlike SelectToolsDialog.handleAddItem, which already does this merge for the regular create/edit flow). Combined with the always-add bug above, re-clicking a tool (trying, and failing, to uncheck it) kept appending more entries for the same server.

馃攧 Steps To Reproduce

  1. Go through the onboarding wizard to create your first agent.
  2. In Step 3: Select Tools, click a K8s tool checkbox that isn't one of the two auto-preselected defaults.
  3. Observe the checkbox - it does not render as checked.
  4. Click it again, expecting to deselect it.

馃 Expected Behavior

  • Checking a tool should visibly check its checkbox.
  • Clicking an already-selected tool's checkbox should deselect it.
  • Selecting multiple tools from the same MCP server should not create redundant duplicate bindings to that server.

馃摫 Actual Behavior

  • The checkbox never appears checked, regardless of selection state, giving no feedback that the click registered.
  • Because the "already selected" check is broken, every click is treated as a new selection - repeated clicks on the same tool keep adding entries rather than toggling it off.
  • Selecting multiple different tools from the same server (without the merge fix) creates one separate Tool array entry per tool, all referencing the same server.

馃捇 Environment

No response

馃敡 CLI Bug Report

No response

馃攳 Additional Context

  • Related to #2410 ("Duplicate entries in 'Selected Tools and Agents' share the same React key, causing removed tools to reappear"). That issue is the downstream symptom: it's what happens in ToolsSection.tsx on the agent Edit page once an agent has already been created with duplicate same-server Tool entries. This issue is the upstream root cause - the ToolSelectionStep.tsx checkbox bug described here is what let those duplicate entries get created in the first place, back in onboarding Step 3, before the agent even exists.

馃搵 Logs

馃摲 Screenshots

No response

馃檵 Are you willing to contribute?

  • I am willing to submit a PR to fix this issue

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions