Serialize the full OptKnob spec into the IR + fix KNOB_MUTATE - #1499
Merged
Merged
Conversation
Two defects stopped the highest-weight operator (KNOB_MUTATE, 0.25) from ever contributing to the swarm: - _deep_copy_workflow dropped knob_specs (and task/declared_capabilities) when copying a workflow for mutation, so children lost their OptKnob declarations. - structural_hash excluded knob_values and NoveltyFilter.is_novel rejected any workflow whose graph-edit-distance to an archived candidate was below threshold, even when only knob values differed, so every knob-only mutation was discarded as a near-duplicate. Include knob_values in structural_hash, preserve knob_specs across deep copies, and only apply the edit-distance near-duplicate check when knob_values match.
Sentrux Quality ReportAbsoluteDiff (vs base branch) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1499 +/- ##
==========================================
+ Coverage 83.62% 83.74% +0.12%
==========================================
Files 225 225
Lines 25447 25757 +310
Branches 4138 4209 +71
==========================================
+ Hits 21280 21571 +291
- Misses 3202 3204 +2
- Partials 965 982 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What
Two changes that make
KNOB_MUTATE(the highest-weight outer-loop operator, 0.25) actually contribute to the swarm:knob_specsin the IR —Workflownow carries a fullknob_specstable (kind/node_id/default/bounds/expandable/expansion_hint/description) besideknob_values/knob_bounds.to_dict()serializes it,from_dict()reconstructs it, andPackage.compile()populates it.KNOB_MUTATEsurvives mutation + novelty filtering — two defects silently discarded every knob-only mutation:_deep_copy_workflowdroppedknob_specs(andtask/declared_capabilities), so children lost their OptKnob declarations.structural_hashexcludedknob_valuesandNoveltyFilter.is_novelrejected any workflow whose graph-edit-distance to an archived candidate was below threshold — even when only knob values differed. Nowstructural_hashincludesknob_values, and the near-duplicate check only applies whenknob_valuesmatch.Why
Without these, KNOB_MUTATE was selected ~25% of the time but its results were always rejected as "duplicates", so the operator was dead weight.
Tests
pytest tests/test_outer_loop/test_similarity.py tests/test_outer_loop/test_mutations.py tests/test_outer_loop/test_engine.py tests/test_outer_loop/test_seed_diversity.py tests/test_outer_loop/test_reflector.py— 174 passed.