Problem
The OpenVikingMemoryProvider.sync_turn() currently only receives user_content and assistant_content as plain text (truncated to 4000 chars each). This means all tool calls, tool results, and intermediate reasoning from multi-step agent turns are lost in OpenViking's session history.
The infrastructure to pass full conversation context was added in #28065 / commit 5a95fb2e1 — MemoryProvider.sync_turn() now accepts an optional messages kwarg containing the complete OpenAI-style message list for the completed turn (including tool_calls, tool role messages, etc.). However, no in-tree memory provider currently uses it.
Root Cause
OpenVikingMemoryProvider.sync_turn() at plugins/memory/openviking/__init__.py:568 has the legacy signature:
def sync_turn(self, user_content, assistant_content, *, session_id=""):
Because it doesn't declare a messages parameter, MemoryManager._provider_sync_accepts_messages() returns False, and the rich message context is never delivered.
Impact
- Tool invocations (function names, arguments) are missing from OpenViking sessions
- Tool results are not stored — the knowledge extracted via tools is invisible to OpenViking's memory extraction pipeline
- Only the final assistant text (already truncated to 4K) is persisted, significantly reducing the value of auto-extracted memories from session commits
Proposed Fix
The fix lives entirely in plugins/memory/openviking/__init__.py:
- Accept
messages: Optional[List[Dict]] in sync_turn() signature — this triggers MemoryManager to deliver the full message list
- Track
_last_message_count so we only POST the delta of new messages on each turn (avoiding re-sending the entire history every call)
- Serialize
tool_calls to a compact text form [function_name(args)] for posting to the OpenViking session API
- Include
role: "tool" messages (tool results) alongside user/assistant messages
- Skip system prompts (session-wide state, not conversational turns)
- Reset
_last_message_count on session switch (on_session_switch) and initialization
- Keep legacy fallback when
messages is not provided (backward-compatible)
Problem
The
OpenVikingMemoryProvider.sync_turn()currently only receivesuser_contentandassistant_contentas plain text (truncated to 4000 chars each). This means all tool calls, tool results, and intermediate reasoning from multi-step agent turns are lost in OpenViking's session history.The infrastructure to pass full conversation context was added in #28065 / commit
5a95fb2e1—MemoryProvider.sync_turn()now accepts an optionalmessageskwarg containing the complete OpenAI-style message list for the completed turn (includingtool_calls,toolrole messages, etc.). However, no in-tree memory provider currently uses it.Root Cause
OpenVikingMemoryProvider.sync_turn()atplugins/memory/openviking/__init__.py:568has the legacy signature:Because it doesn't declare a
messagesparameter,MemoryManager._provider_sync_accepts_messages()returnsFalse, and the rich message context is never delivered.Impact
Proposed Fix
The fix lives entirely in
plugins/memory/openviking/__init__.py:messages: Optional[List[Dict]]insync_turn()signature — this triggersMemoryManagerto deliver the full message list_last_message_countso we only POST the delta of new messages on each turn (avoiding re-sending the entire history every call)tool_callsto a compact text form[function_name(args)]for posting to the OpenViking session APIrole: "tool"messages (tool results) alongside user/assistant messages_last_message_counton session switch (on_session_switch) and initializationmessagesis not provided (backward-compatible)