Skip to content

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

Closed
hansolo949 wants to merge 1 commit into
openclaw:mainfrom
hansolo949:fix/control-ui-sessions-list-perf
Closed

fix(ui): reduce sessions list refresh cost#77057
hansolo949 wants to merge 1 commit into
openclaw:mainfrom
hansolo949:fix/control-ui-sessions-list-perf

Conversation

@hansolo949

Copy link
Copy Markdown
Contributor

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').

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui agents Agent runtime and tooling size: S labels May 4, 2026
@clawsweeper

clawsweeper Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

This PR is now superseded: the Control UI refresh bound landed in a broader responsiveness fix, and the remaining session-row resolver/isCliProvider hotspot was addressed by a later scoped sessions.list resolver cache that avoids this branch's process-wide invalidation problem.

So I’m closing this here and keeping the remaining discussion on the canonical linked item.

Review details

Best possible solution:

Keep the merged scoped-cache and Control UI responsiveness fixes, and do not merge this superseded branch's process-wide cache.

Do we have a high-confidence way to reproduce the issue?

Yes for the code path, without rerunning a live large-store benchmark in this review. The current source and the merged #77187 proof show sessions.list row building repeatedly reached resolver/isCliProvider work on large stores.

Is this the best way to solve the issue?

No, this PR is no longer the best way to solve it. The safer solution is the merged per-sessions.list scoped resolver cache from #77187 plus the already-merged Control UI refresh bound from #80657.

Security review:

Security review cleared: The diff only changes local TypeScript UI/model-selection code and tests, with no dependency, workflow, permission, secret, package-script, or artifact execution changes.

What I checked:

Likely related people:

  • BunsDev: Authored and merged the Control UI responsiveness work that covers this PR's chat-side session refresh overlap and left the split-path guidance on this PR. (role: recent Control UI responsiveness contributor; confidence: high; commits: 6b3cd9043ee6, d9f0eaa3e5fa, 4935e24c7a7f; files: ui/src/ui/app-chat.ts, ui/src/ui/app-gateway.ts, ui/src/ui/app-gateway.sessions.node.test.ts)
  • rolandrscheel: Authored the merged scoped resolver-cache PR that supersedes this branch's remaining backend/model-selection performance goal. (role: recent sessions-list performance contributor; confidence: high; commits: e4cee2eb697f, aeac10f5cea7; files: src/gateway/session-utils.ts, src/agents/model-selection-cli.ts)
  • vincentkoc: Recent history for src/agents/model-selection-cli.ts includes the CLI provider/runtime split that this PR changes. (role: adjacent model-selection runtime contributor; confidence: medium; commits: d7fcd23091e1; files: src/agents/model-selection-cli.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 5d4a8b00721a; fix evidence: commit e4cee2eb697f, main fix timestamp 2026-05-14T04:20:40Z.

@BunsDev

BunsDev commented May 11, 2026

Copy link
Copy Markdown
Contributor

Overlap triage after #80657:

#80657 covers the Control UI chat-final session refresh part by bounding it to a recent scoped window (activeMinutes + limit) and adding focused tests. This PR should not be closed as a duplicate because it also contains the CLI-provider classification cache work, which is a separate backend/model-selection optimization.

Recommended split path: keep or recreate the CLI-provider cache change as its own focused PR, and drop the Control UI session-refresh hunk from this branch once #80657 lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Control UI sessions.list refresh can stall Gateway with large session stores

2 participants