openclaw - ✅(Solved) Fix Performance regression: eager media/web provider discovery and uncached provider hook resolution add several seconds before streaming [1 pull requests, 4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#76203Fetched 2026-05-03 04:40:51
View on GitHub
Comments
4
Participants
3
Timeline
8
Reactions
2
Timeline (top)
commented ×4closed ×1cross-referenced ×1mentioned ×1

A recent OpenClaw version appears to spend significant time before streaming begins, even when using a minimal tool profile. The delay is reproducible outside of Discord/message ingress and appears to occur inside OpenClaw's agent/runtime preparation path.

The main contributors observed were:

  • eager construction/discovery for built-in media/web/capability tools
  • repeated provider/plugin hook resolution during stream setup

The affected paths appear to be stock OpenClaw runtime/tooling paths, not custom user tools or unusual third-party scripts.

Error Message

On OpenClaw 2026.4.29, there was a consistent delay before streaming/first useful output. Typical embedded prep time was roughly 10-11 seconds before stream-ready.

Root Cause

  • Confirmed the delay occurs before streaming and is not caused by Discord ingress, typing indicators, or model first-token latency.
  • Confirmed tools.profile: minimal was already in use.
  • Tested alternate tool profiles; minimal was best, but still showed the delay.
  • Tested OpenAI-only plugin configuration; this did not materially improve timing.
  • Removing plugin entries made tool timing worse, so that was not a valid workaround.
  • Direct openai/... model IDs were not actionable in this environment without an OPENAI_API_KEY; the active path used OpenAI Codex OAuth.
  • Node version alone was not proven as the cause.
  • Source inspection showed the slow paths are part of stock OpenClaw built-in tool/runtime setup.

Fix Action

Fix / Workaround

A downgrade to OpenClaw 2026.4.23 appeared materially faster in limited testing, but this should be treated as supporting evidence rather than a fully controlled regression bisect.

Additional startup-before-stream time was also sometimes observed, commonly around 9-13.5s, involving runtime plugins, model resolution, auth, and attempt dispatch.

  • Confirmed the delay occurs before streaming and is not caused by Discord ingress, typing indicators, or model first-token latency.
  • Confirmed tools.profile: minimal was already in use.
  • Tested alternate tool profiles; minimal was best, but still showed the delay.
  • Tested OpenAI-only plugin configuration; this did not materially improve timing.
  • Removing plugin entries made tool timing worse, so that was not a valid workaround.
  • Direct openai/... model IDs were not actionable in this environment without an OPENAI_API_KEY; the active path used OpenAI Codex OAuth.
  • Node version alone was not proven as the cause.
  • Source inspection showed the slow paths are part of stock OpenClaw built-in tool/runtime setup.

PR fix notes

PR #76277: fix: reduce WebUI session latency churn

Description (problem / solution / changelog)

Summary

  • avoid a full Control UI sessions.list reload when a message-phase sessions.changed payload already patched local session state
  • pass known sessionKey through file-only transcript update events so Gateway event handling can skip transcript-file-to-session lookup on hot paths
  • make media generation provider discovery lazy for explicit image/video/music model config, including the music execution path without reference-image validation

Root Cause

The latency cluster mixed several hot-path costs: UI-side full list invalidation on message updates, Gateway transcript update events without session keys, and eager provider/tool materialization even when explicit generation model config already selected the provider/model.

Validation

  • pnpm test ui/src/ui/app-gateway.sessions.node.test.ts
  • pnpm test src/gateway/session-transcript-key.test.ts src/gateway/session-message-events.test.ts
  • pnpm test src/agents/tools/media-tool-shared.test.ts src/agents/tools/image-generate-tool.test.ts src/agents/tools/video-generate-tool.test.ts src/agents/tools/music-generate-tool.test.ts
  • pnpm test ui/src/ui/app-gateway.sessions.node.test.ts src/agents/pi-embedded-runner/compact.hooks.test.ts src/agents/pi-embedded-runner/transcript-rewrite.test.ts src/agents/pi-embedded-runner/tool-result-truncation.test.ts src/agents/tools/image-generate-tool.test.ts src/agents/tools/video-generate-tool.test.ts src/agents/tools/music-generate-tool.test.ts
  • pnpm exec oxfmt --check --threads=1 ...
  • pnpm check:changelog-attributions
  • Testbox: OPENCLAW_TESTBOX=1 pnpm check:changed

Triage Notes

prtags auth is valid, but prtags group list/search returned 502 during triage, so no duplicate group or gated @clawsweeper comment was written yet.

Refs https://github.com/openclaw/openclaw/issues/76236 Refs https://github.com/openclaw/openclaw/issues/76203 Refs https://github.com/openclaw/openclaw/issues/76188 Refs https://github.com/openclaw/openclaw/issues/76107 Refs https://github.com/openclaw/openclaw/issues/76166

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • docs/nodes/audio.md (modified, +0/-1)
  • docs/providers/arcee.md (modified, +12/-12)
  • docs/web/control-ui.md (modified, +0/-2)
  • docs/web/webchat.md (modified, +1/-2)
  • extensions/arcee/index.test.ts (modified, +0/-176)
  • extensions/arcee/index.ts (modified, +7/-12)
  • extensions/arcee/models.ts (modified, +5/-4)
  • extensions/arcee/provider-catalog.ts (modified, +28/-10)
  • extensions/arcee/provider-policy-api.test.ts (removed, +0/-73)
  • extensions/arcee/provider-policy-api.ts (removed, +0/-11)
  • extensions/arcee/provider-policy.ts (removed, +0/-132)
  • scripts/openclaw-npm-release-check.ts (modified, +10/-8)
  • src/agents/command/attempt-execution.ts (modified, +1/-1)
  • src/agents/pi-embedded-runner/compact.hooks.test.ts (modified, +12/-3)
  • src/agents/pi-embedded-runner/compaction-hooks.ts (modified, +1/-1)
  • src/agents/pi-embedded-runner/tool-result-truncation.test.ts (modified, +6/-0)
  • src/agents/pi-embedded-runner/tool-result-truncation.ts (modified, +8/-2)
  • src/agents/pi-embedded-runner/transcript-rewrite.test.ts (modified, +1/-1)
  • src/agents/pi-embedded-runner/transcript-rewrite.ts (modified, +4/-1)
  • src/agents/tools/image-generate-tool.test.ts (modified, +51/-6)
  • src/agents/tools/image-generate-tool.ts (modified, +12/-2)
  • src/agents/tools/media-tool-shared.ts (modified, +11/-3)
  • src/agents/tools/music-generate-tool.test.ts (modified, +57/-0)
  • src/agents/tools/music-generate-tool.ts (modified, +28/-10)
  • src/agents/tools/video-generate-tool.test.ts (modified, +53/-0)
  • src/agents/tools/video-generate-tool.ts (modified, +15/-2)
  • src/commands/channel-setup/plugin-install.test.ts (modified, +2/-2)
  • src/commands/onboarding-plugin-install.test.ts (modified, +5/-133)
  • src/commands/onboarding-plugin-install.ts (modified, +3/-8)
  • src/config/sessions/transcript.test.ts (modified, +4/-1)
  • src/config/sessions/transcript.ts (modified, +1/-1)
  • src/flows/channel-setup.status.test.ts (modified, +8/-99)
  • src/flows/channel-setup.status.ts (modified, +9/-9)
  • src/flows/channel-setup.test.ts (modified, +3/-75)
  • src/flows/channel-setup.ts (modified, +4/-5)
  • src/gateway/method-scopes.ts (modified, +0/-1)
  • src/gateway/server-methods-list.ts (modified, +0/-1)
  • src/gateway/server-methods.ts (modified, +0/-2)
  • src/gateway/server-methods/chat-transcribe-audio.runtime.ts (removed, +0/-1)
  • src/gateway/server-methods/chat-transcribe-audio.test.ts (removed, +0/-123)
  • src/gateway/server-methods/chat-transcribe-audio.ts (removed, +0/-125)
  • src/image-generation/runtime-types.ts (modified, +1/-0)
  • src/image-generation/runtime.test.ts (modified, +40/-0)
  • src/image-generation/runtime.ts (modified, +1/-0)
  • src/music-generation/runtime-types.ts (modified, +1/-0)
  • src/music-generation/runtime.test.ts (modified, +37/-0)
  • src/music-generation/runtime.ts (modified, +1/-0)
  • src/plugins/install.npm-spec.test.ts (modified, +0/-55)
  • src/plugins/install.ts (modified, +2/-23)
  • src/plugins/tool-descriptor-cache.test.ts (modified, +47/-1)
  • src/plugins/tool-descriptor-cache.ts (modified, +14/-3)
  • src/plugins/tools.optional.test.ts (modified, +49/-0)
  • src/video-generation/runtime-types.ts (modified, +1/-0)
  • src/video-generation/runtime.test.ts (modified, +37/-0)
  • src/video-generation/runtime.ts (modified, +1/-0)
  • ui/src/styles/chat/layout.css (modified, +0/-9)
  • ui/src/ui/app-chat.test.ts (modified, +0/-63)
  • ui/src/ui/app-chat.ts (modified, +0/-67)
  • ui/src/ui/app-gateway.sessions.node.test.ts (modified, +64/-1)
  • ui/src/ui/app-gateway.ts (modified, +17/-3)
  • ui/src/ui/app-lifecycle.node.test.ts (modified, +0/-3)
  • ui/src/ui/app-lifecycle.ts (modified, +0/-2)
  • ui/src/ui/app-render.ts (modified, +0/-3)
  • ui/src/ui/app-view-state.ts (modified, +1/-4)
  • ui/src/ui/app.test.ts (removed, +0/-205)
  • ui/src/ui/app.ts (modified, +0/-132)
  • ui/src/ui/controllers/sessions.test.ts (modified, +63/-1)
  • ui/src/ui/controllers/sessions.ts (modified, +17/-5)
  • ui/src/ui/views/chat.test.ts (modified, +1/-40)
  • ui/src/ui/views/chat.ts (modified, +10/-50)
RAW_BUFFERClick to expand / collapse

Summary

A recent OpenClaw version appears to spend significant time before streaming begins, even when using a minimal tool profile. The delay is reproducible outside of Discord/message ingress and appears to occur inside OpenClaw's agent/runtime preparation path.

The main contributors observed were:

  • eager construction/discovery for built-in media/web/capability tools
  • repeated provider/plugin hook resolution during stream setup

The affected paths appear to be stock OpenClaw runtime/tooling paths, not custom user tools or unusual third-party scripts.

Environment

  • OS: macOS
  • OpenClaw affected version: 2026.4.29
  • Node: 22.22.2
  • Model/provider: openai-codex/gpt-5.5
  • Tool profile: minimal
  • Gateway mode: LaunchAgent/Gateway
  • Reproduced outside Discord ingress/typing path

A downgrade to OpenClaw 2026.4.23 appeared materially faster in limited testing, but this should be treated as supporting evidence rather than a fully controlled regression bisect.

Observed behavior

On OpenClaw 2026.4.29, there was a consistent delay before streaming/first useful output. Typical embedded prep time was roughly 10-11 seconds before stream-ready.

Representative timing breakdown:

  • core-plugin-tools: ~4.6-4.8s
  • bundle-tools: ~0.5-0.6s
  • system-prompt: ~2.0-2.7s
  • session-resource-loader: ~0.5-0.8s
  • stream-setup: ~2.36-2.47s

Additional startup-before-stream time was also sometimes observed, commonly around 9-13.5s, involving runtime plugins, model resolution, auth, and attempt dispatch.

Troubleshooting performed

  • Confirmed the delay occurs before streaming and is not caused by Discord ingress, typing indicators, or model first-token latency.
  • Confirmed tools.profile: minimal was already in use.
  • Tested alternate tool profiles; minimal was best, but still showed the delay.
  • Tested OpenAI-only plugin configuration; this did not materially improve timing.
  • Removing plugin entries made tool timing worse, so that was not a valid workaround.
  • Direct openai/... model IDs were not actionable in this environment without an OPENAI_API_KEY; the active path used OpenAI Codex OAuth.
  • Node version alone was not proven as the cause.
  • Source inspection showed the slow paths are part of stock OpenClaw built-in tool/runtime setup.

Detailed findings

1. Eager built-in tool/provider construction

Most of core-plugin-tools time came from eager construction/discovery for built-in capability/media/web tools, including:

  • image analysis
  • image generation
  • video generation
  • music generation
  • PDF
  • web search

An experimental skip of capability-backed/media/web constructors reduced core-plugin-tools from roughly ~4.8s to ~158ms.

That is not a recommended fix as-is, because it removes or undermines useful tools, but it strongly suggests the cost is in eager provider/tool discovery rather than actual tool invocation.

2. Repeated provider hook/plugin resolution during stream setup

Stream setup repeatedly spent time in provider/plugin hook paths such as:

  • registerProviderStreamForModel
  • resolveProviderTextTransforms
  • runtimePlan.resolveExtraParams
  • applyExtraParamsToAgent

A cache probe reduced stream setup from roughly ~2.4s to ~3ms, suggesting repeated uncached provider-hook/plugin resolution is a major contributor.

Expected behavior

Tool definitions should remain available, but provider discovery and expensive capability checks should ideally be lazy, cached, or reused across runs where safe.

In particular:

  • media/web/capability provider discovery should not add multiple seconds before every stream if the tools are not invoked
  • provider hook/plugin lookup used during stream setup should be memoized or reused where possible
  • tools.profile: minimal should avoid unnecessary expensive setup work where practical

Actual behavior

Even with tools.profile: minimal, OpenClaw 2026.4.29 spent several seconds in stock tool/provider setup before streaming began.

Possible fix direction

Potential areas to investigate:

  • lazy-load or cache provider discovery for built-in media/web/capability tools
  • avoid constructing expensive provider-backed tool inventories until the tool is invoked or explicitly listed
  • memoize provider-hook/plugin lookup used by stream setup
  • reuse provider stream/text transform/extra-param resolution where inputs have not changed

Related issues

Possibly related at a high level, but not a duplicate:

  • #66409 - recent-version lag/regression report, but without this timing breakdown or identified provider/tool setup path

I did not find an existing open issue that specifically documents eager media/web provider discovery plus uncached provider hook resolution causing pre-stream delay.

extent analysis

TL;DR

Implement lazy loading or caching for provider discovery and memoize provider-hook/plugin lookup to reduce the pre-stream delay in OpenClaw 2026.4.29.

Guidance

  • Investigate lazy-loading or caching built-in media/web/capability tools to avoid eager construction/discovery, which currently takes around 4.6-4.8 seconds.
  • Memoize provider-hook/plugin lookup used during stream setup to reduce repeated resolution time from roughly 2.4 seconds to near instantaneous.
  • Consider reusing provider stream/text transform/extra-param resolution where inputs have not changed to further optimize stream setup.
  • Review the tools.profile: minimal configuration to ensure it is optimized for minimal setup work, potentially by avoiding unnecessary expensive setup tasks.

Example

No specific code example is provided due to the lack of explicit code references in the issue. However, the approach would involve modifying the OpenClaw codebase to implement lazy loading, caching, and memoization as suggested.

Notes

The exact implementation details may vary depending on the internal workings of OpenClaw and its dependencies. It is crucial to ensure that any optimizations do not compromise the functionality or security of the system.

Recommendation

Apply a workaround by implementing lazy loading or caching for provider discovery and memoizing provider-hook/plugin lookup, as these changes are likely to significantly reduce the pre-stream delay without requiring a version upgrade.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Tool definitions should remain available, but provider discovery and expensive capability checks should ideally be lazy, cached, or reused across runs where safe.

In particular:

  • media/web/capability provider discovery should not add multiple seconds before every stream if the tools are not invoked
  • provider hook/plugin lookup used during stream setup should be memoized or reused where possible
  • tools.profile: minimal should avoid unnecessary expensive setup work where practical

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Performance regression: eager media/web provider discovery and uncached provider hook resolution add several seconds before streaming [1 pull requests, 4 comments, 3 participants]