Tag Leo auto-resume poll requests (#28)
Some checks are pending
CI / lint-and-test (push) Waiting to run

This commit is contained in:
twentyOne2x 2026-07-01 00:47:36 +02:00 committed by GitHub
parent a27b9b3440
commit ac64fd4cf4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 0 deletions

View file

@ -831,6 +831,7 @@ async def _poll_smart_research_auto_resume(
message_id=msg.message_id, message_id=msg.message_id,
username=username, username=username,
include_synthesis=True, include_synthesis=True,
auto_resume_poll=True,
) )
try: try:
status, proxy_body, proxy_reply = await post_chat_proxy( status, proxy_body, proxy_reply = await post_chat_proxy(

View file

@ -306,6 +306,7 @@ def build_smart_research_proxy_payload(
include_synthesis: bool = True, include_synthesis: bool = True,
work_order_id: str | None = None, work_order_id: str | None = None,
original_research_goal: str | None = None, original_research_goal: str | None = None,
auto_resume_poll: bool = False,
) -> dict[str, Any]: ) -> dict[str, Any]:
"""Build the no-secret Telegram payload for Leo smart research.""" """Build the no-secret Telegram payload for Leo smart research."""
payload = build_chat_proxy_payload( payload = build_chat_proxy_payload(
@ -331,6 +332,10 @@ def build_smart_research_proxy_payload(
payload["work_order_id"] = work_order_id payload["work_order_id"] = work_order_id
if original_research_goal: if original_research_goal:
payload["original_research_goal"] = original_research_goal payload["original_research_goal"] = original_research_goal
if auto_resume_poll:
metadata = payload.setdefault("metadata", {})
if isinstance(metadata, dict):
metadata["auto_resume_poll"] = True
return payload return payload

View file

@ -118,6 +118,24 @@ def test_smart_research_payload_is_no_spend_by_default():
assert "secret" not in str(payload).lower() assert "secret" not in str(payload).lower()
def test_smart_research_payload_marks_auto_resume_poll_without_secret_material():
payload = build_smart_research_proxy_payload(
research_goal="Find x402 evidence",
source="telegram",
agent="leo",
chat_id=123,
message_id=456,
username="tester",
auto_resume_poll=True,
)
assert payload["metadata"]["auto_resume_poll"] is True
assert payload["allow_paid_execution"] is False
assert "approval_ref" not in payload
assert "token" not in str(payload).lower()
assert "secret" not in str(payload).lower()
def test_smart_research_payload_can_resume_paid_work_order_without_secret_material(): def test_smart_research_payload_can_resume_paid_work_order_without_secret_material():
payload = build_smart_research_proxy_payload( payload = build_smart_research_proxy_payload(
research_goal="what are the current discussions about MetaDAO Ranger Finance on Twitter?", research_goal="what are the current discussions about MetaDAO Ranger Finance on Twitter?",