Add AutoCora auto-submit for today's tasks and fix pipeline issues

- Auto-submit Cora jobs for tasks due today on each autocora loop cycle
- Move ClickUp tasks to "automation underway" at submission time
- Default to blank URL for tasks missing IMSURL (new content)
- Use task Keyword field as project_name in folder watcher (not task name)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix/customer-field-migration
PeninsulaInd 2026-02-25 15:09:12 -06:00
parent bc64fae6f1
commit ada28d1655
2 changed files with 24 additions and 4 deletions

View File

@ -521,7 +521,7 @@ class Scheduler:
# ── AutoCora Result Polling ──
def _autocora_loop(self):
"""Poll for AutoCora results on a regular interval."""
"""Auto-submit jobs for today's tasks, then poll for results."""
interval = self.config.autocora.poll_interval_minutes * 60
# Wait before first poll
@ -529,6 +529,7 @@ class Scheduler:
while not self._stop_event.is_set():
try:
self._auto_submit_cora_jobs()
self._poll_autocora_results()
self.db.kv_set(
"system:loop:autocora:last_run", datetime.now(UTC).isoformat()
@ -537,6 +538,22 @@ class Scheduler:
log.error("AutoCora poll error: %s", e)
self._interruptible_wait(interval, self._force_autocora)
def _auto_submit_cora_jobs(self):
"""Auto-submit AutoCora jobs for tasks due today."""
from .tools.autocora import submit_autocora_jobs
if not self.config.clickup.api_token:
return
today = datetime.now(UTC).strftime("%Y-%m-%d")
ctx = {
"config": self.config,
"db": self.db,
"agent": self.agent,
}
result = submit_autocora_jobs(target_date=today, ctx=ctx)
log.info("AutoCora auto-submit (%s): %s", today, result)
def _poll_autocora_results(self):
"""Check for completed AutoCora results and update ClickUp tasks."""
from .tools.autocora import _parse_result
@ -757,7 +774,7 @@ class Scheduler:
args = {
"xlsx_path": str(xlsx_path),
"project_name": matched_task.name,
"project_name": matched_task.custom_fields.get("Keyword", "") or matched_task.name,
"money_site_url": money_site_url,
"custom_anchors": matched_task.custom_fields.get("CustomAnchors", "") or "",
"cli_flags": matched_task.custom_fields.get("CLIFlags", "") or "",

View File

@ -135,8 +135,7 @@ def _group_by_keyword(tasks, all_tasks):
url = task.custom_fields.get("IMSURL", "") or ""
url = str(url).strip()
if not url:
alerts.append(f"Task '{task.name}' (id={task.id}) missing IMSURL field")
continue
url = "https://seotoollab.com/blank.html"
kw_lower = keyword.lower()
if kw_lower not in groups:
@ -251,6 +250,10 @@ def submit_autocora_jobs(target_date: str = "", ctx: dict | None = None) -> str:
}
db.kv_set(kv_key, json.dumps(kv_state))
# Move ClickUp tasks to "automation underway"
for tid in group["task_ids"]:
client.update_task_status(tid, "automation underway")
submitted.append(group["keyword"])
log.info("Submitted AutoCora job: %s%s", group["keyword"], job_id)