feat: Add public plan-then-run API, event metadata enrichment, and task tree consistency to Workforce#3979
feat: Add public plan-then-run API, event metadata enrichment, and task tree consistency to Workforce#3979fengju0213 wants to merge 9 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, reopen this pull request to trigger a review.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add public plan-then-run API and stronger event/state guarantees to Workforce
Summary
plan_task_async()→ edit →run_plan_async()task.subtasks[*].state/resultsynchronized automaticallyChanges
workforce.py:WorkforcePlandataclass — holds the task, planned subtasks, dependency graph, and planner output summary_plan_task_internal()— shared internal planning path used by both public API and existing execution flowplan_task_async()— public headless planning API returningWorkforcePlanwithout starting executionrun_plan_async(plan)— public API to execute a previously created or application-edited plan_emit_plan_events()/_append_plan_to_pending()/_finalize_task_from_subtasks()— extracted orchestration helpers_sync_task_to_parent()— keeps parenttask.subtasks[*]state/result/failure_count aligned with canonical task state_build_worker_event_metadata()— centralizes neutral worker metadata constructionTaskAssignedEvent/TaskStartedEvent/TaskCompletedEventmetadata improved so adapters do not need to reconstruct common state from private fieldsprocess_task_async()refactored to reuse_plan_task_internal()internally while preserving existing behaviorTests:
test_workforce_callbacks.py— validates event metadata population through callback flowtest_workforce.py— validates editable planning, plan execution, and parent/subtask synchronizationDesign boundary
What is intentionally in CAMEL:
What stays outside CAMEL:
Backward compatibility
process_task_async()API remains unchangedhandle_decompose_append_task()remains available and delegates internallyplan_task_async()/run_plan_async()are additive public APIs