feat: expose nested lane maxConcurrent as config option#51622
feat: expose nested lane maxConcurrent as config option#51622momo890709 wants to merge 3 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR exposes
Confidence Score: 5/5
Last reviewed commit: "feat: expose nested ..." |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbdbfe6fb6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| nested: z | ||
| .object({ | ||
| maxConcurrent: z.number().int().positive().optional(), | ||
| }) | ||
| .optional(), |
There was a problem hiding this comment.
Enforce strict validation for agents.defaults.nested
The new agents.defaults.nested schema is not marked .strict(), so unknown keys under this object are silently dropped instead of raising a config error. In practice, a typo like maxConcurent will be ignored and the gateway will fall back to the default nested lane concurrency, which makes misconfiguration hard to detect; subagents already uses .strict() and does not have this problem.
Useful? React with 👍 / 👎.
The nested lane (used by sessions_send) was hardcoded to maxConcurrent: 1, forcing all nested session invocations to run serially. This adds a new config key `agents.defaults.nested.maxConcurrent` (default: 4) so users can tune nested lane parallelism the same way they can for subagent and main lanes. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Matches the existing subagents schema behavior — unknown keys like `maxConcurent` (missing an 'r') now raise a config validation error instead of being silently dropped. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
0900d92 to
ccf4b3f
Compare
Summary
The
CommandLane.Nestedlane (used bysessions_sendand similar nested invocations) was hardcoded tomaxConcurrent: 1at gateway startup. This forced all nested session calls to run serially, causing severe bottlenecks in multi-agent architectures.The Problem
When an orchestrator agent broadcasts to multiple sub-agents via
sessions_send, each call queues behind the previous one. WithmaxConcurrent: 1:sessions_sendtimeout starts from call time, not delivery time — so queue wait eats into the timeout budgetReal-world impact: A cron job sending
sessions_sendto 2 agents with 60s timeout would fail because:This issue was reported in #14214 but marked stale without resolution.
The Fix
Adds a new config key
agents.defaults.nested.maxConcurrent(default: 4) so users can tune nested lane parallelism, consistent with howagents.defaults.maxConcurrentandagents.defaults.subagents.maxConcurrentalready work.The new setting is applied both at gateway startup and on hot-reload.
Config example
Files changed
src/config/agent-limits.tsDEFAULT_NESTED_MAX_CONCURRENT,resolveNestedMaxConcurrent()src/config/types.agent-defaults.tsnested?: { maxConcurrent?: number }onAgentDefaultsConfigsrc/config/zod-schema.agent-defaults.tssrc/config/defaults.tsapplyAgentDefaults()src/gateway/server-lanes.tssrc/gateway/server-reload-handlers.tssrc/config/config.agent-concurrency-defaults.test.tsTest plan
pnpm testpasses (unit tests forresolveNestedMaxConcurrent)agents.defaults.nested.maxConcurrent: 8in config is respectedRelated
🤖 Generated with Claude Code