fix: harmony auto-apply reports success but silently discards the resolution
muse#93, documented as a known bug in docs/agent-guide.md's Harmony section since 2026-09-12 (musehub staging#93) -- data integrity, not cosmetic: `muse merge`'s harmony auto-apply path printed "auto-resolved" and bumped the resolution's applied_count, but the actual committed content (and the working tree) stayed "ours", discarding the recorded, human-verified resolution entirely.
Root cause: auto_apply() (muse/core/harmony/engine.py) returns a dict keyed by the *original conflict path*, which for the code domain is a symbol address ("calc.py::add"), not a plain file path -- this part was already correct and well-tested (tests/test_harmony_integration.py's TestAutoApplySymbolPaths covers it). The bug was one level up, in merge.py's `merged_files.update(harmony_resolved)`: merged_files is keyed by plain file paths, same as every other manifest in this function. Updating with the raw symbol-addressed keys inserted a bogus "calc.py::add" entry into a file-path-keyed dict while leaving the real "calc.py" entry untouched at its stale pre-harmony value. That stale value is what got written to the working tree (via a later apply_manifest call using this same manifest) and committed.
Existing tests didn't catch this because they test auto_apply() directly at the unit level -- correctly proving IT returns the right {symbol_path: outcome_blob} mapping -- never exercising the full `muse merge` CLI flow where that mapping gets folded into the file-path-keyed manifest that's actually committed.
Fix: re-key harmony_resolved to plain file paths (`p.split("::")[0]`) before merging into merged_files -- one line, matching the same path.split("::")[0] convention already used throughout this file and auto_apply itself for extracting the file portion of a symbol address.
Test: new tests/test_harmony_merge_commit_integrity.py, reproducing the exact scenario from the ticket end-to-end through the real CLI (not synthetic objects) -- two branches conflict on the same symbol, resolve manually to a THIRD value differing from both "ours" and "theirs", confirm harmony recorded it, reproduce the identical conflict pattern on a fresh branch pair, and assert the merge reports "merged" (not "conflict") with the working tree AND the actual committed object (read via `muse cat`, not just the working tree) matching the recorded resolution -- not either original side. Confirmed genuine RED against the unfixed code (working tree showed "+1" where "+101" was expected) before applying the fix.
Full harmony + merge regression suite (797 tests across every harmony and merge test file): zero regressions.
Verified against the real CLI (muse-dev) before writing the automated test: reproduced the bug live (committed object confirmed via `muse cat-object`/`muse cat` to contain "ours", not the recorded resolution), then confirmed the fix live the same way.
Audited (ticket's own ask #4) whether musehub's server-side merge path shares this bug -- separate report, see follow-up comment on the ticket.
Semantic Changes
13 symbols
Files Changed
+1
~1
1214 in snapshot
0 comments
muse hub commit comment sha256:aa1523d6dd71d33a7ad57b3c6430556bdfba58cefb95cc85b95a3904932d2749 --body "your comment"
No comments yet. Be the first to start the discussion.