Skip to content

fix(bot):Response language, Multi user memory commit#1329

Merged
qin-ctx merged 3 commits intomainfrom
feature_bot_loop
Apr 9, 2026
Merged

fix(bot):Response language, Multi user memory commit#1329
qin-ctx merged 3 commits intomainfrom
feature_bot_loop

Conversation

@yeshion23333
Copy link
Copy Markdown
Collaborator

@yeshion23333 yeshion23333 commented Apr 9, 2026

Description

  1. 优化回复时语种遵从较差的问题;
  2. 优化system Prompt,将当前对话的内容移到user部分,保证system的不变性;
  3. 新增多user场景下,按user维度并发提交到ov的链路

1.Optimized the issue of poor language adherence in replies.
2.Optimized the system prompt by moving the content of the current conversation to the user section to ensure the immutability of the system prompt.
3.Added a pipeline for concurrent submission to OV on a per-user basis in multi-user scenarios.

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

@qin-ctx qin-ctx merged commit aaa7e2a into main Apr 9, 2026
3 of 6 checks passed
@qin-ctx qin-ctx deleted the feature_bot_loop branch April 9, 2026 07:29
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Apr 9, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🏅 Score: 60
🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 Multiple PR themes

Sub-PR theme: Optimize response language adherence and prompt structure

Relevant files:

  • bot/vikingbot/agent/context.py
  • bot/vikingbot/agent/loop.py

Sub-PR theme: Add multi-user concurrent memory commit

Relevant files:

  • bot/vikingbot/hooks/builtins/openviking_hooks.py

Sub-PR theme: Update benchmark configuration and import script path

Relevant files:

  • benchmark/locomo/openclaw/eval.py
  • benchmark/locomo/openclaw/run_full_eval.sh

⚡ Recommended focus areas for review

Error Handling Regression

load_config() is now called outside the try-except block, so exceptions from load_config() will propagate instead of being caught and logged.

config = load_config()
admin_user_id = config.ov_server.admin_user_id
API Contract Breakage

The hook's return value changed from the direct client.commit result to a custom dict. This will break any code that relies on the original return structure.

return {
    "success": True,
    "admin_result": admin_result,
    "user_results": user_results,
    "users_count": len(messages_by_sender)
}
Unlogged User Commit Failures

User commit exceptions are collected via return_exceptions=True but not logged, making failures invisible.

user_results = await asyncio.gather(*user_tasks, return_exceptions=True)
Missing User Query in Prompt

Added instruction to reply in user's query language, but the actual user query (current_message) is not appended after the 'User's query:' label.

parts.append("Reply in the same language as the user's query, ignoring the language of the reference materials. User's query:")

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add user query to prompt

The new prompt line ends with "User's query:" but does not include the actual user
query. This prevents the LLM from seeing the user's message in this section. Include
current_message to complete the prompt.

bot/vikingbot/agent/context.py [187]

-parts.append("Reply in the same language as the user's query, ignoring the language of the reference materials. User's query:")
+parts.append(f"Reply in the same language as the user's query, ignoring the language of the reference materials. User's query:\n{current_message}")
Suggestion importance[1-10]: 8

__

Why: The original prompt line ends with "User's query:" but does not include the actual query, which could lead to the LLM not seeing the user's message in that context. Including current_message fixes this critical issue.

Medium
General
Log individual user commit failures

When using return_exceptions=True, individual task failures are collected but not
logged. Add logging for any exceptions in user_results to improve debuggability.

bot/vikingbot/hooks/builtins/openviking_hooks.py [78-79]

 # 等待所有用户任务完成
 user_results = await asyncio.gather(*user_tasks, return_exceptions=True)
+# Log any individual user commit failures
+for user_id, result in zip(messages_by_sender.keys(), user_results):
+    if isinstance(result, Exception):
+        logger.exception(f"Failed to commit memory for user {user_id}", exc_info=result)
Suggestion importance[1-10]: 5

__

Why: Adding logging for exceptions in user_results improves debuggability when individual user commit tasks fail, which is a helpful but not critical improvement.

Low

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants