Skip to content

fix(harness): inherit memory config in subagents - #2611

Open
steven-ji wants to merge 1 commit into
agentscope-ai:mainfrom
steven-ji:agent/fix-2549-subagent-memory-config
Open

fix(harness): inherit memory config in subagents#2611
steven-ji wants to merge 1 commit into
agentscope-ai:mainfrom
steven-ji:agent/fix-2549-subagent-memory-config

Conversation

@steven-ji

@steven-ji steven-ji commented Aug 7, 2026

Copy link
Copy Markdown

AgentScope-Java Version

2.0.1-SNAPSHOT

Description

Fixes #2549.

Background and root cause

Automatically built subagents inherited the parent agent's memory enable/disable flags, but both buildGeneralPurposeFactory(...) and buildDeclaredFactory(...) omitted the parent's MemoryConfig. Their child builders therefore fell back to MemoryConfig.defaults(), which could trigger unexpected flush/consolidation model calls and ignore custom memory prompts, retention settings, and model overrides.

Changes

  • Propagate the parent's immutable MemoryConfig to general-purpose subagents.
  • Apply the same inheritance rule to declared subagents.
  • Keep the existing memory tools/hooks disable flag propagation unchanged.
  • Add focused regression tests for both factory paths. The tests configure FlushTrigger.never() and verify that a child call performs only the normal model invocation, with no unexpected memory flush call.

This PR is intentionally limited to configuration inheritance. Broader asynchronous memory-maintenance latency is outside its scope.

Validation

  • mvn -pl agentscope-harness -am -Dtest=HarnessAgentTest -Dsurefire.failIfNoSpecifiedTests=false test
    • 39 tests, 0 failures, 0 errors
  • mvn -pl agentscope-harness -am -Djava.awt.headless=true test
    • agentscope-core: 2264 tests, 0 failures, 0 errors
    • agentscope-harness: 786 tests, 0 failures, 0 errors
  • git diff --check

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing
  • Javadoc comments are complete and follow project conventions (no public API added)
  • Related documentation has been updated (not applicable; no documentation contract changed)
  • Code is ready for review

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@steven-ji
steven-ji marked this pull request as ready for review August 7, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: general-purpose 子智能体仅继承部分 Memory 状态,未继承父 Agent 的 MemoryConfig

1 participant