fix(companion): stop the relationship bond from freezing on every save - #96
Merged
MegalithOfficial merged 1 commit intoSep 6, 2026
Conversation
The relationship bond (closeness/trust/affection/tension) and the interaction counter never advanced despite many turns, while the emotional engine evolved normally. Cause: on save, resolve_companion_state_json ran merge_continuity_into_state over the session's freshly evolved companion state. That merge overwrites relationshipState with the value from the shared continuity store — so the just-evolved bond (and interaction_count) was discarded before persist_continuity_from_state could write it back, permanently resetting it to the stored/default value each turn. emotionalState survived only because the merge does not touch it. Add a pull_relationship flag to merge_continuity_into_state: - load/hydrate passes true (shared bond is the source of truth on load), - save passes it only for a fresh session with no state yet (inherit the shared bond); a session that already carries its own state keeps its authoritative, possibly-evolved bond so persist promotes it to the store. Add a regression test covering evolve -> save -> reload.
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.
The relationship bond (closeness/trust/affection/tension) and the interaction counter never advanced despite many turns, while the emotional engine evolved normally.
Cause: on save, resolve_companion_state_json ran merge_continuity_into_state over the session's freshly evolved companion state. That merge overwrites relationshipState with the value from the shared continuity store — so the just-evolved bond (and interaction_count) was discarded before persist_continuity_from_state could write it back, permanently resetting it to the stored/default value each turn. emotionalState survived only because the merge does not touch it.
Add a pull_relationship flag to merge_continuity_into_state:
Add a regression test covering evolve -> save -> reload.