fix(harness): inherit parent execution configs in declared subagents#2252
fix(harness): inherit parent execution configs in declared subagents#2252logicwu0 wants to merge 1 commit into
Conversation
buildDeclaredFactory did not propagate the parent agent's modelExecutionConfig / toolExecutionConfig to declared subagents, unlike buildGeneralPurposeFactory. Declared subagents therefore fell back to ExecutionConfig defaults (e.g. the 5-minute tool timeout), ignoring a longer timeout configured on the main agent. Capture and apply both configs, mirroring buildGeneralPurposeFactory. Closes agentscope-ai#2230
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR fixes issue #2230: declared subagents (registered via SubagentDeclaration) did not inherit the parent agent's toolExecutionConfig and modelExecutionConfig, causing child agents to fall back to default 5-minute timeouts even when the parent configured longer timeouts (e.g., 1 hour). The fix captures both configs in buildDeclaredFactory and applies them to the child builder, mirroring the existing pattern in buildGeneralPurposeFactory. The change is precise, minimal, and fully resolves the described issue. The new test verifies inheritance behavior. Code quality is good — no issues found.
Recommendation: APPROVE
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR fixes issue #2230: declared subagents (registered via SubagentDeclaration) did not inherit the parent agent's toolExecutionConfig and modelExecutionConfig, causing child agents to fall back to default 5-minute timeouts even when the parent configured longer timeouts (e.g., 1 hour). The fix captures both configs in buildDeclaredFactory and applies them to the child builder, mirroring the existing pattern in buildGeneralPurposeFactory. The change is precise, minimal, and fully resolves the described issue. The new test verifies inheritance behavior. Code quality is good — no issues found.
Recommendation: APPROVE
AgentScope-Java Version
2.0.1-SNAPSHOT(reproduced on latestmain)Description
Background.
HarnessAgentBuilderSupporthas two subagent factories that are meant to behave consistently:buildGeneralPurposeFactoryandbuildDeclaredFactory. The general-purpose factory captures the parent agent'smodelExecutionConfig/toolExecutionConfigand applies them to the child, butbuildDeclaredFactorynever did.Symptom. A declared subagent (registered via
HarnessAgent.Builder.subagent(SubagentDeclaration)/.subagents(...)) silently falls back toExecutionConfigdefaults — e.g. the 5-minute tool timeout — even when the main agent configures a longertoolExecutionConfig. In COORDINATOR mode a slow-tool worker subagent hitsTool execution timeout after PT5Mdespite the parent being configured for, say, 1 hour.Fix. Capture
modelExecutionConfig/toolExecutionConfiginbuildDeclaredFactoryand apply them to the child builder, mirroring the existing pattern inbuildGeneralPurposeFactory.SubagentDeclarationcarries no execution-config fields of its own, so straight inheritance is correct (no per-declaration overlay needed, unlike temperature/topP).Testing. Added
HarnessAgentTest#declaredSubagent_inheritsExecutionConfigsFromParent: builds a parent with non-default tool/model execution configs, materializes the declared subagent through the real factory path (buildSubagentEntries→factory().create(...)), and asserts the child's delegate carries the same configs. Verified the test fails before the fix (expected <ExecutionConfig> but was <null>) and passes after. Fullagentscope-harnesssuite green (635 run, 0 failures, 3 pre-existing skips).Closes #2230
Checklist
mvn spotless:applymvn test)