fix(memory): add write origin metadata seam#15346
Merged
Merged
Conversation
19 tasks
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.
Salvage of #15315 by @helix4u — core seam only, bundled plugins untouched.
Summary
External memory providers can now opt into structured write-origin metadata (write_origin, execution_context, session_id, parent_session_id, platform, tool_name, task_id, tool_call_id) by widening their
on_memory_writeto acceptmetadata=None. Resolves #15219.Changes (5 files, +184/-5)
agent/memory_provider.py: ABC widened with optionalmetadatakwarg.agent/memory_manager.py: signature sniffer routes each provider tokeyword/positional/legacybranch — legacy 3-arg providers keep working unchanged.run_agent.py:_build_memory_write_metadata()helper + provenance wiring at 3 call sites (foreground memory tool, background-review forked agent, flush_memories).Not changed
Bundled memory providers (byterover, holographic, honcho, openviking, retaindb, supermemory) stay on their 3-arg signature. The sniffer routes all of them to the legacy branch — zero behavior change. Third-party providers opt in by adding
metadata=Nonewhen they have a use case.Validation
{write_origin, execution_context, session_id, parent_session_id, platform, tool_name, ...}Targeted tests: 71/71 pass (
tests/agent/test_memory_provider.py,tests/run_agent/test_flush_memories_codex.py). Plugin tests: 187/188 pass; the 1 failure is pre-existing on main (hindsight setup test, unrelated).Closes #15219.