fix: resolve 8+ char id prefixes in memory_forget and memory_update#955
Draft
gorkem2020 wants to merge 4 commits into
Draft
fix: resolve 8+ char id prefixes in memory_forget and memory_update#955gorkem2020 wants to merge 4 commits into
gorkem2020 wants to merge 4 commits into
Conversation
…pdate memory_update's contract has always said 'full UUID or 8+ char prefix', and injected context shows agents truncated row ids, but the uuid detection regex accepted a bare 8-char prefix as a complete id, so prefix-addressed forget/update went to the store as an exact-id lookup and always failed 'not found or access denied' (live-caught: an agent honestly reported its own failed deletions). The shared resolver now strips the trailing ellipsis agents copy from context, passes full UUIDs through unchanged, resolves hex-shaped 8-35 char refs via the new scope-filtered store.findByIdPrefix (unique match wins, multiple matches list candidates, zero is an honest not-found), and falls back to semantic search for everything else. memory_forget's direct-ID branch and memory_update's inline copy both route through it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit 91b75f5)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
gorkem2020
force-pushed
the
fix/memory-id-prefix-resolution
branch
from
July 18, 2026 15:53
f1055d8 to
d6b01a3
Compare
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
memory_update's parameter description has always promised "full UUID or 8+ char prefix", and agents naturally copy row ids out of injected context, where they are truncated (often with a trailing ellipsis, e.g.
407dec9c...). But the uuid detection regex accepted a bare 8-char prefix as a complete id, so a prefix-addressed forget or update went to the store as an exact-id lookup and always failed with "not found or access denied".This was caught live: an agent asked to delete a specific memory called memory_forget with the truncated ids it could see, got "not found" twice, and honestly reported that the deletion did not go through while the fact kept surfacing from its context.
Fix
store.findByIdPrefix(prefix, scopeFilter, limit): a LIKE lookup for hex-shaped 8-35 char prefixes, capped, with the same per-row scope accessibility check the other read paths use.resolveMemoryIdresolver now strips a trailing ellipsis, passes full UUIDs through unchanged, resolves hex-shaped refs as id prefixes (a unique match wins, multiple matches list candidates, zero matches is an honest not-found), and falls back to semantic search for everything else.memory_forget's direct-ID branch andmemory_update's inline copy of the resolution logic both route through the shared resolver.Tests
test/memory-id-prefix-resolution.test.mjsdrives the real registered tools against a real temp LanceDB store: prefix delete, ellipsis tolerance, full-UUID unchanged, ambiguity lists candidates without resolving, unmatched prefix deletes nothing, and prefix-addressed update supersedes with the new text. Registered in the CI chain and manifest.🤖 Generated with Claude Code