skip redundant synthesis after email actions

This commit is contained in:
pewdiepie-archdaemon
2026-09-17 13:21:11 +00:00
parent 10d637f8b9
commit 337a47d27d
2 changed files with 47 additions and 1 deletions
@@ -4,6 +4,7 @@ from mcp_servers.email_server import _extract_text as mcp_extract_text
from routes.email_helpers import _extract_text as route_extract_text
from src.agent_loop import (
_email_fact_lookup_requested,
_email_lookup_needs_post_synthesis,
_email_lookup_request_from_messages,
_email_read_evidence_from_tool_output,
)
@@ -45,6 +46,20 @@ def test_email_fact_lookup_does_not_capture_explicit_read_request():
assert not _email_fact_lookup_requested("Read the email to me")
def test_successful_draft_suppresses_redundant_email_lookup_synthesis():
events = [
{"tool": "mcp__email__read_email", "exit_code": 0, "output": "Price: $42"},
{"tool": "mcp__email__draft_email", "exit_code": 0, "output": "Draft created"},
]
assert not _email_lookup_needs_post_synthesis(
"Read the bid, determine the winner, and draft a recommendation", events
)
assert _email_lookup_needs_post_synthesis(
"What price was quoted in the email?", events[:1]
)
def test_email_lookup_evidence_strips_html_and_is_bounded():
raw = (
"**Subject:** Property settlement\n"