Existing chats do not pick up newly connected connector and MCP tools

Author: apoorvgarg31Created Sep 14, 2026Updated Sep 14, 2026

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

  1. Start a chat with the Coworker persona while Outlook is disconnected, and complete a turn.
  2. Connect Outlook through Settings, or complete the managed OAuth callback. Confirm Search Outlook is enabled.
  3. Send another message in the same chat.
  4. Inspect the tool schema supplied to the model: outlook_search_messages is 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:

Outlook connected with Search Outlook enabled

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

Existing chat tool schema remains missing Outlook search

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

PR #663: https://github.com/andrewyng/openworker/pull/663