You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In AgentScope Java 2.0.2, AgentSpawnTool uses a hard-coded MAX_TIMEOUT_SECONDS = 600. Both the model-provided timeout_seconds and the application-provided CTX_FORCE_SYNC_TIMEOUT_SECONDS are clamped to that value in resolveEffectiveTimeoutMs(). For a long-running remote subagent, the parent agent sometimes needs to wait for the final result in the same run. With CTX_FORCE_SYNC=true, reaching 600 seconds cancels the remote task instead of promoting it to the background. Setting the application override to 1800 still yields a 600-second deadline.
Expected: the trusted application override gives the subagent up to 1800 seconds to finish. Actual: it is silently clamped to 600 seconds. This is the parent-to-subagent wait deadline, not an individual model-request timeout.
Describe the solution you'd like
Please provide a supported way to configure a higher maximum for the application-controlled force-sync timeout, separately from the model-controlled timeout_seconds cap. Keeping the latter at 600 seconds would prevent the model from requesting arbitrarily long waits, while allowing an embedding application to set an explicit bounded policy (e.g. 1800 or 3600 seconds). Ideally the effective deadline should be observable, and the local/remote spawn and send paths should have tests for the configured cap.
Describe alternatives you've considered
timeout_seconds=0 / timeout promotion: useful for background work, but the parent run may finish before the result is available. It does not fit applications that must return the report before that run finishes.
Patching and publishing a private agentscope-harness build: possible, but creates maintenance and upgrade overhead.
Additional context
The relevant logic is in AgentSpawnTool.resolveTimeoutMs() and resolveEffectiveTimeoutMs(); both use Math.min(..., MAX_TIMEOUT_SECONDS). The force-sync setting is an application-provided RuntimeContext value rather than an LLM tool argument.
Under force-sync a timeout hard-fails and is not promoted to a background task
documented at AgentSpawnTool.java:170-172, asserted by AgentSpawnToolForceSyncTest.timeoutHardFailsWithoutPromotion
Javadoc already admits the clamp: "values above 600 are clamped"
AgentSpawnTool.java:193
So setting CTX_FORCE_SYNC_TIMEOUT_SECONDS=1800 yielding a 600s deadline is exactly the current behavior — the report is accurate, and the shared cap conflates two different trust levels: an LLM-requested wait vs. an embedding application's explicit policy.
Blast radius: resolveEffectiveTimeoutMs has three call sites — agent_spawn (:452), agent_send (:622), and the remote sync path (:1626) — all within agentscope-harness. No agentscope-core interface change, fully additive, no breaking API.
Additional observations beyond the report
asPositiveOrZeroInt does not bound the input before the intValue() coercion, so overflow-path inputs (e.g. 1e10 as a Double) also end up at the clamp; the two-cap design naturally fixes this too.
There is precedent for clamp visibility in the same package: WaitAsyncResultsTool.java:448-450 clamps and logs when the requested value is reduced. The recommended fix should mirror that pattern.
Recommended fix (minimal, preserves the safety property the reporter asks to keep)
Add APP_MAX_FORCE_SYNC_TIMEOUT_SECONDS = 3600 next to MAX_TIMEOUT_SECONDS; leave the LLM-facing 600s clamp untouched so the model still cannot request arbitrarily long waits.
In resolveEffectiveTimeoutMs (:1537), clamp only the override branch to the new app cap; update the :193 javadoc accordingly.
Warn-log when the effective deadline is reduced (same style as WaitAsyncResultsTool:449), which covers the "observable deadline" ask cheaply; optionally also include effective_timeout_seconds in the sync result metadata.
Extend AgentSpawnToolForceSyncTest with override cases at 599/600/601/1800/3600/3601 and an overflow input, for both the agent_spawn and agent_send resolution paths.
Design question for maintainers: whether the app-level ceiling should stay a constant (interim, smallest change) or become configurable per harness/agent (builder or policy option). The constant is strictly better than today and can be evolved later without breaking the RuntimeContext contract.
If the constant-based approach (items 1-4) is agreed, reply /approve and a PR will be generated against agentscope-harness with the described tests.
I’m interested in working on this issue and did a quick check against the current main and the related open PR #2749 before starting.
#2749 overlaps with this area by changing resolveEffectiveTimeoutMs and adding application/operator-controlled timeout precedence, but it still keeps all timeout sources clamped to the existing 600s MAX_TIMEOUT_SECONDS. It is also currently not mergeable against main, so it does not appear to directly resolve the trusted-app-vs-LLM cap distinction raised here.
One additional edge case I noticed on current main: asPositiveOrZeroInt() calls Number.intValue() before the value is bounded. For sufficiently large positive numeric inputs, narrowing can overflow before the timeout clamp is applied. If we introduce a separate application-side cap, I think the value should be safely range-normalized before narrowing/clamping as part of the same focused change.
Would you prefer #3166 to proceed as a small standalone fix on current main with a separate trusted application cap, or should it be based on / coordinated with #2749’s timeout-resolution changes?
@philo-x thanks for the careful read. Your asPositiveOrZeroInt() observation was checked against main (be7211d19) and it is a real defect, with one correction to the consequence.
Confirmed — AgentSpawnTool.java:1556-1568 narrows before bounding: the Number branch is return n.intValue(); (:1558) with no range check, while the String branch is already safe because Integer.parseInt throws and the catch returns null (:1562-1565). So 1e10 → 1,410,065,408 and Long.MAX_VALUE → -1.
Correction — no bogus negative deadline can escape. resolveEffectiveTimeoutMs evaluates override <= 0 → default at :1536before the Math.min(seconds, MAX_TIMEOUT_SECONDS) clamp at :1537, so -1 falls back to the 30 s default rather than becoming a negative timeout. That is also why 1e10 lands on 600 s — correct, but by luck.
What actually breaks is the wrap-small class: any Number whose low 32 bits fall in 1..600 while its true value is larger — e.g. Double4_294_967_496.0 (2^32 + 100) → 100 — gets a silently shortened 100 s deadline, contradicting the documented "values above 600 are clamped" contract at :191-193. Same class of silent downgrade for a negative residue.
Containment supports folding it into the same change: asPositiveOrZeroInt has exactly one call site — :1552 in forceSyncTimeoutSeconds (:1548-1553), reached only from :1534. The LLM-facing timeout_seconds argument is Integer-typed (:325, :585), and WaitAsyncResultsTool (:55, :443-457) and TaskTool:105 clamp on their own. Hardening the helper therefore changes nothing outside the force-sync override path: widen before narrowing (n.longValue() against [0, Integer.MAX_VALUE], return null out of range, mirroring the String branch) and the override path provably yields 1–600 s with no behaviour change for in-range inputs. Tests worth adding next to AgentSpawnToolForceSyncTest.java:117-126: 1e10, Long.MAX_VALUE, 2^32 + 100.
On your question — standalone is the better call, and here is the state that makes it so: #2749 is still OPEN, mergeable=CONFLICTING (mergeStateStatus=DIRTY), REVIEW_REQUIRED, head 9682918f0f, last updated 2026-09-17. It adds operator-controlled precedence but keeps Math.min(operatorSeconds, MAX_TIMEOUT_SECONDS), and its declaration-timeout test asserts the 600 s clamp explicitly — so it does not answer the trusted-app-vs-LLM distinction in this issue. Basing a small fix on an unmergeable branch would only add rebase risk. Two coordination notes: (1) #2749 edits the same two files (AgentSpawnTool.java, SubagentDeclaration.java), so please call out the overlap in your PR description rather than resolve it up front; (2) keep the LLM-facing 600 s clamp untouched so the model still cannot request an arbitrarily long wait.
We are not opening a PR for #3166 — you have offered to own this change, so the implementation is yours. The remaining decision that is not ours to make is whether the app-side ceiling stays a constant or becomes per-harness/per-agent configuration (the original evaluation raised this); if you go with the constant, that is the smallest reviewable step and can evolve later without breaking the RuntimeContext contract.
Thanks for checking this and for catching the numeric overflow issue.
I would prefer #3166 to proceed as a small standalone fix against the current main branch rather than depend on #2749. The intended behavior is:
Keep the LLM-controlled agent_spawn.timeout_seconds capped at 600 seconds.
Allow the trusted application-side CTX_FORCE_SYNC_TIMEOUT_SECONDS to exceed 600 seconds under a separate application-controlled cap that can be configured or increased as needed.
Preserve the existing default behavior when no application override is supplied.
Safely normalize Number values before narrowing/clamping so large positive values cannot overflow through intValue().
The key acceptance criterion is not a specific value such as 86400 seconds. It is that an embedding application can configure a bounded maximum greater than 600 seconds, and a trusted CTX_FORCE_SYNC_TIMEOUT_SECONDS value within that configured policy is honored instead of being clamped to the LLM-facing 600-second limit. A fixed 3600-second application cap alone would not fully address this requirement because applications may need to raise the bound further.
A focused PR implementing this distinction would address the issue well.
Follow-up evaluation — acceptance criterion accepted, my earlier 3600 s constant is superseded
@JesseJI thanks for stating the acceptance criterion precisely — that correction matters, and it changes the recommendation in my initial evaluation. Confirmed as the requirement:
LLM-facing agent_spawn.timeout_seconds stays capped at 600 s (AgentSpawnTool.java:110, applied at resolveTimeoutMs:1505) — the model must not be able to ask for an arbitrarily long synchronous wait;
the trusted CTX_FORCE_SYNC_TIMEOUT_SECONDS override is bounded by a separate, application-configurable ceiling, not a hard-coded one;
no override ⇒ today's default behaviour is preserved bit-for-bit;
Number values are range-normalized before narrowing, so a large positive value cannot wrap through intValue() (asPositiveOrZeroInt:1556-1568, n.intValue() at :1558).
Where I was off: item 2 of my initial proposal (APP_MAX_FORCE_SYNC_TIMEOUT_SECONDS = 3600 as a constant) does not satisfy this issue, and you are right that a fixed 3600 s ceiling would only move the wall. I also framed "constant vs configurable" as an open design question for maintainers — your wording resolves it in favour of configurable, so treat the constant version as withdrawn rather than as the interim step.
What "configurable" should mean here, concretely (so an implementer does not have to guess): the ceiling must be readable without recompiling, per embedding application, at the same layer the override is already injected. The natural shape given the existing code is a value carried in the same RuntimeContext as CTX_FORCE_SYNC_TIMEOUT_SECONDS (a CTX_MAX_FORCE_SYNC_TIMEOUT_SECONDS-style key) with a documented default when absent, resolved in resolveEffectiveTimeoutMs (:1531-1544) — i.e. policy lives next to the value it bounds rather than in a constant. Two properties worth keeping from the original analysis: the clamp must become observable (log when a requested value is reduced, mirroring WaitAsyncResultsTool.java:448-450, otherwise a mis-set ceiling fails silently exactly as the 600 s clamp does today), and the LLM-facing cap and the app-facing ceiling must stay two distinct code paths so a future change to one cannot quiet the other.
Ownership unchanged: this remains @philo-x's to implement — no bot PR will be opened for #3166, and no PR referencing this issue is open as of this scan. @philo-x: the two-question coordination note from my previous comment still stands (call out the #2749 file overlap in the PR description; keep the 600 s LLM clamp untouched), with the ceiling now configurable per the above. AgentSpawnToolForceSyncTest is the right place for the boundary cases; with a configurable ceiling the set becomes {no override, override ≤ ceiling, override > ceiling, ceiling itself unset/mis-configured} plus the 2^32 + 100 overflow case, rather than the fixed 3600/3601 pair I listed.
Activity
oss-maintainer commentedon Sep 16, 2026
Issue Evaluation
Category:
enhancement| Status: Evaluated — feasible, low-risk, ready for a small PRVerified against
main@6c8ccc5c6. Every factual claim in the report checks out.Codebase claims — confirmed
MAX_TIMEOUT_SECONDS = 600is hard-codedAgentSpawnTool.java:110timeout_secondsis clamped to itresolveTimeoutMs—AgentSpawnTool.java:1505CTX_FORCE_SYNC_TIMEOUT_SECONDSis clamped to the same 600s capresolveEffectiveTimeoutMs—AgentSpawnTool.java:1537AgentSpawnTool.java:1531-1544AgentSpawnTool.java:170-172, asserted byAgentSpawnToolForceSyncTest.timeoutHardFailsWithoutPromotionAgentSpawnTool.java:193So setting
CTX_FORCE_SYNC_TIMEOUT_SECONDS=1800yielding a 600s deadline is exactly the current behavior — the report is accurate, and the shared cap conflates two different trust levels: an LLM-requested wait vs. an embedding application's explicit policy.Blast radius:
resolveEffectiveTimeoutMshas three call sites —agent_spawn(:452),agent_send(:622), and the remote sync path (:1626) — all withinagentscope-harness. Noagentscope-coreinterface change, fully additive, no breaking API.Additional observations beyond the report
asPositiveOrZeroIntdoes not bound the input before theintValue()coercion, so overflow-path inputs (e.g.1e10as aDouble) also end up at the clamp; the two-cap design naturally fixes this too.WaitAsyncResultsTool.java:448-450clamps and logs when the requested value is reduced. The recommended fix should mirror that pattern.Recommended fix (minimal, preserves the safety property the reporter asks to keep)
APP_MAX_FORCE_SYNC_TIMEOUT_SECONDS = 3600next toMAX_TIMEOUT_SECONDS; leave the LLM-facing 600s clamp untouched so the model still cannot request arbitrarily long waits.resolveEffectiveTimeoutMs(:1537), clamp only the override branch to the new app cap; update the:193javadoc accordingly.WaitAsyncResultsTool:449), which covers the "observable deadline" ask cheaply; optionally also includeeffective_timeout_secondsin the sync result metadata.AgentSpawnToolForceSyncTestwith override cases at 599/600/601/1800/3600/3601 and an overflow input, for both theagent_spawnandagent_sendresolution paths.Design question for maintainers: whether the app-level ceiling should stay a constant (interim, smallest change) or become configurable per harness/agent (builder or policy option). The constant is strictly better than today and can be evolved later without breaking the
RuntimeContextcontract.If the constant-based approach (items 1-4) is agreed, reply
/approveand a PR will be generated againstagentscope-harnesswith the described tests.Automated evaluation by github-manager-bot
philo-x commentedon Sep 17, 2026
I’m interested in working on this issue and did a quick check against the current
mainand the related open PR #2749 before starting.#2749 overlaps with this area by changing
resolveEffectiveTimeoutMsand adding application/operator-controlled timeout precedence, but it still keeps all timeout sources clamped to the existing 600sMAX_TIMEOUT_SECONDS. It is also currently not mergeable againstmain, so it does not appear to directly resolve the trusted-app-vs-LLM cap distinction raised here.One additional edge case I noticed on current
main:asPositiveOrZeroInt()callsNumber.intValue()before the value is bounded. For sufficiently large positive numeric inputs, narrowing can overflow before the timeout clamp is applied. If we introduce a separate application-side cap, I think the value should be safely range-normalized before narrowing/clamping as part of the same focused change.Would you prefer #3166 to proceed as a small standalone fix on current
mainwith a separate trusted application cap, or should it be based on / coordinated with #2749’s timeout-resolution changes?oss-maintainer commentedon Sep 17, 2026
Follow-up evaluation — volunteer question answered
@philo-x thanks for the careful read. Your
asPositiveOrZeroInt()observation was checked againstmain(be7211d19) and it is a real defect, with one correction to the consequence.Confirmed —
AgentSpawnTool.java:1556-1568narrows before bounding: theNumberbranch isreturn n.intValue();(:1558) with no range check, while theStringbranch is already safe becauseInteger.parseIntthrows and the catch returnsnull(:1562-1565). So1e10→1,410,065,408andLong.MAX_VALUE→-1.Correction — no bogus negative deadline can escape.
resolveEffectiveTimeoutMsevaluatesoverride <= 0 → defaultat:1536before theMath.min(seconds, MAX_TIMEOUT_SECONDS)clamp at:1537, so-1falls back to the 30 s default rather than becoming a negative timeout. That is also why1e10lands on 600 s — correct, but by luck.What actually breaks is the wrap-small class: any
Numberwhose low 32 bits fall in1..600while its true value is larger — e.g.Double4_294_967_496.0(2^32 + 100) →100— gets a silently shortened 100 s deadline, contradicting the documented "values above 600 are clamped" contract at:191-193. Same class of silent downgrade for a negative residue.Containment supports folding it into the same change:
asPositiveOrZeroInthas exactly one call site —:1552inforceSyncTimeoutSeconds(:1548-1553), reached only from:1534. The LLM-facingtimeout_secondsargument isInteger-typed (:325,:585), andWaitAsyncResultsTool(:55,:443-457) andTaskTool:105clamp on their own. Hardening the helper therefore changes nothing outside the force-sync override path: widen before narrowing (n.longValue()against[0, Integer.MAX_VALUE], returnnullout of range, mirroring theStringbranch) and the override path provably yields 1–600 s with no behaviour change for in-range inputs. Tests worth adding next toAgentSpawnToolForceSyncTest.java:117-126:1e10,Long.MAX_VALUE,2^32 + 100.On your question — standalone is the better call, and here is the state that makes it so: #2749 is still
OPEN,mergeable=CONFLICTING(mergeStateStatus=DIRTY),REVIEW_REQUIRED, head9682918f0f, last updated 2026-09-17. It adds operator-controlled precedence but keepsMath.min(operatorSeconds, MAX_TIMEOUT_SECONDS), and its declaration-timeout test asserts the 600 s clamp explicitly — so it does not answer the trusted-app-vs-LLM distinction in this issue. Basing a small fix on an unmergeable branch would only add rebase risk. Two coordination notes: (1) #2749 edits the same two files (AgentSpawnTool.java,SubagentDeclaration.java), so please call out the overlap in your PR description rather than resolve it up front; (2) keep the LLM-facing 600 s clamp untouched so the model still cannot request an arbitrarily long wait.We are not opening a PR for #3166 — you have offered to own this change, so the implementation is yours. The remaining decision that is not ours to make is whether the app-side ceiling stays a constant or becomes per-harness/per-agent configuration (the original evaluation raised this); if you go with the constant, that is the smallest reviewable step and can evolve later without breaking the
RuntimeContextcontract.Automated evaluation by github-manager-bot
JesseJI commentedon Sep 18, 2026
Thanks for checking this and for catching the numeric overflow issue.
I would prefer #3166 to proceed as a small standalone fix against the current
mainbranch rather than depend on #2749. The intended behavior is:agent_spawn.timeout_secondscapped at 600 seconds.CTX_FORCE_SYNC_TIMEOUT_SECONDSto exceed 600 seconds under a separate application-controlled cap that can be configured or increased as needed.Numbervalues before narrowing/clamping so large positive values cannot overflow throughintValue().The key acceptance criterion is not a specific value such as 86400 seconds. It is that an embedding application can configure a bounded maximum greater than 600 seconds, and a trusted
CTX_FORCE_SYNC_TIMEOUT_SECONDSvalue within that configured policy is honored instead of being clamped to the LLM-facing 600-second limit. A fixed 3600-second application cap alone would not fully address this requirement because applications may need to raise the bound further.A focused PR implementing this distinction would address the issue well.
oss-maintainer commentedon Sep 19, 2026
Follow-up evaluation — acceptance criterion accepted, my earlier 3600 s constant is superseded
@JesseJI thanks for stating the acceptance criterion precisely — that correction matters, and it changes the recommendation in my initial evaluation. Confirmed as the requirement:
agent_spawn.timeout_secondsstays capped at 600 s (AgentSpawnTool.java:110, applied atresolveTimeoutMs:1505) — the model must not be able to ask for an arbitrarily long synchronous wait;CTX_FORCE_SYNC_TIMEOUT_SECONDSoverride is bounded by a separate, application-configurable ceiling, not a hard-coded one;Numbervalues are range-normalized before narrowing, so a large positive value cannot wrap throughintValue()(asPositiveOrZeroInt:1556-1568,n.intValue()at:1558).Where I was off: item 2 of my initial proposal (
APP_MAX_FORCE_SYNC_TIMEOUT_SECONDS = 3600as a constant) does not satisfy this issue, and you are right that a fixed 3600 s ceiling would only move the wall. I also framed "constant vs configurable" as an open design question for maintainers — your wording resolves it in favour of configurable, so treat the constant version as withdrawn rather than as the interim step.What "configurable" should mean here, concretely (so an implementer does not have to guess): the ceiling must be readable without recompiling, per embedding application, at the same layer the override is already injected. The natural shape given the existing code is a value carried in the same
RuntimeContextasCTX_FORCE_SYNC_TIMEOUT_SECONDS(aCTX_MAX_FORCE_SYNC_TIMEOUT_SECONDS-style key) with a documented default when absent, resolved inresolveEffectiveTimeoutMs(:1531-1544) — i.e. policy lives next to the value it bounds rather than in a constant. Two properties worth keeping from the original analysis: the clamp must become observable (log when a requested value is reduced, mirroringWaitAsyncResultsTool.java:448-450, otherwise a mis-set ceiling fails silently exactly as the 600 s clamp does today), and the LLM-facing cap and the app-facing ceiling must stay two distinct code paths so a future change to one cannot quiet the other.Ownership unchanged: this remains @philo-x's to implement — no bot PR will be opened for #3166, and no PR referencing this issue is open as of this scan. @philo-x: the two-question coordination note from my previous comment still stands (call out the
#2749file overlap in the PR description; keep the 600 s LLM clamp untouched), with the ceiling now configurable per the above.AgentSpawnToolForceSyncTestis the right place for the boundary cases; with a configurable ceiling the set becomes {no override, override ≤ ceiling, override > ceiling, ceiling itself unset/mis-configured} plus the2^32 + 100overflow case, rather than the fixed 3600/3601 pair I listed.Automated evaluation by github-manager-bot
fix(core,harness): separate subagent waits from ordinary tool timeouts (