fix(pinky_memory): coerce legacy invalid reflection type on row read - #976
Open
ziomik wants to merge 2 commits into
Open
fix(pinky_memory): coerce legacy invalid reflection type on row read#976ziomik wants to merge 2 commits into
ziomik wants to merge 2 commits into
Conversation
…of crashing Dream runs occasionally call reflect() with a plausible-sounding but invalid type (observed: 'session_log'), which raised an unhandled ValueError from ReflectionType() and aborted the entire dream run rather than just failing that one memory write. Co-Authored-By: Claude Sonnet 5 <[email protected]>
reflect()'s existing fallback (invalid type -> 'fact') only guarded the write path. Any row already stored with a since-retired/renamed type (e.g. 'session_log', 'episode', 'nav_audit' from before that fix landed) still crashed ReflectionType(row["type"]) on every hydration, aborting recall/introspect and dream post-processing (prune/link) whenever that row was touched — confirmed live against seo-pro's and satoshi's own memory.db. Moves the fallback into a shared coerce_reflection_type() in types.py, used by both the write path (server.py) and row hydration (store.py).
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.
Follow-up to #965. That fix only guarded the write path (
reflect()), defaulting an unrecognizedtypetofactinstead of raising. Any row already stored with a since-retired/renamed type value (e.g.session_log,episode,nav_audit— dream-run hallucinations from before #965 landed) still crashedReflectionType(row["type"])on every hydration, abortingrecall/introspectand dream post-processing (link building, orphan pruning) whenever that row was touched.Confirmed live in production:
seo-pro's dream run failed tonight with'session_log' is not a valid ReflectionType— after the dream report itself completed successfully — because a legacy poisoned row from April got read back during post-processing. Same pattern found insatoshi's own memory.db (4 rows with type=episode).Moves the coercion into a shared
coerce_reflection_type()intypes.py, used by both the write path (server.py) and row hydration (store.py::_row_to_reflection). Adds a regression test that poisons a stored row's type directly via SQL and confirmsrecallstill returns it (coerced tofact) instead of crashing.Tested: full
pinky_memorysuite (65/65) + full repo suite (689 passed, 1 skipped) green in an isolated worktree.