Skip to content

fix(harness): inherit parent execution configs in declared subagents#2252

Open
logicwu0 wants to merge 1 commit into
agentscope-ai:mainfrom
logicwu0:fix/2230-declared-subagent-execution-config
Open

fix(harness): inherit parent execution configs in declared subagents#2252
logicwu0 wants to merge 1 commit into
agentscope-ai:mainfrom
logicwu0:fix/2230-declared-subagent-execution-config

Conversation

@logicwu0

Copy link
Copy Markdown

AgentScope-Java Version

2.0.1-SNAPSHOT (reproduced on latest main)

Description

Background. HarnessAgentBuilderSupport has two subagent factories that are meant to behave consistently: buildGeneralPurposeFactory and buildDeclaredFactory. The general-purpose factory captures the parent agent's modelExecutionConfig / toolExecutionConfig and applies them to the child, but buildDeclaredFactory never did.

Symptom. A declared subagent (registered via HarnessAgent.Builder.subagent(SubagentDeclaration) / .subagents(...)) silently falls back to ExecutionConfig defaults — e.g. the 5-minute tool timeout — even when the main agent configures a longer toolExecutionConfig. In COORDINATOR mode a slow-tool worker subagent hits Tool execution timeout after PT5M despite the parent being configured for, say, 1 hour.

Fix. Capture modelExecutionConfig / toolExecutionConfig in buildDeclaredFactory and apply them to the child builder, mirroring the existing pattern in buildGeneralPurposeFactory. SubagentDeclaration carries 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 (buildSubagentEntriesfactory().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. Full agentscope-harness suite green (635 run, 0 failures, 3 pre-existing skips).

Closes #2230

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

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

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/harness agentscope-harness (test/runtime support) labels Jul 16, 2026

@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 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 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 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

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

Labels

area/harness agentscope-harness (test/runtime support) bug Something isn't working

Projects

None yet

2 participants