Skip to content

Fix frozen spinner during MCP tool loading#2115

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/when-mcp-tools-take-a-bit-of-time-to-sta-a0a71503
Mar 16, 2026
Merged

Fix frozen spinner during MCP tool loading#2115
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/when-mcp-tools-take-a-bit-of-time-to-sta-a0a71503

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Mar 16, 2026

When MCP tools take a bit of time to start, the TUI feels irresponsive because it starts showing a spinner next to the number of tools but the spinner is frozen in spinning state until the final number of tools is received.

Assisted-By: docker-agent

The ToolsetInfoEvent handler called sidebar.SetToolsetInfo() directly and returned nil, bypassing the sidebar's Update() method which starts the spinner animation. Forward the event via forwardToSidebar() so the spinner registers with the animation coordinator and animates properly.

Assisted-By: docker-agent
@dgageot dgageot requested a review from a team as a code owner March 16, 2026 09:15
Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

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

Review Summary

Assessment: 🟢 APPROVE

Summary

This PR successfully fixes the frozen spinner issue during MCP tool loading. The change is clean and follows good architectural patterns.

What Changed:

  • Removed direct call to sidebar.SetToolsetInfo() from the chat page
  • Now forwards the ToolsetInfoEvent to the sidebar via forwardToSidebar()
  • The sidebar's Update() method handles the event and manages its own state

Why This Works:
The sidebar's Update() method already has a case handler for ToolsetInfoEvent (line 707 in sidebar.go) that calls SetToolsetInfo() with the same parameters. By forwarding the event instead of directly calling the method, the sidebar can now properly manage the spinner lifecycle internally through its event loop, preventing the frozen spinner issue.

Code Quality:

  • ✅ No race conditions introduced
  • ✅ Follows the Elm Architecture pattern used throughout the codebase
  • ✅ Maintains separation of concerns (sidebar manages its own UI state)
  • ✅ No breaking changes to the API
  • ✅ Consistent with how other events are handled (e.g., SessionTitleEvent)

Findings

No bugs detected. The implementation is correct and improves the architecture.

@dgageot dgageot merged commit 09f877f into docker:main Mar 16, 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