feat: replace OptimizationLoop with optimize workflow graph - #1224
Draft
xukai92 wants to merge 1 commit into
Draft
feat: replace OptimizationLoop with optimize workflow graph#1224xukai92 wants to merge 1 commit into
xukai92 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #52
Changes
factory/workflow/definitions.py): Addedoptimize_workflow()returning a 7-node DAG (baseline → gate_baseline → mutate → apply → execute → gate_improve → test_eval) registered as"optimize"in_get_builtin_registry()factory/cli/optimize_step.py): Newfactory optimize-stepwith 4 subcommands (run-dev,run-test,apply-patch,check-gate) — thin wrappers around existingHarborBenchmark, evaluators, andevaluate_gatefactory/cli/optimize.py):cmd_optimize()now writes initial state files and delegates tofactory workflow run optimize;--legacyflag preserves backward compat viaOptimizationLoop.train()factory/optimization/loop.py):OptimizationLoop.__init__()emits structlog deprecation warning — no code deletedtests/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), updatedtests/test_cli_optimize.py(--legacy routing)