Skip to content

[Phase 4] Workspace Hooks: Integration with Runtime Task Lifecycle #396

Description

@frankbria

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

  1. Load HooksConfig from workspace agents config at run start

  2. 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
  3. 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

  1. Ensure batch execution calls hooks for each task in the batch

Changes to core/workspace.py

  1. Call after_init hook after workspace initialization

Acceptance Criteria

  • before_task hook runs before agent launch in single-task execution
  • before_task hook failure aborts the run with clear error message
  • after_task_success hook runs after successful completion
  • after_task_failure hook runs after failure
  • Hooks fire correctly during batch execution (per-task, not per-batch)
  • after_init hook runs after cf init
  • Integration tests: hook fires → task succeeds, hook fails → task aborted

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestphase-4.3Phase 4.3: Workspace Lifecycle Hooks Systemsymphony-inspiredInspired by OpenAI Symphony spec analysis

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions