crush icon indicating copy to clipboard operation
crush copied to clipboard

fix(tui): don't crash when there are MCP servers but no agents

Open iainlane opened this issue 5 months ago • 3 comments

When there are MCP servers but no AI agents configured, the TUI currently crashes due to a nil pointer dereference. We receive an mcp.EventStateChanged event, when the MCP server is initialised. This causes us to attempt to access the agent coordinator, which is nil when there are no agents set up.

The fix is to add a nil guard before accessing the coordinator. With this fix, instead of crashing, the app proceeds to the UI, allowing credentials to be set up as normal.

Tests are included. Reverting the fix causes the tests to fail as expected.

iainlane avatar Nov 16 '25 20:11 iainlane

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

charmcli avatar Nov 16 '25 20:11 charmcli

I have read the Contributor License Agreement (CLA) and hereby sign the CLA.

iainlane avatar Nov 16 '25 20:11 iainlane

Do we need any UI feedback? I tend to say no, but I rather ask.

LarsArtmann avatar Nov 17 '25 19:11 LarsArtmann