Skip overlapping scheduled runs and surface playbook status in job lists.

Due ticks no longer stack on an active run (WA skip notice + stale clear); schedule_list/admin/gateway now show playbook, steps_n, and last_run signals without dumping full recipes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-11 00:07:42 +08:00
parent 51eef09801
commit 9d4dced4e4
9 changed files with 487 additions and 18 deletions

View file

@ -470,13 +470,22 @@ def schedule_list_tool() -> ToolSpec:
status = str(args.get("status") or "").strip() or None
limit = int(args.get("limit") or 50)
rows = store.scheduled_job_list(tenant_id=tenant_id, status=status, limit=limit)
return {"ok": True, "items": [store.scheduled_job_to_dict(r) for r in rows]}
items: list[dict[str, Any]] = []
for r in rows:
d = store.scheduled_job_to_dict(r)
# List view: keep playbook signals, drop bulky recipe bodies for the LLM.
d.pop("recipe", None)
items.append(d)
return {"ok": True, "items": items}
except Exception as e:
return {"ok": False, "error": f"{type(e).__name__}: {e}"}
return ToolSpec(
name="schedule_list",
description="List scheduled jobs for a tenant.",
description=(
"List scheduled jobs for a tenant. Each item includes playbook/has_recipe/steps_n/"
"recipe_goal/last_run_status (full recipe bodies omitted; open the job detail for the full recipe)."
),
parameters={
"type": "object",
"properties": {