openclaw - 💡(How to fix) Fix [Bug]: Performance degradation - context growth + lane blocking under load [1 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#44582Fetched 2026-04-08 00:44:58
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Root Cause

  • No effective limit on context token growth for long conversations
  • High concurrency settings saturate available lanes
  • Insufficient event queue timeout for high-load scenarios

Fix Action

Fix / Workaround

Improved patching script to cover all hash variants:

  • reply-*

  • compact-*

  • pi-embedded-*

  • gateway-cli-*

  • register.agent-*

  • Gateway restarted and in active (running) state

  • No new "lane wait exceeded" or "typing TTL reached" errors post-restart

  • Existing dist patches remain intact

Code Example

{
  "acp.maxConcurrentSessions": 126,
  "agents.defaults.maxConcurrent": 32,
  "agents.defaults.subagents.maxConcurrent": 84,
  "agents.defaults.subagents.maxChildrenPerAgent": 84,
  "channels.discord.eventQueue.listenerTimeout": 120000300000,
  "agents.defaults.contextTokens": 80000
}
RAW_BUFFERClick to expand / collapse

Problem

OpenClaw experiences performance degradation under sustained load with long-running conversations:

  1. Context growth without bounds: Writer sessions reaching ~42k tokens, reasoning sessions ~90k tokens, increasing per-turn latency
  2. Lane blocking in Discord: Long turns block lanes, causing serialization under load
  3. Typing timeouts: Typing indicators can remain stuck until TTL in certain code paths

Related issues:

  • #27690 (2026-02-26): Lane blocked in Discord during long turns
  • #44026 (2026-03-12): Serialization by agentId under load
  • #26733 / #27172: Typing can remain until TTL in certain paths

Root Cause

  • No effective limit on context token growth for long conversations
  • High concurrency settings saturate available lanes
  • Insufficient event queue timeout for high-load scenarios

Configuration Changes Applied

{
  "acp.maxConcurrentSessions": 126,
  "agents.defaults.maxConcurrent": 32,
  "agents.defaults.subagents.maxConcurrent": 84,
  "agents.defaults.subagents.maxChildrenPerAgent": 84,
  "channels.discord.eventQueue.listenerTimeout": 120000300000,
  "agents.defaults.contextTokens": 80000
}

Anti-Regression Hardening

Improved patching script to cover all hash variants:

  • reply-*
  • compact-*
  • pi-embedded-*
  • gateway-cli-*
  • register.agent-*

Script location: openclaw-rootfix-v2026.3.11.sh:73

Verification

  • Gateway restarted and in active (running) state
  • No new "lane wait exceeded" or "typing TTL reached" errors post-restart
  • Existing dist patches remain intact

Important Note

Restarting the gateway helps but does not eliminate these cases under sustained load. The root reduction comes from:

  1. Context token limits
  2. Concurrency controls
  3. Event queue timeout adjustments

Environment

  • OpenClaw version: 2026.3.11
  • Model: kimi-coding/k2p5 (primary), with fallbacks
  • Deployment: systemd service on Linux VPS

Recommendation

Consider making these limits adaptive based on observed token growth patterns, or expose them as tunable parameters in openclaw config rather than requiring manual JSON edits.

extent analysis

Fix Plan

To address the performance degradation issue in OpenClaw, we will implement the following steps:

  • Apply configuration changes to limit context token growth and adjust concurrency settings
  • Implement adaptive limits based on observed token growth patterns
  • Expose limits as tunable parameters in openclaw config

Configuration Changes

Update the configuration file with the following changes:

{
  "acp.maxConcurrentSessions": 6,
  "agents.defaults.maxConcurrent": 2,
  "agents.defaults.subagents.maxConcurrent": 4,
  "agents.defaults.subagents.maxChildrenPerAgent": 4,
  "channels.discord.eventQueue.listenerTimeout": 300000,
  "agents.defaults.contextTokens": 80000
}

Adaptive Limits

Implement a script to monitor token growth patterns and adjust the limits accordingly. For example:

import json

def update_limits(config_file, token_growth_rate):
    with open(config_file, 'r') as f:
        config = json.load(f)
    
    # Adjust context token limit based on token growth rate
    config['agents.defaults.contextTokens'] = int(config['agents.defaults.contextTokens'] * (1 - token_growth_rate))
    
    with open(config_file, 'w') as f:
        json.dump(config, f)

# Example usage
update_limits('config.json', 0.1)

Expose Limits as Tunable Parameters

Modify the openclaw config command to include options for tuning the limits. For example:

openclaw config --context-tokens 80000 --max-concurrent-sessions 6

This will allow users to adjust the limits without manually editing the configuration file.

Verification

After applying the configuration changes and implementing adaptive limits, verify that the issue is resolved by:

  • Restarting the gateway and checking its status
  • Monitoring the system for "lane wait exceeded" or "typing TTL reached" errors
  • Verifying that the context token growth is within the expected limits

Extra Tips

  • Regularly monitor the system's performance and adjust the limits as needed
  • Consider implementing automated scripts to detect and respond to performance degradation
  • Refer to the OpenClaw documentation for more information on configuration options and tuning parameters.

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