openclaw - ✅(Solved) Fix Control UI sessions.list refresh can stall Gateway with large session stores [1 pull requests, 2 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#77056Fetched 2026-05-05 05:52:58
View on GitHub
Comments
2
Participants
3
Timeline
4
Reactions
2
Timeline (top)
commented ×2closed ×1cross-referenced ×1

On a Control UI instance with a large accumulated session store (~116 visible sessions), routine sessions.list refreshes can create noticeable Gateway stalls and liveness warnings. The most visible path is the chat-turn completion refresh: Control UI requests recent sessions with activeMinutes and a relatively broad limit, which forces repeated row/model/session enrichment work during normal chat use.

This is narrower than #76562, but likely part of the same control-plane latency family.

Root Cause

On a Control UI instance with a large accumulated session store (~116 visible sessions), routine sessions.list refreshes can create noticeable Gateway stalls and liveness warnings. The most visible path is the chat-turn completion refresh: Control UI requests recent sessions with activeMinutes and a relatively broad limit, which forces repeated row/model/session enrichment work during normal chat use.

This is narrower than #76562, but likely part of the same control-plane latency family.

Fix Action

Fix / Workaround

Before local mitigation:

  • openclaw sessions --json: ~16.3s
  • imported listSessionsFromStoreAsync({}): ~20.4s
  • limit:20: ~3.9s
  • cold Control UI reconnect could produce sessions.list spikes around ~16-19s
  • liveness warnings showed event-loop delay spikes in the ~1-3s range during active UI/tooling work

After local mitigation:

  • steady sessions.list: ~69-124ms
  • Gateway reachable: ~196ms
  • quiet CPU sample: ~0.2%, sleeping
  • remaining cold reconnect RPCs (node.list, chat.history) can still briefly spike around ~0.9-1.2s, so this is not a full control-plane fix

PR fix notes

PR #77057: fix(ui): reduce sessions list refresh cost

Description (problem / solution / changelog)

Summary

  • cache isCliProvider results by normalized provider and configured CLI backend keys
  • cap the Control UI chat-turn session refresh to a small recent-session window
  • add a regression test for cached setup CLI backend lookup

Fixes #77056. Related to #76562.

Why

On a Control UI instance with a large session store, normal chat completion refreshes were putting avoidable pressure on sessions.list. Local diagnostics showed repeated CLI-provider classification during row building and overly broad chat-side session refresh windows as meaningful contributors.

This keeps the explicit Sessions page/search flows intact while making the routine chat-turn refresh cheaper.

Testing

  • git diff --check
  • npm test -- --runInBand src/agents/model-selection.test.ts ui/src/ui/app-gateway.sessions.node.test.ts could not run in this local worktree because dependencies are not installed (Cannot find module 'vitest/package.json').

Changed files

  • src/agents/model-selection-cli.ts (modified, +34/-9)
  • src/agents/model-selection.test.ts (modified, +20/-0)
  • ui/src/ui/app-chat.ts (modified, +1/-0)
  • ui/src/ui/app-gateway.sessions.node.test.ts (modified, +1/-0)
  • ui/src/ui/app-gateway.ts (modified, +2/-0)
RAW_BUFFERClick to expand / collapse

Summary

On a Control UI instance with a large accumulated session store (~116 visible sessions), routine sessions.list refreshes can create noticeable Gateway stalls and liveness warnings. The most visible path is the chat-turn completion refresh: Control UI requests recent sessions with activeMinutes and a relatively broad limit, which forces repeated row/model/session enrichment work during normal chat use.

This is narrower than #76562, but likely part of the same control-plane latency family.

Observed locally

Environment:

  • OpenClaw 2026.5.2
  • macOS / Node 22
  • Control UI direct webchat
  • ~116 active/visible sessions in the session store

Before local mitigation:

  • openclaw sessions --json: ~16.3s
  • imported listSessionsFromStoreAsync({}): ~20.4s
  • limit:20: ~3.9s
  • cold Control UI reconnect could produce sessions.list spikes around ~16-19s
  • liveness warnings showed event-loop delay spikes in the ~1-3s range during active UI/tooling work

After local mitigation:

  • steady sessions.list: ~69-124ms
  • Gateway reachable: ~196ms
  • quiet CPU sample: ~0.2%, sleeping
  • remaining cold reconnect RPCs (node.list, chat.history) can still briefly spike around ~0.9-1.2s, so this is not a full control-plane fix

Suspected hot paths

The local profile/debugging pointed at two avoidable costs:

  1. buildGatewaySessionRow calling isCliProvider repeatedly across many rows, which can repeatedly reach plugin/setup CLI backend discovery.
  2. Control UI chat lifecycle refreshes asking for a broader session window than the chat sidebar needs.

Some source-side work on main already appears to have improved session row hydration, but the chat completion refresh can still be bounded more aggressively.

Proposed fix

A small PR is coming that:

  • caches isCliProvider lookup results by normalized provider + configured CLI backend keys
  • caps the Control UI chat-turn session refresh to the small recent-window count the sidebar needs

This should reduce normal chat-turn control-plane pressure without changing the explicit Sessions page/search flows.

Related

  • Broader regression: #76562

extent analysis

TL;DR

Caching isCliProvider lookup results and capping the Control UI chat-turn session refresh can help mitigate Gateway stalls and liveness warnings.

Guidance

  • Verify the performance improvement by measuring the time taken for sessions.list refreshes before and after applying the proposed fix.
  • Review the source-side work on main to understand the improvements made to session row hydration and how they can be leveraged.
  • Consider monitoring the CPU usage and event-loop delay spikes during active UI/tooling work to ensure the fix does not introduce new performance issues.
  • Evaluate the impact of the proposed fix on the broader regression mentioned in #76562.

Example

No code snippet is provided as the issue does not contain sufficient information to create a minimal example.

Notes

The proposed fix is specific to the Control UI instance with a large accumulated session store, and its effectiveness may vary depending on the environment and usage patterns.

Recommendation

Apply the proposed workaround by caching isCliProvider lookup results and capping the Control UI chat-turn session refresh, as it is likely to reduce the control-plane pressure without changing the explicit Sessions page/search flows.

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 Control UI sessions.list refresh can stall Gateway with large session stores [1 pull requests, 2 comments, 3 participants]