Skip to content

修复 AutoContext 中 system 消息混入 inputMessages 的问题#1489

Open
guslegend0510 wants to merge 7 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1484
Open

修复 AutoContext 中 system 消息混入 inputMessages 的问题#1489
guslegend0510 wants to merge 7 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1484

Conversation

@guslegend0510

Copy link
Copy Markdown

背景

当前 AutoContext 在构造事件时,会把 system 说明和普通输入一起放进 inputMessages。这样容易出现多个 system turn 混杂、上下文语义不清或推理阶段读取冲突的问题。

修改内容

  • 将 system 说明从 inputMessages 中剥离出来。
  • 统一写入 PreReasoningEvent.systemMessage
  • inputMessages 只保留非 system turn,降低后续处理歧义。
  • 避免多 system 消息带来的上下文冲突。

验证

  • mvn -pl agentscope-extensions/agentscope-extensions-autocontext-memory -am -Dtest=AutoContextHookTest test

Fixes #1484

@guslegend0510 guslegend0510 requested a review from a team May 25, 2026 10:20
@CLAassistant

CLAassistant commented May 25, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LearningGp

Copy link
Copy Markdown
Member
image

@guslegend0510

Copy link
Copy Markdown
Author

都签署了
image

@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/ext/memory Memory/session extension implementations labels May 28, 2026
@LearningGp

Copy link
Copy Markdown
Member

PTAL @shiyiyue1102

# Conflicts:
#	agentscope-extensions/agentscope-extensions-autocontext-memory/src/main/java/io/agentscope/core/memory/autocontext/AutoContextHook.java
#	agentscope-extensions/agentscope-extensions-autocontext-memory/src/test/java/io/agentscope/core/memory/autocontext/AutoContextHookTest.java

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

This PR changes 2 lines in ToolCallParam.java (copy-builder constructor and its Javadoc) and 9 lines in ToolCallParamTest.java (updated assertions). The actual code change fixes the copy-builder Builder(ToolCallParam source) to reference the renamed field runtimeContext instead of the stale name context, and updates the Javadoc immutable-fields list to match. The test changes strengthen assertions from assertEquals on the deprecated getContext() to assertSame on the canonical getRuntimeContext(), plus add null-path coverage.

However, the PR title and description claim to fix "AutoContext system message mixing into inputMessages." No class named AutoContext exists anywhere in the codebase, and none of the changed code relates to system messages or inputMessages. The diff exclusively addresses a field-name rename oversight in the ToolCallParam copy builder. The PR description is misleading.

@guslegend0510

Copy link
Copy Markdown
Author

@shiyiyue1102 麻烦审核一下,谢谢您

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

Labels

area/ext/memory Memory/session extension implementations bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:AutoContextHook fails with Qwen3.5-35B-A3B due to ChatML system message constraints

5 participants