Skip to content

feat(harness): support per-subagent compaction config#2378

Open
March-77 wants to merge 1 commit into
agentscope-ai:mainfrom
March-77:agent/issue-2325-subagent-compaction
Open

feat(harness): support per-subagent compaction config#2378
March-77 wants to merge 1 commit into
agentscope-ai:mainfrom
March-77:agent/issue-2325-subagent-compaction

Conversation

@March-77

Copy link
Copy Markdown

Summary

Fixes #2325.

Declarative subagents could only use their own default compaction behavior because SubagentDeclaration had no compaction option and the declared-subagent factory did not propagate the parent setting.

This change:

  • adds SubagentDeclaration.Builder.compaction(CompactionConfig) for per-subagent configuration;
  • applies declaration-level compaction before inherited parent settings;
  • preserves parent disabled/configured compaction when no declaration override is present;
  • adds regression coverage for overriding a disabled parent and inheriting a disabled parent.

User impact

Callers can configure a declaratively registered subagent with an independent compaction strategy while other subagents continue to inherit the parent behavior.

Tests

  • mvn -pl agentscope-harness -am -Dtest="HarnessAgentTest,SubagentDeclarationPhaseATest" -Dsurefire.failIfNoSpecifiedTests=false test (44 tests passed)
  • Spotless check passed as part of the Maven build.

Compatibility and risk

The new builder method is additive. Existing declarations keep inheritance semantics, so no migration is required. The change is limited to local declared-subagent construction; remote task declarations are unaffected.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...cope/harness/agent/HarnessAgentBuilderSupport.java 88.88% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@oss-maintainer oss-maintainer 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.

LGTM. Looks good.


Automated review by "github-manager-bot"

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.

[Feature]: 代码声明式子智能体不支持配置单独的压缩策略

2 participants