human hand off fix

This commit is contained in:
debu-2 2026-10-06 07:42:41 +05:30
parent 7b9e574b86
commit 0981262612
5 changed files with 154 additions and 24 deletions

View file

@ -278,12 +278,13 @@ def test_human_echo_and_agent_mirror_policy():
def test_private_subject_stays_off_the_external_plane():
private = build_handoff_subject(
rule_name="Finance approvals",
sender_name="Parth Dixit",
external_sender="customer@example.com",
external_subject="Invoice 42",
)
assert private.startswith("Finance approvals · handoff ·")
assert private.startswith("Parth Dixit · handoff ·")
assert "Invoice 42" in private
assert "Finance approvals" not in private
@pytest.mark.asyncio
@ -314,7 +315,7 @@ async def test_first_matching_rule_creates_a_new_linked_handoff():
"_id": source_id,
"message_scope": MESSAGE_SCOPE_EXTERNAL,
"direction": "inbound",
"sender": {"address": "customer@example.com"},
"sender": {"name": "Parth Dixit", "address": "customer@example.com"},
"subject": "Invoice 42",
"body_text": "please review this invoice",
"snippet": "please review this invoice",
@ -331,7 +332,7 @@ async def test_first_matching_rule_creates_a_new_linked_handoff():
assert result["rule_name"] == "Finance approvals"
assert result["external_thread_id"] == external_thread_id
assert result["handoff_thread_id"]
assert result["private_subject"].startswith("Finance approvals · handoff ·")
assert result["private_subject"].startswith("Parth Dixit · handoff ·")
assert database.handoff_delivery_jobs.items[0]["kind"] == "MIRROR_TO_HUMAN"