openclaw - ✅(Solved) Fix Message pipeline has two major performance bottlenecks (auth 6.2s, fixed overhead 16s) [1 pull requests, 4 comments, 4 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#76107Fetched 2026-05-03 04:42:15
View on GitHub
Comments
4
Participants
4
Timeline
18
Reactions
4
Assignees
Timeline (top)
commented ×4mentioned ×4subscribed ×4cross-referenced ×3

During message pipeline profiling, two major bottlenecks were identified:

1. Authentication: 6.2 seconds (per message)

Every single message requires re-authentication to the LLM provider. During this 6.2s window, the model does no processing at all — it's purely waiting for auth to complete.

Impact: ~15-20% of total message time is wasted on authentication.

2. Fixed overhead: 16.4 seconds (system-prompt + core-plugin-tools)

  • core-plugin-tools: 7.8s
  • system-prompt: 8.6s
  • Combined: 16.4s of fixed overhead that does not scale with message content

This overhead is incurred regardless of message length, complexity, or session warmth.

Impact: Even for simple hi messages, minimum ~20s+ total processing time just from auth + fixed overhead.

Root Cause

Root Cause Hypothesis

Fix Action

Fixed

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

Bug Report: Message pipeline has two major performance bottlenecks (auth 6.2s, fixed overhead 16s)

Environment

  • OpenClaw version: 2026.4.29
  • Model: MiniMax-M2.7
  • Network: WiFi (GPON) — baseline 0.1-0.14s Feishu API latency

Description

During message pipeline profiling, two major bottlenecks were identified:

1. Authentication: 6.2 seconds (per message)

Every single message requires re-authentication to the LLM provider. During this 6.2s window, the model does no processing at all — it's purely waiting for auth to complete.

Impact: ~15-20% of total message time is wasted on authentication.

2. Fixed overhead: 16.4 seconds (system-prompt + core-plugin-tools)

  • core-plugin-tools: 7.8s
  • system-prompt: 8.6s
  • Combined: 16.4s of fixed overhead that does not scale with message content

This overhead is incurred regardless of message length, complexity, or session warmth.

Impact: Even for simple hi messages, minimum ~20s+ total processing time just from auth + fixed overhead.

Observed Timings (WiFi baseline, Feishu API at 0.1-0.14s)

Pipeline StageDuration
auth6.2s
core-plugin-tools7.8s
system-prompt8.6s
stream-setup8.7s
model-resolutionminimal
Total baseline~45s

Root Cause Hypothesis

  1. Auth bottleneck: Token/credential refresh happens on every request instead of being cached/reused. No connection pooling or token caching layer.

  2. Fixed overhead: core-plugin-tools + system-prompt suggest per-message initialization that loads plugins and context from scratch each time, rather than maintaining warm state between messages.

Expected Behavior

  1. Auth should be cached: Authentication tokens should be reused across messages. If a token is valid, don't re-authenticate. Target: < 0.5s per message for auth.

  2. System prompt should be cached: For active sessions, the system prompt should be computed once and cached in memory, not rebuilt on every message. Target: < 1s for cached sessions.

  3. Plugin initialization should be deferred: Core plugins should be initialized once on startup, not on every message.

Potential Impact

Current: ~45s minimum per message Target: < 5s for simple messages (by eliminating auth cache miss + reducing fixed overhead)

Suggested Fixes

For auth (6.2s → <0.5s):

  • Implement token caching with TTL-based refresh
  • Use connection keep-alive for LLM API calls
  • Batch auth operations where possible

For fixed overhead (16.4s → <2s):

  • Implement session-level system prompt caching
  • Defer plugin initialization to startup, not per-message
  • Add session warm-up step that pre-computes common context

Additional Context

The 4G→WiFi migration already reduced Feishu API latency from 1.79s → 0.14s (92% improvement), but total message time didn't improve proportionally because auth (6.2s) and fixed overhead (16.4s) remain as dominant factors.

extent analysis

TL;DR

Implement token caching and connection keep-alive for authentication, and cache system prompts to reduce fixed overhead.

Guidance

  • Verify the current authentication mechanism to confirm that tokens are not being cached or reused, and consider implementing a TTL-based refresh.
  • Investigate the feasibility of deferring plugin initialization to startup, rather than per-message, to reduce fixed overhead.
  • Consider adding a session warm-up step to pre-compute common context and reduce the time spent on system prompts.
  • Review the current system prompt computation to determine if it can be cached in memory for active sessions.

Example

# Pseudo-code example of token caching with TTL-based refresh
import time

token_cache = {}
token_ttl = 3600  # 1 hour

def get_token():
    if 'token' in token_cache and token_cache['token']['expires'] > time.time():
        return token_cache['token']['value']
    else:
        # Refresh token and update cache
        new_token = refresh_token()
        token_cache['token'] = {'value': new_token, 'expires': time.time() + token_ttl}
        return new_token

Notes

The suggested fixes assume that the authentication mechanism and system prompt computation can be modified to support caching and deferred initialization. Additional investigation may be necessary to determine the feasibility of these changes.

Recommendation

Apply the suggested fixes, starting with token caching and connection keep-alive for authentication, as these changes are likely to have the greatest impact on reducing the overall message processing time.

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…

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 Message pipeline has two major performance bottlenecks (auth 6.2s, fixed overhead 16s) [1 pull requests, 4 comments, 4 participants]