feat(workflows): implement RunActivityWorkflow — T18

workflows.py — RunActivityWorkflow:
  1. load_activity_definition(activity_id)
  2. resolve_context(context_sources)
  3. evaluate_templates (pure, called in-workflow)
  4. log_run({run_id, ...}) — run_id = uuid5(NAMESPACE_URL, activity_id:trigger_key)
  5. start_child_workflow(TaskExecutorWorkflow, ...) per task spec
     ABANDON parent-close policy (fire-and-forget)
  Returns {"run_id": str, "tasks_spawned": int}

activities.py — log_run updated:
  - now accepts run_id in run_payload (deterministic, passed from workflow)
  - uses pg INSERT ... ON CONFLICT (run_id) DO NOTHING for idempotency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-26 22:25:19 +00:00
parent 068780224e
commit da7de6ea3b
3 changed files with 109 additions and 23 deletions

View File

@@ -76,7 +76,7 @@ tasks:
state_hub_task_id: e019cb5a-adf0-4a5d-9410-c41810128190
- id: T18
title: Implement RunActivityWorkflow
status: todo
status: done
state_hub_task_id: fb6b3440-47d2-4b0a-97c1-6e780cc497c4
- id: T19
title: Implement TaskExecutorWorkflow (stub)