SurfSense/surfsense_backend/app/agents
CREDO23 704d1bf18f refactor(mcp): per-connector cache refresh on lifecycle events
Collapse the invalidate + warmup pair into a single
refresh_mcp_tools_cache_for_connector(connector_id, search_space_id)
helper and scope live discovery to the one connector that changed
instead of the whole search space.

- new mcp_tool.discover_single_mcp_connector: load one connector,
  refresh OAuth if needed, force live MCP discovery so its cached_tools
  row is rewritten; returned wrappers are discarded since the in-process
  LRU is rebuilt lazily on the next user query
- mcp_tools_cache.refresh_mcp_tools_cache_for_connector: synchronously
  evicts the per-space LRU (LRU keys cannot scope finer) and schedules
  the per-connector prefetch via loop.create_task
- routes (OAuth callback, MCP POST, MCP PUT) collapse their two
  back-to-back calls into a single refresh call; DELETE handlers keep
  using bare invalidate_mcp_tools_cache (nothing to prefetch)

No new automated tests: the new functions are I/O glue (DB + network)
where mocked unit tests would test implementation rather than behavior.
The existing 9 unit tests for the cached_tools data shape are unchanged.
2026-05-20 17:43:27 +02:00
..
autocomplete Merge commit '61f4d05cd1' into dev_mod 2026-04-28 09:25:41 -07:00
multi_agent_chat perf(kb-planner): route internal planner calls to dedicated small/fast LLM 2026-05-20 11:42:52 +02:00
new_chat refactor(mcp): per-connector cache refresh on lifecycle events 2026-05-20 17:43:27 +02:00
podcaster cloud: added openrouter integration with global configs 2026-04-15 23:46:29 -07:00
video_presentation cloud: added openrouter integration with global configs 2026-04-15 23:46:29 -07:00
__init__.py feat: Added chat_history to researcher agent 2025-05-10 20:06:19 -07:00