Repository navigation
fix(harness): gate memory prompt guidance on disable flags - #2565
Merged
Merged
Conversation
Align WorkspaceContextMiddleware with disableMemoryTools/disableMemoryHooks so the system prompt no longer instructs the model to use tools or auto-extract behavior that were turned off.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the harness’s system-prompt memory guidance and MEMORY.md injection with the actual memory capabilities enabled on a HarnessAgent, based on disableMemoryTools and disableMemoryHooks.
Changes:
- Gate Memory Recall / Persistence prompt guidance in
WorkspaceContextMiddlewarebased ondisableMemoryTools/disableMemoryHooks, and adjust truncation messaging when tools are disabled. - Skip
<memory_context>(MEMORY.md) injection when both memory tools and hooks are disabled, while keepingAGENTSand Domain Knowledge context. - Update EN/ZH docs and add targeted unit/integration coverage for the new prompt behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/v2/zh/docs/harness/workspace.md | Documents how memory-related prompt sections and <memory_context> injection change under disable flags (ZH). |
| docs/v2/zh/docs/harness/memory.md | Updates disable-flag semantics and prompt-side effects for memory (ZH). |
| docs/v2/en/docs/harness/workspace.md | Documents prompt trimming/omission behavior tied to memory disable flags (EN). |
| docs/v2/en/docs/harness/memory.md | Updates disable-flag semantics and prompt-side effects for memory (EN). |
| agentscope-harness/src/test/java/io/agentscope/harness/agent/middleware/WorkspaceContextMiddlewareMemoryPromptTest.java | Adds coverage ensuring prompt guidance and <memory_context> match disable-flag combinations. |
| agentscope-harness/src/test/java/io/agentscope/harness/agent/HarnessAgentTest.java | Adds an integration-style assertion that both disable flags remove memory guidance and <memory_context>. |
| agentscope-harness/src/main/java/io/agentscope/harness/agent/middleware/WorkspaceContextMiddleware.java | Implements the new gating for memory guidance and memory context injection based on disable flags. |
| agentscope-harness/src/main/java/io/agentscope/harness/agent/HarnessAgent.java | Wires disable flags into WorkspaceContextMiddleware and documents prompt-side effects on the builder methods. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
disableMemoryTools/disableMemoryHooksintoWorkspaceContextMiddlewareso Memory Recall / Persistence guidance matches registered capabilities<memory_context>(MEMORY.md) injection while keeping Domain Knowledge / AGENTS / knowledgeTest plan
mvn -pl agentscope-harness -am test -Dtest=WorkspaceContextMiddlewareMemoryPromptTest,WorkspaceContextMiddlewarePathBoundsTest,HarnessAgentTest#disableMemoryTools_omitsHarnessMemoryAndSessionTools+disableMemoryToolsAndHooks_omitMemoryGuidanceFromSystemPromptMEMORY.mdbut omitsmemory_search/memory_saveguidance