fix(sleep): stage only documents changed by an accepted cycle - #277
fix(sleep): stage only documents changed by an accepted cycle#277Bogdan (Dan) Baciu (bogdanbaciu21) wants to merge 1 commit into
Conversation
|
Reviewed The local cycle/staging selection passes: 160 passed, 2 skipped. The new memory-only regression exercises the real cycle-to-staging path, and I have not reproduced a runtime blocker in this focused review. Recommended follow-up coverage: parameterize the new regression for skill-only, memory-only, both-changed, and neither-changed accepted results; check both manifest flags and artifact presence. Include an exact whitespace-only change as a positive case, since the documented contract is byte/text equality rather than whitespace normalization. Retain the existing live-baseline and explicit-adoption/backup guards. These are bounded coverage suggestions, not a claim that an untested symmetric case is already known to fail. Official CI on this head is still awaiting maintainer approval, and a local green slice is not a full-suite/merge approval. |
What Problem This Solves
Fixes an issue where a cycle with one accepted document change would also stage enabled documents that were unchanged. For example, a memory-only edit produced a
proposed_SKILL.mdidentical to the live skill and marked that skill as present in the manifest, adding an unrelated artifact to review and adoption.Why This Change Was Made
The cycle already retains the exact skill and memory text read before consolidation. It now compares each accepted result with that baseline and passes only changed documents to staging. The comparison is exact, so visible whitespace or text changes still stage normally.
Project Fit
User Impact
Memory-only nights stage only the memory proposal, and skill-only nights stage only the skill proposal. Users no longer need to inspect or adopt a second document that the optimizer did not change.
Proof
The regression supplies an accepted memory-only consolidation result through the real cycle and staging path. With only that regression applied to upstream
79124b37e9a6371e13b753f8bcd7adb1e493ade1, it fails becausehas_managed_skillis true. With this change, the manifest reportshas_managed_skill: falseandhas_managed_memory: true,proposed_SKILL.mdis absent, andproposed_CLAUDE.mdremains present.Local pre-publication receipt at
d115799aa7e627b702ee955f74d86993dcf1a0ee, based on that upstream commit:Academic Support
Testing
test_cycle_stages_only_documents_that_changedexercises the full cycle-to-staging boundary and checks the manifest plus both artifact paths.test_cycle_pins_the_exact_managed_skill_and_memory_bytes_it_readprotects byte fidelity, andtest_cycle_stage_then_adopt_with_backupprotects the surrounding adoption path.79124b37e9a6: failed atassertFalse(manifest["has_managed_skill"])because the value was true.git diff --check: passed.Limitations & Negative Results
This change does not rename staged memory files or alter which edits the gate accepts. It removes only exact no-op document proposals from an otherwise accepted cycle.
Reproduce It Yourself
Linux or macOS, shell from the SkillOpt repository root:
python3 -m pytest -q tests/test_sleep_engine.py -k 'cycle_stages_only_documents_that_changed or cycle_pins_the_exact_managed_skill_and_memory_bytes_it_read or cycle_stage_then_adopt_with_backup' python3 -m pytest -q