Summary
Wire the hook execution engine into CodeFrame's runtime so hooks fire at the correct lifecycle moments during task and batch execution.
Parent issue: #392
Scope
Changes to core/runtime.py
-
Load HooksConfig from workspace agents config at run start
-
Call hooks at lifecycle points:
after_init → after cf init completes workspace setup (in workspace.py)
before_task → in start_task_run(), after creating run but before agent launch
after_task_success → in complete_run(), after task transitions to DONE
after_task_failure → in fail_run(), after task transitions to FAILED
before_remove → not currently applicable (CodeFrame doesn't auto-remove workspaces), wire as future extension point
-
Failure handling:
before_task failure → abort the run, transition task to FAILED with hook error context
after_task_* failures → log warning, continue
Changes to core/conductor.py
- Ensure batch execution calls hooks for each task in the batch
Changes to core/workspace.py
- Call
after_init hook after workspace initialization
Acceptance Criteria
Dependencies
Summary
Wire the hook execution engine into CodeFrame's runtime so hooks fire at the correct lifecycle moments during task and batch execution.
Parent issue: #392
Scope
Changes to
core/runtime.pyLoad
HooksConfigfrom workspace agents config at run startCall hooks at lifecycle points:
after_init→ aftercf initcompletes workspace setup (inworkspace.py)before_task→ instart_task_run(), after creating run but before agent launchafter_task_success→ incomplete_run(), after task transitions to DONEafter_task_failure→ infail_run(), after task transitions to FAILEDbefore_remove→ not currently applicable (CodeFrame doesn't auto-remove workspaces), wire as future extension pointFailure handling:
before_taskfailure → abort the run, transition task to FAILED with hook error contextafter_task_*failures → log warning, continueChanges to
core/conductor.pyChanges to
core/workspace.pyafter_inithook after workspace initializationAcceptance Criteria
before_taskhook runs before agent launch in single-task executionbefore_taskhook failure aborts the run with clear error messageafter_task_successhook runs after successful completionafter_task_failurehook runs after failureafter_inithook runs aftercf initDependencies