From b4f1ddfcedd8c03d4837e0db7d442910d0962efe Mon Sep 17 00:00:00 2001 From: PeninsulaInd Date: Sun, 8 Mar 2026 19:18:12 -0500 Subject: [PATCH] Fix Phase 2 detection: pass original task status to create_content The scheduler sets status to "automation underway" before the tool runs, so create_content's API re-fetch never saw "outline approved". Now the scheduler passes the pre-change status via clickup_task_status arg. Co-Authored-By: Claude Opus 4.6 --- cheddahbot/scheduler.py | 1 + cheddahbot/tools/content_creation.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cheddahbot/scheduler.py b/cheddahbot/scheduler.py index 2b58cf8..ffa60e1 100644 --- a/cheddahbot/scheduler.py +++ b/cheddahbot/scheduler.py @@ -451,6 +451,7 @@ class Scheduler: try: # args already built during validation above args["clickup_task_id"] = task_id + args["clickup_task_status"] = task.status # Execute the skill via the tool registry if hasattr(self.agent, "_tools") and self.agent._tools: diff --git a/cheddahbot/tools/content_creation.py b/cheddahbot/tools/content_creation.py index 72879c3..bc070e6 100644 --- a/cheddahbot/tools/content_creation.py +++ b/cheddahbot/tools/content_creation.py @@ -771,8 +771,12 @@ def create_content( task_id = ctx.get("clickup_task_id", "") # Determine phase from ClickUp task status + # Prefer status passed by scheduler (pre-status-change) over re-fetching phase = 1 - if task_id and ctx: + original_status = ctx.get("clickup_task_status", "") + if original_status and original_status.lower() == "outline approved": + phase = 2 + elif task_id and ctx: client = _get_clickup_client(ctx) if client: try: