Skip to content

Performance: bundle-tools loading adds 6-7s latency on every agent request #94162

Description

@lyowc

Problem

Every agent request incurs ~6-7 seconds of latency before the model even starts generating. The bottleneck is the bundle-tools phase which loads all MCP servers and skills upfront.

Trace evidence

[trace:embedded-run] prep stages: totalMs=5889 stages=bundle-tools:5792ms@5809ms
[trace:embedded-run] prep stages: totalMs=6020 stages=bundle-tools:5898ms@5915ms
[trace:embedded-run] prep stages: totalMs=6527 stages=bundle-tools:6435ms@6449ms
[trace:embedded-run] prep stages: totalMs=7207 stages=bundle-tools:7132ms@7207ms

In all cases, bundle-tools accounts for 96-99% of total prep time.

Environment

  • OpenClaw v2026.6.8
  • Node v26.0.0
  • macOS (arm64)
  • MCP servers: Notion, Z.ai, Web Reader, Web Search Prime
  • ~30+ skills loaded

Expected behavior

Tools should be lazily loaded on-demand, or at least cached/warm-pooled across requests. Simple text replies should not require 6+ seconds of tool initialization.

Impact

  • Every user message — including simple chat — has 6-7s added latency
  • Chatty sessions feel noticeably slow compared to similar AI assistants
  • Streaming partially masks this but the delay is still present before first token

Suggested fix

  1. Lazy tool loading: only initialize tools when the model decides to call them
  2. Tool cache/warm pool: keep initialized tool connections alive across requests in the same session
  3. Fast path: if the model has no tool calls (simple text reply), skip tool initialization entirely

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions