diff --git a/cheddahbot/tools/content_creation.py b/cheddahbot/tools/content_creation.py index f2aafae..7202e7e 100644 --- a/cheddahbot/tools/content_creation.py +++ b/cheddahbot/tools/content_creation.py @@ -607,9 +607,27 @@ def _run_phase2( log.warning("Could not read outline at %s: %s", outline_path, e) if not outline_text: + # Reset task to "to do" so it can be retried after re-running Phase 1 + if task_id and ctx: + client = _get_clickup_client(ctx) + if client: + try: + reset_status = config.clickup.poll_statuses[0] if config.clickup.poll_statuses else "to do" + client.update_task_status(task_id, reset_status) + client.add_comment( + task_id, + f"⚠️ Outline file not found for keyword '{keyword}'. " + f"Searched: {outline_path or '(no path saved)'}. " + f"Please re-run Phase 1 (create_content) to generate a new outline.", + ) + except Exception as e: + log.warning("Failed to reset task %s after missing outline: %s", task_id, e) + finally: + client.close() return ( - "Error: Could not read the outline file. " - f"Expected at: {outline_path or '(no path saved)'}" + "Error: Outline file not found. " + f"Searched at: {outline_path or '(no path saved)'}. " + f"Please re-run Phase 1 (create_content) to generate a new outline." ) # Use saved cora_path from state if we don't have one now