Skip to content

fix(trainer): validate skill-aware appendix notes through candidate evaluation and gate (#468) - #496

Open
RohithPariki wants to merge 1 commit into
microsoft:mainfrom
RohithPariki:auto-fix-468
Open

RohithPariki wants to merge 1 commit into
microsoft:mainfrom
RohithPariki:auto-fix-468

Conversation

@RohithPariki

Copy link
Copy Markdown
Contributor

Summary

Fixes #468.

Previously, when use_skill_aware_reflection: true, _flush_skill_aware_appendix wrote EXECUTION_LAPSE notes into current_skill after the selection evaluation and gate decision (and directly into current_skill on skip_no_patches and skip_no_rewrite branches). As a result, rejected or skipped steps still mutated current_skill, current_score no longer matched current_skill, and unvalidated notes accumulated in the final skill.

Changes

  1. Pre-gate candidate merge (skillopt/engine/trainer.py):
    • Merged _flush_skill_aware_appendix into candidate_skill before candidate_skill.md is saved, cand_hash is computed, and selection evaluation/gating runs (controlled by skill_aware_gate_appendix: true by default).
    • Removed the post-gate _flush_skill_aware_appendix write into current_skill when skill_aware_gate_appendix is enabled, so rejected candidates discard their appendix notes cleanly and current_score always matches current_skill.
  2. Notes-only candidates on skip branches (skillopt/engine/trainer.py):
    • On skip_no_patches and skip_no_rewrite paths, when use_skill_aware_reflection produces new appendix notes that change the skill, a notes_only_candidate is constructed and routed through the normal selection evaluation and gate instead of mutating current_skill unchecked.
    • Initialized ranked_patch and ranked_items before if not notes_only_step: so rejected notes-only steps do not hit UnboundLocalError.
  3. Consolidation failure observability (skillopt/engine/trainer.py):
    • When consolidate_appendix_notes fails or does not shrink the appendix above skill_aware_consolidate_threshold, records step_rec["appendix_consolidation_skipped"] = True and logs a clear message.
  4. Regression tests (tests/test_skill_aware_gate_appendix.py):
    • Added 4 deterministic unit tests covering rejected steps, accepted steps, notes-only steps, and consolidation failure tracking.

Verification

  • python -m unittest tests/test_skill_aware_gate_appendix.py — 4 passed
  • python tests/test_skill_aware_reflection.py — 7/7 passed

This branch has not been deployed

No deployments
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.

【BUG】Skill-aware reflection: appendix notes are written to current_skill after the gate and never validated

1 participant