Tag Leo auto-resume poll requests (#28)
Some checks are pending
CI / lint-and-test (push) Waiting to run
Some checks are pending
CI / lint-and-test (push) Waiting to run
This commit is contained in:
parent
a27b9b3440
commit
ac64fd4cf4
3 changed files with 24 additions and 0 deletions
|
|
@ -831,6 +831,7 @@ async def _poll_smart_research_auto_resume(
|
|||
message_id=msg.message_id,
|
||||
username=username,
|
||||
include_synthesis=True,
|
||||
auto_resume_poll=True,
|
||||
)
|
||||
try:
|
||||
status, proxy_body, proxy_reply = await post_chat_proxy(
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ def build_smart_research_proxy_payload(
|
|||
include_synthesis: bool = True,
|
||||
work_order_id: str | None = None,
|
||||
original_research_goal: str | None = None,
|
||||
auto_resume_poll: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
"""Build the no-secret Telegram payload for Leo smart research."""
|
||||
payload = build_chat_proxy_payload(
|
||||
|
|
@ -331,6 +332,10 @@ def build_smart_research_proxy_payload(
|
|||
payload["work_order_id"] = work_order_id
|
||||
if 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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,24 @@ def test_smart_research_payload_is_no_spend_by_default():
|
|||
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():
|
||||
payload = build_smart_research_proxy_payload(
|
||||
research_goal="what are the current discussions about MetaDAO Ranger Finance on Twitter?",
|
||||
|
|
|
|||
Loading…
Reference in a new issue