pinky_memory: reflect() falls back to 'fact' on invalid type instead of crashing - #965
Open
ziomik wants to merge 1 commit into
Open
pinky_memory: reflect() falls back to 'fact' on invalid type instead of crashing#965ziomik wants to merge 1 commit into
ziomik wants to merge 1 commit 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 <noreply@anthropic.com>
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.
Problem
reflect()andreflect_for()insrc/pinky_memory/server.pybuilt theirReflectInputwith a bareReflectionType(type). A caller passing an unrecognized value raised an unhandledValueError.This is not hypothetical: dream runs occasionally invent a plausible-sounding but invalid type (observed in the wild:
session_log). Because the exception propagated out of the tool call, a single bad memory write aborted the entire dream run rather than failing just that one write.Fix
Add
_parse_reflection_type(), which coerces the caller-supplied string to aReflectionTypeand falls back tofacton an unrecognized value, logging the coercion to stderr. Bothreflect()andreflect_for()now use it.The failure mode goes from "lose the whole dream run" to "one memory is filed as
factand the log says why".Testing
test_reflect_invalid_type_falls_back_to_fact— regression test passingtype="session_log", asserting the write succeeds and lands asfact.pytest tests/test_memory_server.py→ 64 passedruff checkon both touched files → cleanNotes
🤖 Opened by Engineer