Class: Ocak::PipelineExecutor

Inherits:
Object
  • Object
show all
Includes:
ParallelExecution, Planner, StateManagement, StepComments, StepExecution, Verification
Defined in:
lib/ocak/pipeline_executor.rb

Constant Summary

Constants included from Planner

Ocak::Planner::STEP_PROMPTS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ParallelExecution

#collect_parallel_group, #run_parallel_group

Methods included from StepExecution

#execute_step, #handle_already_completed, #record_skipped_step, #run_single_step, #skip_reason

Methods included from StateManagement

#accumulate_state, #check_cost_budget, #check_step_failure, #log_cost_summary, #record_step_result, #save_report, #save_step_progress, #sync, #update_pipeline_state, #write_step_output

Methods included from StepComments

#post_step_comment, #post_step_completion_comment

Methods included from Planner

#build_step_prompt, #parse_planner_output, #plan_batches, #sequential_batches

Methods included from Verification

#lint_extensions_for, #run_final_checks, #run_scoped_lint, #run_verification_with_retry

Constructor Details

#initialize(config:, issues: nil, shutdown_check: nil) ⇒ PipelineExecutor

Returns a new instance of PipelineExecutor.



25
26
27
28
29
# File 'lib/ocak/pipeline_executor.rb', line 25

def initialize(config:, issues: nil, shutdown_check: nil)
  @config = config
  @issues = issues
  @shutdown_check = shutdown_check
end

Instance Attribute Details

#issues=(value) ⇒ Object (writeonly)

Sets the attribute issues

Parameters:

  • value

    the value to set the attribute issues to.



23
24
25
# File 'lib/ocak/pipeline_executor.rb', line 23

def issues=(value)
  @issues = value
end

Instance Method Details

#run_pipeline(issue_number, logger:, claude:, chdir: nil, skip_steps: [], complexity: 'full', steps: nil, verification_model: nil, post_start_comment: true, post_summary_comment: true, skip_merge: false) ⇒ Object

rubocop:disable Metrics/ParameterLists



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ocak/pipeline_executor.rb', line 31

def run_pipeline(issue_number, logger:, claude:, chdir: nil, skip_steps: [], complexity: 'full', # rubocop:disable Metrics/ParameterLists
                 steps: nil, verification_model: nil,
                 post_start_comment: true, post_summary_comment: true,
                 skip_merge: false)
  @logger = logger
  @custom_steps = steps
  @verification_model = verification_model
  @post_summary_comment = post_summary_comment
  @skip_merge = skip_merge
  chdir ||= @config.project_dir
  logger.info("=== Starting pipeline for issue ##{issue_number} (#{complexity}) ===")

  report = RunReport.new(complexity: complexity)
  state = build_initial_state(complexity, report)
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  post_pipeline_start_comment(issue_number, state) if post_start_comment

  failure = run_pipeline_steps(issue_number, state, logger: logger, claude: claude, chdir: chdir,
                                                    skip_steps: skip_steps)
  log_cost_summary(state[:total_cost], logger)

  return handle_interrupted(issue_number, state, report, logger) if state[:interrupted]
  return handle_failure(issue_number, state, failure, report, start_time) if failure

  failure = run_final_verification(issue_number, logger: logger, claude: claude, chdir: chdir)
  return handle_failure(issue_number, state, failure, report, start_time) if failure

  pipeline_state.delete(issue_number)
  finish_success(issue_number, state, report, start_time, logger)
end