Skip to content

feat: replace OptimizationLoop with optimize workflow graph - #1224

Draft
xukai92 wants to merge 1 commit into
feat/inner-outer-loop-v1from
factory/run-60a64c14
Draft

feat: replace OptimizationLoop with optimize workflow graph#1224
xukai92 wants to merge 1 commit into
feat/inner-outer-loop-v1from
factory/run-60a64c14

Conversation

@xukai92

@xukai92 xukai92 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Closes #52

Changes

  • Workflow graph definition (factory/workflow/definitions.py): Added optimize_workflow() returning a 7-node DAG (baseline → gate_baseline → mutate → apply → execute → gate_improve → test_eval) registered as "optimize" in _get_builtin_registry()
  • CLI helper (factory/cli/optimize_step.py): New factory optimize-step with 4 subcommands (run-dev, run-test, apply-patch, check-gate) — thin wrappers around existing HarborBenchmark, evaluators, and evaluate_gate
  • Workflow wiring (factory/cli/optimize.py): cmd_optimize() now writes initial state files and delegates to factory workflow run optimize; --legacy flag preserves backward compat via OptimizationLoop.train()
  • Deprecation warning (factory/optimization/loop.py): OptimizationLoop.__init__() emits structlog deprecation warning — no code deleted
  • Tests: tests/test_workflow_optimize.py (27 tests: graph structure, edges, validation, registry, reads/writes, paths), tests/test_optimize_step.py (18 tests: apply-patch JSON/regex parsing, check-gate verdicts, state read/write, parser), updated tests/test_cli_optimize.py (--legacy routing)

Add optimize_workflow() as a 7-node DAG in the workflow engine,
unifying the optimization pipeline with all other factory modes.

- Add workflow graph: baseline → gate_baseline → mutate → apply →
  execute → gate_improve (RELOOP max 5) → test_eval
- Add `factory optimize-step` CLI with 4 subcommands (run-dev,
  run-test, apply-patch, check-gate) as thin wrappers around
  existing HarborBenchmark, evaluators, and evaluate_gate
- Wire `factory optimize` to call `factory workflow run optimize`
  with --legacy flag for backward compat via OptimizationLoop
- Add structlog deprecation warning to OptimizationLoop.__init__()
- Add tests for workflow graph structure, optimize-step logic,
  and --legacy CLI routing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant