Existing chats do not pick up newly connected connector and MCP tools
Summary
Connecting an account after starting a chat updates Settings, but the existing chat can keep the tool registry built before the connection. A fresh chat sees the new tools; the original chat does not.
Reproduced on upstream main at 5bc10d928e0b64aae74313349a3b17bd19643ae2 in a separate, unmodified OpenWorker checkout before applying a fix.
Steps to reproduce
- Start a chat with the Coworker persona while Outlook is disconnected, and complete a turn.
- Connect Outlook through Settings, or complete the managed OAuth callback. Confirm Search Outlook is enabled.
- Send another message in the same chat.
- Inspect the tool schema supplied to the model:
outlook_search_messagesis absent. As a positive control, create a fresh chat: that tool is present.
The regression tests keep a single WebSocket open throughout. The UI screenshots use a clearly labelled deterministic diagnostic provider that reports the actual tool schema; they do not rely on a model's claim about its capabilities. External account validation is stubbed and all credentials are synthetic, while the routes, connection stores and worker are real.
Expected / actual
- Expected: the next turn in the existing chat reflects the current connection and tool selections, preserving history and permissions.
- Actual: the chat continues with the cached registry until its worker is rebuilt. Tool removal and changes to chat/persona restrictions can also leave that registry stale between turns.
The same lifecycle gap affects custom MCP servers added after a session starts. The proposed regression suite separately exercises actual discovery and execution through a local stdio MCP server.
Source finding
SessionManager.get_engine() returns a cached engine, whose connector/MCP tools were registered at construction. prepare_mcp_tools() also skips already-cached sessions. Refreshing the Settings display or reconnecting the UI is not sufficient to replace tools retained by that worker.
Before screenshots
Outlook is connected and Search Outlook is enabled:

The existing chat still receives no Outlook search tool on its next turn:

Proposed scope
Refresh connector/MCP tool selection at turn boundaries without replacing the worker, history, permission object, or unrelated tools. Keep active operations intact and respect chat/persona restrictions. This is not a proposal for immediate mid-turn revocation or a new MCP transport lifecycle.
Proposed fix
Source: andrewyng/openworker