feat: antropic model added fix & kb tooling fixes

- Updated main-agent middleware to clarify that both filesystem reads/writes and knowledge-base retrieval are handled by the `knowledge_base` subagent.
- Introduced `_forward_mention_pins` function to carry `@`-mention pins into subagent state.
- Revised system prompts to reflect the new retrieval method and ensure proper citation handling.
- Removed the `search_knowledge_base` tool and its related tests, consolidating functionality under the `task` tool.
- Enhanced documentation to guide usage of the new retrieval approach and citation practices.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-06-25 20:19:44 -07:00
parent b4af67f77d
commit 9642d7ced0
36 changed files with 581 additions and 168 deletions

View file

@ -7,8 +7,8 @@ import pytest
from app.agents.chat.runtime.referenced_chat_context import (
ReferencedChat,
render_referenced_chats_block,
transcript as transcript_mod,
)
from app.agents.chat.runtime.referenced_chat_context import transcript as transcript_mod
from app.agents.chat.runtime.referenced_chat_context.models import ReferencedChatTurn
pytestmark = pytest.mark.unit
@ -77,9 +77,7 @@ def test_oversized_single_turn_is_partially_filled_to_use_budget(
) -> None:
monkeypatch.setattr(transcript_mod, "_MAX_CHARS_PER_REFERENCE", 40)
block = render_referenced_chats_block(
[_chat(1, "T", [("assistant", "x" * 500)])]
)
block = render_referenced_chats_block([_chat(1, "T", [("assistant", "x" * 500)])])
assert block is not None
# The turn is too big to keep whole, so its tail fills the budget with a

View file

@ -3,13 +3,28 @@
from __future__ import annotations
import pytest
from langchain_core.messages import AIMessage
from langchain_core.messages import AIMessage, SystemMessage
from app.agents.chat.runtime.llm_config import _sanitize_messages
pytestmark = pytest.mark.unit
def test_sanitize_messages_drops_whitespace_only_system_text_block() -> None:
# Mirrors TodoListMiddleware appending ``{"type":"text","text":"\n\n"}`` to
# the system message: Anthropic rejects whitespace-only system blocks.
original = SystemMessage(
content=[
{"type": "text", "text": "real system prompt"},
{"type": "text", "text": "\n\n"},
]
)
sanitized = _sanitize_messages([original])
assert sanitized[0].content == "real system prompt"
def test_sanitize_messages_strips_provider_specific_thinking_blocks() -> None:
original = AIMessage(
content=[