Repository navigation
feat(sub-agent): with_execution_limits — the token and duration caps are no longer hard-coded - #238
Merged
Merged
Conversation
…re no longer hard-coded SubAgentTool built each delegation's limits with a hard-coded 1M tokens and 300 s; only with_max_turns was adjustable. Since the token count includes every turn's whole prompt, a sub-agent over a large context hit 1M within a few turns and nothing could raise it. The tool now stores an ExecutionLimits: with_execution_limits replaces it, and with_max_turns changes only the turns. Defaults are unchanged (10 turns, 1M, 300 s, loop detection on). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG
…e reset; list with_execution_limits in the builder table Review fixes for #238. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG
…gurable in the context guide Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG
yuanhao
added a commit
that referenced
this pull request
Oct 5, 2026
Reliability fixes from the October codebase review (#232-#235, #237, #238). Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
SubAgentToolbuilt every delegation's limits with a hard-coded 1M tokens and 300 s, commented "generous". Onlywith_max_turnscould be changed. Since the token count includes every turn's whole prompt (see #237), a sub-agent working over a large context reached 1M within a few turns: about 3 turns at 400K, or about 16 at 60K. Nothing could raise it.Change:
SubAgentToolstores a fullExecutionLimits.with_execution_limits(ExecutionLimits)replaces all of the limits.with_max_turns(n)still works and changes only the turn count.Tests:
with_max_turnsafterwith_execution_limitschanges only the turns: the run stops at the turn cap, not the token cap.Docs:
docs/concepts/sub-agents.md(a Limits section with an example), the CHANGELOG and CLAUDE.md. Once #237 is merged, I'll update its line sayingwith_max_turnsis a sub-agent's only setting.Local checks: fmt, clippy (all features, no default features, wasm32), docs, and
cargo test --all-features(55 binaries).🤖 Generated with Claude Code
https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG