refactor: remove search_surfsense_docs tool and related references

- Deleted the `search_surfsense_docs` tool and its associated files, streamlining the agent's toolset.
- Updated various components and prompts to remove references to the now-removed tool, ensuring consistency across the codebase.
- Adjusted documentation to direct users to the SurfSense documentation link for product-related queries instead.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-05-28 22:35:14 -07:00
parent 9b9e6828c7
commit 40ca9e6ed2
71 changed files with 232 additions and 1676 deletions

View file

@ -60,7 +60,6 @@ class TestReadOnlyToolsAllowed:
"glob",
"web_search",
"scrape_webpage",
"search_surfsense_docs",
"get_connected_accounts",
"write_todos",
"task",

View file

@ -22,12 +22,6 @@ from app.agents.new_chat.subagents.config import (
# ---------------------------------------------------------------------------
@tool
def search_surfsense_docs(query: str) -> str:
"""Search the user's KB."""
return ""
@tool
def web_search(query: str) -> str:
"""Search the public web."""
@ -95,7 +89,6 @@ def generate_report(topic: str) -> str:
ALL_TOOLS = [
search_surfsense_docs,
web_search,
scrape_webpage,
read_file,
@ -161,7 +154,7 @@ class TestReportWriterSubagent:
names = {t.name for t in spec["tools"]} # type: ignore[index]
assert names == REPORT_WRITER_TOOLS & {t.name for t in ALL_TOOLS}
assert "generate_report" in names
assert "search_surfsense_docs" in names
assert "read_file" in names
def test_deny_rules_block_writes_but_allow_generate_report(self) -> None:
spec = build_report_writer_subagent(tools=ALL_TOOLS)
@ -272,9 +265,9 @@ class TestFilterToolsWarningSuppression:
# Allowed set asks for two registry tools (one present, one
# not) plus a bunch of middleware-provided names.
_filter_tools(
[search_surfsense_docs],
[web_search],
allowed_names={
"search_surfsense_docs",
"web_search",
"scrape_webpage", # legitimately missing → should warn
"read_file", # mw-provided → suppressed
"ls",
@ -322,7 +315,6 @@ class TestDenyPatternsCoverage:
def test_deny_patterns_do_not_match_safe_read_tools(self) -> None:
canonical_reads = [
"search_surfsense_docs",
"read_file",
"ls_tree",
"grep",

View file

@ -25,7 +25,6 @@ from __future__ import annotations
import asyncio
import inspect
from dataclasses import dataclass
from typing import Any
from unittest.mock import AsyncMock, patch
@ -140,45 +139,28 @@ def test_orchestrators_are_async_generator_functions() -> None:
# ------------------------------------------------------------ initial thinking
@dataclass
class _FakeSurfsenseDoc:
"""Stand-in for ``SurfsenseDocsDocument`` with just the field we read."""
title: str
@pytest.mark.parametrize(
"user_query, image_urls, docs, expected_title, expected_action",
"user_query, image_urls, expected_title, expected_action",
[
("hello world", None, [], "Understanding your request", "Processing"),
("hello world", None, "Understanding your request", "Processing"),
(
"",
["data:image/png;base64,AAA"],
[],
"Understanding your request",
"Processing",
),
("", None, [], "Understanding your request", "Processing"),
(
"doc question",
None,
[_FakeSurfsenseDoc(title="My Doc")],
"Analyzing referenced content",
"Analyzing",
),
("", None, "Understanding your request", "Processing"),
],
)
def test_initial_thinking_step_branches(
user_query: str,
image_urls: list[str] | None,
docs: list[Any],
expected_title: str,
expected_action: str,
) -> None:
step = build_initial_thinking_step(
user_query=user_query,
user_image_data_urls=image_urls,
mentioned_surfsense_docs=docs, # type: ignore[arg-type]
)
assert step.step_id == "thinking-1"
assert step.title == expected_title
@ -191,7 +173,6 @@ def test_initial_thinking_step_truncates_long_query() -> None:
step = build_initial_thinking_step(
user_query=long_query,
user_image_data_urls=None,
mentioned_surfsense_docs=[],
)
# 80-char truncation + ellipsis, sandwiched after "Processing: ".
assert "..." in step.items[0]
@ -200,16 +181,6 @@ def test_initial_thinking_step_truncates_long_query() -> None:
assert payload.startswith("x" * 80) and payload.endswith("...")
def test_initial_thinking_step_collapses_many_doc_names() -> None:
docs = [_FakeSurfsenseDoc(title=f"Doc {i}") for i in range(5)]
step = build_initial_thinking_step(
user_query="q",
user_image_data_urls=None,
mentioned_surfsense_docs=docs, # type: ignore[arg-type]
)
assert "[5 docs]" in step.items[0]
# ------------------------------------------------------------ capability gate