core/agent: tell the compact summarizer that tools are unavailable

This commit is contained in:
2026-10-17 17:13:42 +08:00
parent eef1d3cd29
commit f5cff9d90d
2 changed files with 11 additions and 0 deletions
+2
View File
@@ -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."
)
@@ -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(