Skip to content

Commit 9929ac0

Browse files
mmyzwlclaudevincentkoc
authored andcommitted
openclaw#94162: Performance: bundle-tools loading adds 6-7s latency on every agent request (openclaw#94230)
* perf(mcp): parallelize MCP server connections in getCatalog to reduce prep latency Every agent request incurred 6-7s of prep latency because bundle-tools connected to configured MCP servers sequentially, one at a time. With 4-5 MCP servers at ~1.5s each (default tools/list timeout), the total was the sum of all servers' connection times. Fix: split getCatalog() into two phases: 1. Synchronous pre-computation of safe server names (fast, sequential) 2. Async connection + tool listing (parallelized via Promise.allSettled) Now MCP servers connect and list tools concurrently, reducing the total latency from the sum of all servers to roughly the slowest single server. Each server still has its own error handling — individual failures are gracefully demoted to diagnostics, not fatal to the catalog. Prep stage timing change: Before: bundle-tools = sum(connection + listTools) for each server After: bundle-tools = max(connection + listTools) across all servers Closes openclaw#94162 Co-Authored-By: Claude <noreply@anthropic.com> * fix(mcp): add missing braces for eslint curly rule Two if-statements lacked braces, failing the CI check-lint job. Co-Authored-By: Claude <noreply@anthropic.com> * test(mcp): add deterministic regression test for parallel catalog loading - Add focused timing test that proves parallel MCP catalog loading completes in max(server delays) not sum(server delays) - Test creates 3 slow stdio MCP servers (200/400/600ms delays) and asserts wall time < sum(delays) to verify parallelism - Would fail under the original sequential for-await loop - Add standalone scripts/repro-94162-timing.mjs for documentation Part of openclaw#94162 * fix(agents): bound MCP catalog fanout * fix: harden bundle MCP catalog session lifecycle --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: mmyzwl <mmyzwl@users.noreply.github.com> Co-authored-by: Vincent Koc <25068+vincentkoc@users.noreply.github.com>
1 parent 3a78780 commit 9929ac0

3 files changed

Lines changed: 790 additions & 126 deletions

File tree

0 commit comments

Comments
 (0)