feat(memory): unsupersede action (thread-identity slice 4 prereq)#380
Merged
Conversation
Thread-identity slice 4 prerequisite. Adds memory(action:"unsupersede", thread_id) so the engine's unresolveThread undo path can restore facts a prior thread resolution tombstoned. - unsupersedeMemories: clears superseded_by + supersede_reason ONLY on self-tombstoned rows (superseded_by = id) carrying the thread_id. Rows superseded by a successor (replaced, not thread-tombstoned) are left closed and counted in `skipped`. Idempotent via the SQL `superseded_by = id` guard. Restores graph edges from stored entities_json for shared/global rows (mirrors storeMemory). Same visibility scope as supersede. - Tool: 'unsupersede' added to the action enum + handler. Tool description string untouched, so the catalog descriptionHash and embeddings manifest stay valid (no regeneration needed) and the tier-1 length contract holds. - Tests: 6 cases — round-trip restore, idempotency, successor-skip, thread_id-required, visibility scope, graph-edge restore. Co-Authored-By: Claude Opus 4.8 <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.
Adds
memory(action:"unsupersede", thread_id)— the undo consumer the engine'sunresolveThreadneeds to reverse a thread resolution.What
unsupersedeMemories(core/write/memory.ts): clearssuperseded_by+supersede_reasonONLY on self-tombstoned rows (superseded_by = id) carrying the thread_id. Rows superseded by a successor (replaced, not thread-tombstoned) stay closed and count inskipped. Idempotent via the SQLsuperseded_by = idguard. Restores graph edges from storedentities_jsonfor shared/global rows (mirrorsstoreMemory). Same visibility scope as supersede.unsupersedeadded to the action enum + handler.Manifest / contract safety
The tool description string is unchanged, so the catalog
descriptionHashand thetool-embeddings.generated.tsmanifest stay valid — no regeneration, and the tier-1 description-length contract holds. Verified againsttool-routing/tool-tiering/tool-countssuites (74 passed).Tests
6 new cases in
memoryUnsupersede.test.ts: round-trip restore, idempotency, successor-skip, thread_id-required, visibility scope, graph-edge restore. Full memory suite 16/16.Pre-existing
traces/no-refreshfailures (8, "MCP error … is not valid JSON") reproduce on cleanmain— sandbox artifact, unrelated to this change.🤖 Generated with Claude Code