Skip to content

fix(bot): keep memory-commit side effects out of the LLM-visible answer loop#3087

Open
r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:fix/memory-commit-side-effect-loop-3082
Open

fix(bot): keep memory-commit side effects out of the LLM-visible answer loop#3087
r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:fix/memory-commit-side-effect-loop-3082

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

Fixes #3082.

Summary

  • Treat openviking_memory_commit as a side-effect tool in the agent loop.
  • Execute and keep it in tools_used/logs, but do not add its tool result to the LLM-visible reflection transcript.
  • For memory-only turns, run a no-tool finalization turn so the model answers from conversation context instead of reflecting on commit status.
  • For mixed turns, reflect only visible information-tool results and suppress memory-commit tool/result events from the outbound bus.

Notes

  • tools_used still retains the memory commit call/result for traceability, matching the issue's expectation that side effects remain recorded outside the LLM transcript.
  • Once a side-effect tool has executed in a request, the loop keeps it disabled for later iterations to avoid duplicate commits in the same user turn.
  • A forced no-tool finalization response that still contains tool calls is ignored with a warning and falls back to the previous assistant content when available.

Verification

  • /tmp/ov-3082-venv/bin/python -m py_compile bot/vikingbot/agent/loop.py bot/tests/test_agent_loop_outcome.py
  • git diff --check
  • Direct control-flow harness covering memory-only, empty-content, failed structured status, mixed success, mixed failure, stop-tool order, and side-effect event suppression.

/tmp/ov-3082-venv/bin/python -m pytest bot/tests/test_agent_loop_outcome.py -q did not reach test collection in this sparse local checkout because bot/tests/conftest.py imports the full OpenViking service stack and the local venv is missing the declared volcengine SDK dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Bug](bot): openviking_memory_commit 作为副作用工具时,其结果被喂回 LLM 反思上下文并污染最终回复

1 participant