Skip to content

Consolidate Dev Loop workflow — extract phase pipeline from workflow class #153

@devloop-bot

Description

@devloop-bot

Parent

#149

What to build

The Dev Loop workflow module is one 400+ line module with 5 async methods, all sharing the same workflow class state. The interface surface — every method a caller or test must understand — nearly matches the implementation complexity. Testing one phase means instantiating the entire workflow and mocking every other method.

Extract a deep PhasePipeline module that exposes one interface: run(plan_phase, execute_phase, review_phase, notifier). Each phase becomes a standalone deep module with a small interface. The workflow class shrinks to dependency injection — it wires the pipeline but doesn't implement the loop.

Create these deep modules:

  1. PhasePipeline — The orchestration loop: run(plan_phase, execute_phase, review_phase, notifier). Controls phase ordering, CI cycle, and notification.
  2. PlanPhaseexecute(task_spec, by_repo, client) -> TaskSpec. Wraps the existing _plan_phase activity call.
  3. ExecutePhaseexecute(task_spec, by_repo, client) -> TaskSpec. Wraps the existing _execute_phase activity call.
  4. ReviewPhaseexecute(task_spec, by_repo, client) -> CIChecksResult. Wraps the existing _review_phase activity call.
  5. ReviewFixPassexecute(revise_prompt, ...) -> CIChecksResult. The mid-review fix loop logic.
  6. CICyclerun(fix_attempts) -> CIChecksResult. Reusable CI fix cycle (also used by PRCommentWorkflow).
  7. Notifiernotify(review_result). Wraps _post_github_comment and summary notification.

The workflow class (DevLoopWorkflow) becomes a thin adapter that injects these phases into the pipeline. The same pattern applies to PRCommentWorkflow — both can share the CICycle module.

Acceptance criteria

  • PhasePipeline module exists with run(plan, execute, review, notifier) interface
  • PlanPhase, ExecutePhase, ReviewPhase, ReviewFixPass, CICycle, Notifier each exist as standalone deep modules
  • DevLoopWorkflow shrinks to dependency injection — wires phases into pipeline, doesn't implement loop
  • CICycle is shared between DevLoopWorkflow and PRCommentWorkflow (or PRCommentWorkflow uses it)
  • Each phase can be tested independently — no need to instantiate the full workflow
  • All existing workflow behavior preserved — same phase ordering, same activity calls, same CI fix logic
  • Unit tests pass with no regression in workflow execution

Blocked by

  • None - can start immediately

Note: After shared.py is split (issue #150), the Phase, JobStatus, and CIChecksResult types used by these modules will come from their dedicated sub-modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyReady for autonomous agent to implement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions