fix(openviking): preserve structured turn sync attribution - #48894
fix(openviking): preserve structured turn sync attribution#48894ehz0ah wants to merge 3 commits into
Conversation
|
Related: #37251 (structured turn sync implementation, cherry-picked here with authorship preserved), #34763 (full turn-context sync feature request). This PR supersedes both by adding the OpenViking attribution + structured-text-flattening fixes (input_text/output_text preservation, assistant-owned ToolPart payloads, peer_id scoping) the earlier path lacked. |
|
Thanks for the clean salvage here, @ehz0ah — the cherry-pick of #37251 is faithful (identical I reviewed the full PR and verified every claim (faithful cherry-pick, real supersession of #34763/#37251, correct
I've carried all of your commits forward verbatim (authorship preserved) and added a single follow-up commit with those two fixes plus a mutation-checked regression test in #48924. Closing this in favor of that PR so the fixes ride along. Full credit to you, @huangxun375-stack (#37251), and @pty819 (#34763) — all preserved in the salvage branch. |
…-sync fix(openviking): structured turn sync — guard empty tool_id, reuse env_var_enabled (salvage #48894)
…4-structured-sync fix(openviking): structured turn sync — guard empty tool_id, reuse env_var_enabled (salvage NousResearch#48894)
…4-structured-sync fix(openviking): structured turn sync — guard empty tool_id, reuse env_var_enabled (salvage NousResearch#48894)
…4-structured-sync fix(openviking): structured turn sync — guard empty tool_id, reuse env_var_enabled (salvage NousResearch#48894)
…4-structured-sync fix(openviking): structured turn sync — guard empty tool_id, reuse env_var_enabled (salvage NousResearch#48894)
…4-structured-sync fix(openviking): structured turn sync — guard empty tool_id, reuse env_var_enabled (salvage NousResearch#48894)
What does this PR do?
Supersedes #34763 and #37251. The structured-sync implementation from #37251 was cherry-picked into this branch with the original authorship preserved, then followed up with fixes for OpenViking attribution and structured text handling.
This makes OpenViking structured turn sync preserve the data OpenViking needs long-term: Responses-format text parts, assistant-owned tool results, and Hermes peer attribution.
The original structured sync path added
messages/batchsupport andToolPartpayloads, but still had two correctness gaps:input_text/output_textwere dropped by the OpenViking provider's local text extraction.This PR centralizes Hermes message text flattening, reuses it from the OpenViking provider, and makes the Codex app-server runtime pass the canonical
messagestranscript through to memory sync so OpenViking can store tool calls/results instead of falling back to plain user/assistant text.Related Issue
Supersedes #34763 and #37251. The #37251 implementation commit was cherry-picked with authorship preserved.
Type of Change
Changes Made
agent/message_content.pywith a sharedflatten_message_text()helper for string content and structured OpenAI/Responses content blocks.plugins/memory/openviking/__init__.pyto:input_text,output_text, andtextcontent;ToolPartpayloads;peer_idonly to assistant messages;agent/codex_runtime.pyso the Codex app-server path passes the projected canonicalmessageslist into external memory sync.How to Test
scripts/run_tests.sh tests/agent/test_message_content.py tests/openviking_plugin/test_openviking.py tests/plugins/memory/test_openviking_provider.py tests/run_agent/test_codex_app_server_integration.py.venv/bin/python -m pytest -q tests/agent/test_message_content.py tests/openviking_plugin/test_openviking.py tests/plugins/memory/test_openviking_provider.py tests/run_agent/test_codex_app_server_integration.py.venv/bin/python -m ruff check agent/message_content.py agent/codex_runtime.py plugins/memory/openviking/__init__.py tests/agent/test_message_content.py tests/openviking_plugin/test_openviking.py tests/plugins/memory/test_openviking_provider.py tests/run_agent/test_codex_app_server_integration.pyapi_keymode with separate model/API and OpenViking auth keys.OpenVikingMemoryProvider.sync_turn(...)against the real server./api/v1/sessions/{session_id}/context.user,assistant,assistant,assistant; assistant messages carriedpeer_id: hermes; exactly oneToolPartpreservedtool_id,tool_name,tool_input, completedtool_status, and tool output;input_text/output_textwere preserved.Full-suite note: I also attempted
scripts/run_tests.sh. It did not complete because this local worktree/environment fails unrelated tests outside this PR's surface, including ACP tests withModuleNotFoundError: No module named 'acp'and existing non-OpenViking failures. The focused touched-path suite above passes through the repo's canonical wrapper.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
N/A. This is a memory sync/storage correctness fix with unit and local integration verification.