Fix 8: Reset task to 'to do' when outline file is missing
When Phase 2 cannot find the outline file at any of the searched locations, the task is now reset to its initial poll status in ClickUp with a comment explaining the issue and suggesting a Phase 1 re-run. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>fix/customer-field-migration
parent
1eb7df6143
commit
9a3ba54974
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue