openclaw - 💡(How to fix) Fix [Bug]: 2026.5.22 Discord takes a long time to respond

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…

After upgrading to 2026.5.22 from 2026.5.18, Discord now takes a 30 seconds before the agent even "agent is typing" in chat.

After I inquired what was going on, my agent reported the following:

The new slowdown is this: this Discord session is now ~86k tokens, and the Codex app-server path has a hard native-thread reuse cap at 70k. So every turn logs:

codex app-server native transcript exceeded active token limit; starting a fresh thread

That means the runtime keeps throwing away the warmed Codex native thread and starting fresh, which kills the fast path and causes Gateway CPU/event-loop stalls. The new delay is session bloat + native thread rotation.

Then, I asked a little further:

The Codex-side session wrapper is losing its warm thread.

The 70k tokens are probably the accumulated local transcript that OpenClaw is passing into the Codex app-server for this Discord channel: system/context + memory excerpts + chat history + tool logs. After the update/debugging, that transcript got huge. The app-server then says “too large for active reuse” and starts a fresh native Codex thread each turn.

Root Cause

After upgrading to 2026.5.22 from 2026.5.18, Discord now takes a 30 seconds before the agent even "agent is typing" in chat.

After I inquired what was going on, my agent reported the following:

The new slowdown is this: this Discord session is now ~86k tokens, and the Codex app-server path has a hard native-thread reuse cap at 70k. So every turn logs:

codex app-server native transcript exceeded active token limit; starting a fresh thread

That means the runtime keeps throwing away the warmed Codex native thread and starting fresh, which kills the fast path and causes Gateway CPU/event-loop stalls. The new delay is session bloat + native thread rotation.

Then, I asked a little further:

The Codex-side session wrapper is losing its warm thread.

The 70k tokens are probably the accumulated local transcript that OpenClaw is passing into the Codex app-server for this Discord channel: system/context + memory excerpts + chat history + tool logs. After the update/debugging, that transcript got huge. The app-server then says “too large for active reuse” and starts a fresh native Codex thread each turn.

Fix Action

Fix / Workaround

Last known good version 2026.5.18, first known bad version 2026.5.22, no workaround known.

Code Example

The new slowdown is this: this Discord session is now ~86k tokens, and the Codex app-server path has a hard native-thread reuse cap at 70k. So every turn logs:

codex app-server native transcript exceeded active token limit; starting a fresh thread

That means the runtime keeps throwing away the warmed Codex native thread and starting fresh, which kills the fast path and causes Gateway CPU/event-loop stalls. The new delay is session bloat + native thread rotation.

---

The Codex-side session wrapper is losing its warm thread.

The 70k tokens are probably the accumulated local transcript that OpenClaw is passing into the Codex app-server for this Discord channel: system/context + memory excerpts + chat history + tool logs. After the update/debugging, that transcript got huge. The app-server then says “too large for active reuse” and starts a fresh native Codex thread each turn.

---

My agent provided me the following information:
Environment:
- Ubuntu 24.04.4 LTS (noble)
- OpenClaw CLI: 2026.5.22
- Model path: openai-codex/gpt-5.5, thinking=xhigh

Initial post-update Discord issue:
- Discord bot did not appear online after update.
- Doctor reported stale managed npm Discord plugin shadowing bundled Discord plugin:
  ~/.openclaw/npm/node_modules/@openclaw/discord
  package was @openclaw/discord@2026.5.4
- Removing the stale managed plugin/install record let bundled discord@2026.5.22 load.
- Also needed:
  openclaw config set plugins.entries.discord.enabled true --strict-json
- After restart, Discord provider started and bot probe resolved.

Second issue: severe response latency / event loop stalls:
- After Discord recovered, Gateway had major event-loop starvation.
- Logs include:
  [fetch-timeout] fetch timeout after 10000ms (elapsed 35372ms) timer delayed 25372ms, likely event-loop starvation operation=fetchWithTimeout url=https://discord.com/api/v10/users/@me
  [discord] gateway: Gateway websocket closed: 1000
  [diagnostic] liveness warning: reasons=event_loop_delay,cpu ... eventLoopDelayP99Ms=9026.1 ... eventLoopUtilization=0.933 cpuCoreRatio=0.977
- Gateway process was around 40-45% CPU while mostly idle/responding.
- Active Memory was disabled and Gateway restarted, but new turns still log:
  [agent/embedded] codex app-server native transcript exceeded active token limit; starting a fresh thread

Current session state:
- Session key: agent:main:discord:channel:<channel_id>
- sessions.json reports totalTokens=70911, totalTokensFresh=true
- Source constant in dist/run-attempt-Dgb9l7L8.js:
  CODEX_APP_SERVER_NATIVE_THREAD_MAX_TOKENS = 7e4
- Relevant source behavior:
  when tokenCount >= CODEX_APP_SERVER_NATIVE_THREAD_MAX_TOKENS, OpenClaw clears the Codex app-server binding and starts a fresh native thread.
- This seems to break warm-thread reuse every turn once the Discord transcript crosses ~70k tokens, causing cold-path latency and Gateway event-loop pressure.

Important caveat:
- The 70k limit is not the Codex model context window. It appears to be an OpenClaw native-thread reuse/cache threshold.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After upgrading to 2026.5.22 from 2026.5.18, Discord now takes a 30 seconds before the agent even "agent is typing" in chat.

After I inquired what was going on, my agent reported the following:

The new slowdown is this: this Discord session is now ~86k tokens, and the Codex app-server path has a hard native-thread reuse cap at 70k. So every turn logs:

codex app-server native transcript exceeded active token limit; starting a fresh thread

That means the runtime keeps throwing away the warmed Codex native thread and starting fresh, which kills the fast path and causes Gateway CPU/event-loop stalls. The new delay is session bloat + native thread rotation.

Then, I asked a little further:

The Codex-side session wrapper is losing its warm thread.

The 70k tokens are probably the accumulated local transcript that OpenClaw is passing into the Codex app-server for this Discord channel: system/context + memory excerpts + chat history + tool logs. After the update/debugging, that transcript got huge. The app-server then says “too large for active reuse” and starts a fresh native Codex thread each turn.

Steps to reproduce

  1. Run 2026.5.22
  2. Send message on Discord
  3. Wait a relatively long time before a response comes in.

Expected behavior

In 2026.5.18 the agent responded promptly.

Actual behavior

The agent takes a long time before it begins to respond.

OpenClaw version

2026.5.22 release tag

Operating system

Ubuntu 24,04.4 LTS

Install method

Local git checkout

Model

openai-codex/gpt-5.5

Provider / routing chain

openclaw -> codex

Additional provider/model setup details

No response

Logs, screenshots, and evidence

My agent provided me the following information:
Environment:
- Ubuntu 24.04.4 LTS (noble)
- OpenClaw CLI: 2026.5.22
- Model path: openai-codex/gpt-5.5, thinking=xhigh

Initial post-update Discord issue:
- Discord bot did not appear online after update.
- Doctor reported stale managed npm Discord plugin shadowing bundled Discord plugin:
  ~/.openclaw/npm/node_modules/@openclaw/discord
  package was @openclaw/[email protected]
- Removing the stale managed plugin/install record let bundled [email protected] load.
- Also needed:
  openclaw config set plugins.entries.discord.enabled true --strict-json
- After restart, Discord provider started and bot probe resolved.

Second issue: severe response latency / event loop stalls:
- After Discord recovered, Gateway had major event-loop starvation.
- Logs include:
  [fetch-timeout] fetch timeout after 10000ms (elapsed 35372ms) timer delayed 25372ms, likely event-loop starvation operation=fetchWithTimeout url=https://discord.com/api/v10/users/@me
  [discord] gateway: Gateway websocket closed: 1000
  [diagnostic] liveness warning: reasons=event_loop_delay,cpu ... eventLoopDelayP99Ms=9026.1 ... eventLoopUtilization=0.933 cpuCoreRatio=0.977
- Gateway process was around 40-45% CPU while mostly idle/responding.
- Active Memory was disabled and Gateway restarted, but new turns still log:
  [agent/embedded] codex app-server native transcript exceeded active token limit; starting a fresh thread

Current session state:
- Session key: agent:main:discord:channel:<channel_id>
- sessions.json reports totalTokens=70911, totalTokensFresh=true
- Source constant in dist/run-attempt-Dgb9l7L8.js:
  CODEX_APP_SERVER_NATIVE_THREAD_MAX_TOKENS = 7e4
- Relevant source behavior:
  when tokenCount >= CODEX_APP_SERVER_NATIVE_THREAD_MAX_TOKENS, OpenClaw clears the Codex app-server binding and starts a fresh native thread.
- This seems to break warm-thread reuse every turn once the Discord transcript crosses ~70k tokens, causing cold-path latency and Gateway event-loop pressure.

Important caveat:
- The 70k limit is not the Codex model context window. It appears to be an OpenClaw native-thread reuse/cache threshold.

Impact and severity

Affected: Discord Severity: Annoying, though I would describe it as frustrating. Frequency: Every agent turn Consequence: Have to wait a lot

Additional information

Last known good version 2026.5.18, first known bad version 2026.5.22, no workaround known.

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

In 2026.5.18 the agent responded promptly.

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 - 💡(How to fix) Fix [Bug]: 2026.5.22 Discord takes a long time to respond