-
Notifications
You must be signed in to change notification settings - Fork 505
Description
Problem Statement
If MCPClient’s background loop dies and close_future is already resolved, pending tool calls can just sit there. We need a test that proves we error out instead of hanging.
The hot-reload watcher shares one observer across registries. We should prove a single file change hits every registry without spawning multiple observers.
These paths are easy to break without tests.
Proposed Solution
Unit test that sets a resolved close_future and expects _invoke_on_background_thread to raise “connection closed.”
Watcher test that fires one change event and checks both registries get it while only one observer is scheduled.
Reset ToolWatcher’s shared state per test to avoid cross-test bleed.
Use Case
The new tests are guardrails that keep two user-facing behaviors safe:
MCP: We simulate the MCP connection dying and prove the client raises “connection closed” instead of hanging. If a future change breaks that and reintroduces hangs, CI will fail. This prevents end users from seeing stuck MCP tool calls when connections drop.
Hot-reload: We simulate a single file change in a watched tools directory and prove it’s delivered to every registry while using only one observer. If someone breaks that fan-out, CI catches it. This prevents developers from discovering in real use that hot-reload silently missed a registry.
Alternatives Solutions
No response
Additional Context
No response