From f5cff9d90d783c9a7a4f6a3b0975747ac24542bf Mon Sep 17 00:00:00 2001 From: worldmozara Date: Sat, 17 Oct 2026 17:13:42 +0800 Subject: [PATCH] core/agent: tell the compact summarizer that tools are unavailable --- src/plyngent/agent/compact.py | 2 ++ tests/test_agent/test_compact_summarize.py | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/plyngent/agent/compact.py b/src/plyngent/agent/compact.py index 6112155..e7055bf 100644 --- a/src/plyngent/agent/compact.py +++ b/src/plyngent/agent/compact.py @@ -30,6 +30,8 @@ _SUMMARY_SYSTEM = ( "Write a dense, factual summary that preserves: goals, decisions, " "file paths touched, commands run, open tasks, and constraints. " "Omit chit-chat and redundant tool dumps. Use short bullet sections. " + "Tool calls are unavailable in this request: do not call tools or emit " + "tool-call syntax; summarize only what the transcript contains. " "Do not invent facts not present in the transcript." ) diff --git a/tests/test_agent/test_compact_summarize.py b/tests/test_agent/test_compact_summarize.py index 290460b..8f791dc 100644 --- a/tests/test_agent/test_compact_summarize.py +++ b/tests/test_agent/test_compact_summarize.py @@ -130,6 +130,15 @@ async def test_summarize_messages() -> None: assert "world" in user_msg.content +async def test_summarize_default_prompt_says_tools_are_unavailable() -> None: + client = SummaryClient() + _ = await summarize_messages(client, [UserChatMessage(content="hi")], model="m") + assert client.last is not None + sys_msg = client.last.messages[0] + assert isinstance(sys_msg, SystemChatMessage) + assert "tool calls are unavailable" in sys_msg.content.lower() + + async def test_summarize_custom_prompts() -> None: client = SummaryClient() _ = await summarize_messages(