Skip to content

Keep Control UI refresh responsive#79126

Merged
BunsDev merged 4 commits into
mainfrom
meow/control-ui-responsive-refresh-main
May 8, 2026
Merged

Keep Control UI refresh responsive#79126
BunsDev merged 4 commits into
mainfrom
meow/control-ui-responsive-refresh-main

Conversation

@BunsDev

@BunsDev BunsDev commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Decouple Control UI chat refresh so slow history, sessions, avatar, model, or command RPCs do not block the operator surface.
  • Load config/schema and channel status in smaller steps so config-heavy tabs and channel probes can render stale/partial state before slow work finishes.
  • Align the chat render window with the bounded history request and keep render timing visible through the existing Control UI performance log.

Refs #77060, #45698, #47979, #44107.

Verification

  • pnpm test ui/src/ui/app-chat.test.ts ui/src/ui/app-settings.refresh-active-tab.node.test.ts ui/src/ui/control-ui-performance.test.ts ui/src/ui/controllers/chat.test.ts
  • pnpm exec oxfmt --check --threads=1 ui/src/ui/app-chat.ts ui/src/ui/app-chat.test.ts ui/src/ui/app-settings.ts ui/src/ui/app-settings.refresh-active-tab.node.test.ts ui/src/ui/app-render.ts ui/src/ui/chat/build-chat-items.ts ui/src/ui/chat/history-limits.ts
  • git diff --check origin/main..HEAD

Notes

  • Testbox was attempted before rebasing, but install was blocked by pnpm minimumReleaseAge for @anthropic-ai/sdk.
  • After rebasing onto current origin/main, OPENCLAW_LOCAL_CHECK=1 pnpm check:changed reaches core typecheck and fails on existing unrelated strictness errors outside this PR (packages/memory-host-sdk, src/agents, src/infra, src/media, src/plugins, etc.). The focused UI tests above pass.
  • Draft until the remote/main typecheck situation is clean enough to rerun the full changed gate on this branch.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels May 7, 2026
@clawsweeper

clawsweeper Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR decouples Control UI chat, config, and channel refresh waits, reduces the rendered chat history window, adds focused UI tests, and updates the changelog.

Reproducibility: no. live browser repro was established in this read-only pass. Source inspection gives a clear current-main path for the reported waits: slow chat.history, config.schema, or channels.status work can hold the foreground refresh path.

Real behavior proof
Not applicable: This is a MEMBER-authored maintainer-labeled PR, so the external contributor after-fix real-behavior-proof gate does not apply.

Next step before merge
No repair lane action is needed: the branch has no narrow defect from this review and should continue through normal PR review and merge checks.

Security
Cleared: The diff is limited to Control UI TypeScript, UI tests, and changelog text, with no dependency, CI, secret, install, publish, or supply-chain surface changes found.

Review details

Best possible solution:

Proceed through normal maintainer review and merge if the responsiveness tradeoffs remain intended, then reassess the linked freeze reports against the landed behavior.

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

No live browser repro was established in this read-only pass. Source inspection gives a clear current-main path for the reported waits: slow chat.history, config.schema, or channels.status work can hold the foreground refresh path.

Is this the best way to solve the issue?

Yes, pending maintainer review. The PR narrows the fix to moving slow work off foreground refresh paths while preserving an explicit manual-refresh wait contract, which is safer than a broader virtualization or backend probe redesign in this patch.

What I checked:

  • Current main chat refresh blocks on history: On current main, refreshChat starts secondary refreshes but still awaits loadChatHistory before resolving, so a slow chat.history RPC can keep the foreground refresh pending. (ui/src/ui/app-chat.ts:748, cde99c3349e9)
  • Current main config and channel tabs block on slow work: Config-like tabs await loadConfigSchema before loadConfig, and the channels tab awaits channel probing, config schema, and config together. (ui/src/ui/app-settings.ts:349, cde99c3349e9)
  • PR makes chat refresh nonblocking with an explicit wait path: The PR starts history and secondary refreshes in the background by default, then adds awaitHistory for manual refresh callers that still need the old completion contract. (ui/src/ui/app-chat.ts:749, fde87459a14d)
  • PR makes config and channel refresh less blocking: The PR backgrounds config schema loading, renders channels from a non-probe snapshot plus config first, then starts the probe refresh after the foreground tab load resolves. (ui/src/ui/app-settings.ts:360, fde87459a14d)
  • Manual refresh regression coverage present: The PR extracts handleChatManualRefresh and routes the button through refreshChat(..., { awaitHistory: true, scheduleScroll: false }), with corresponding helper tests in the diff. (ui/src/ui/app-render.helpers.ts:52, fde87459a14d)
  • Exact-head checks are green or skipped: GitHub check-runs for head fde87459a14dcc1d9d72bc7030dc91db5fafbdb3 showed no in-progress or failing checks; visible key checks including check, checks-node-core-ui, check-docs, security-fast, and security-dependency-audit were successful. (fde87459a14d)

Likely related people:

  • BunsDev: Recent merged current-main Control UI responsiveness and chat/settings work touched the same affected files before this PR, beyond being the PR author. (role: likely follow-up owner; confidence: high; commits: 60171e863882, 64fcc8a1aadb, 098b72910dea; files: ui/src/ui/app-chat.ts, ui/src/ui/app-settings.ts, ui/src/ui/app-render.ts)
  • steipete: Recent current-main work touched adjacent chat refresh/send and render paths near the manual refresh surface. (role: recent adjacent maintainer; confidence: medium; commits: 6785633d137c, 2805bbd3d7a9; files: ui/src/ui/app-chat.ts, ui/src/ui/app-render.ts)
  • shakkernerd: Recent current-main work adjusted app-chat.ts typing/lint behavior adjacent to the chat refresh code. (role: recent adjacent maintainer; confidence: low; commits: ab3a3d14f0a7; files: ui/src/ui/app-chat.ts, ui/src/ui/chat/session-controls.ts)

Remaining risk / open question:

  • No live browser reproduction or after-fix browser recording was established in this read-only review; the proof here is source inspection, author-reported focused commands, and exact-head GitHub checks.

Codex review notes: model gpt-5.5, reasoning high; reviewed against cde99c3349e9.

@BunsDev
BunsDev force-pushed the meow/control-ui-responsive-refresh-main branch from b2a1faf to f61ff30 Compare May 7, 2026 23:35
@BunsDev

BunsDev commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the manual refresh regression called out in the review comment.

Summary:

  • Kept default refreshChat behavior non-blocking for tab/app refreshes.
  • Added an explicit awaitHistory path for manual refresh callers so the refresh promise resolves only after chat.history applies.
  • Routed manual refresh button handling through handleChatManualRefresh, so scroll/reset waits for history while secondary session/avatar/model/command refreshes remain non-blocking.
  • Added coverage for both the non-blocking default path and manual-refresh completion behavior.

Verification:

  • pnpm test ui/src/ui/app-chat.test.ts ui/src/ui/app-render.helpers.node.test.ts ui/src/ui/app-settings.refresh-active-tab.node.test.ts ui/src/ui/control-ui-performance.test.ts ui/src/ui/controllers/chat.test.ts
  • pnpm exec oxfmt --check --threads=1 ui/src/ui/app-chat.ts ui/src/ui/app-chat.test.ts ui/src/ui/app-render.helpers.ts ui/src/ui/app-render.helpers.node.test.ts ui/src/ui/app-render.ts ui/src/ui/app-settings.ts ui/src/ui/app-settings.refresh-active-tab.node.test.ts ui/src/ui/chat/build-chat-items.ts ui/src/ui/chat/history-limits.ts
  • git diff --check origin/main..HEAD
  • Testbox pnpm check:changed: typecheck passed; lint escalated to all-lane scope from Testbox sync/install artifacts and failed on unrelated unused imports outside this PR diff.

@BunsDev
BunsDev force-pushed the meow/control-ui-responsive-refresh-main branch from 4604fe1 to fde8745 Compare May 8, 2026 02:44
@BunsDev BunsDev self-assigned this May 8, 2026
@BunsDev

BunsDev commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

Performance impact estimate for this PR, based on the changed foreground waits and bounded render work rather than synthetic benchmark numbers:

  • Chat tab refresh: default refreshChat() now returns after yielding instead of waiting for chat.history to finish. That moves history hydration off the foreground refresh path. Estimated foreground wait reduction is roughly historyLatency -> one UI tick; for a 500 ms history response this is about a 99% foreground wait reduction / ~100x faster return, and for a 2 s history response it is about a 99.7% reduction / ~400x faster return. The transcript still updates when history arrives; this does not make the backend history query itself faster.
  • Manual chat refresh: intentionally no speedup claim. It now uses awaitHistory: true so the refresh control preserves the old completion contract: scroll/reset happens after history applies, while secondary metadata refreshes stay non-blocking.
  • Large chat rendering: visible history render work is capped from 200 to 100 messages for large sessions, so worst-case transcript item build/render pressure is cut by about 50% for sessions with more than 100 visible messages. This should reduce blank-page/freeze risk from large transcripts, with a “showing last 100 messages” marker for hidden older history.
  • Config tab refresh: config.schema no longer blocks the active-tab refresh completion. Foreground savings are approximately (max(schemaLatency, configLatency) - configLatency) / max(schemaLatency, configLatency). If schema rendering/fetching is 5 s and config fetch is 200 ms, the tab foreground wait drops by about 96% / ~25x. If schema is 10 s and config is 200 ms, it drops by about 98% / ~50x.
  • Channels tab refresh: the foreground path now waits for the cheap non-probe channel snapshot plus config, then runs the expensive probe/audit refresh in the background. For slow channel probes this removes the probe/audit budget from the initial tab refresh. Compared with the previous 750 ms soft probe budget, the foreground tab wait can save up to roughly 750 ms per refresh in the slow-probe case, and more importantly avoids repeated stuck-looking refresh states while the full probe completes.
  • Instrumentation: slow chat/config render timing plus browser long-animation-frame/long-task entries are recorded in the Control UI event log. That is not direct speedup, but it gives us concrete timing evidence for the next virtualization/chunking step instead of guessing.

Net expectation: affected operator actions should feel instant or near-instant when the old blocker was slow history/schema/channel probe work. The largest user-visible wins are in pathological cases: large sessions, slow config schema surfaces, and slow channel status probes. Normal fast paths should be functionally unchanged except for lower render pressure and better diagnostics.

Current verification after rebasing onto latest main:

  • pnpm test ui/src/ui/app-chat.test.ts ui/src/ui/app-render.helpers.node.test.ts ui/src/ui/app-settings.refresh-active-tab.node.test.ts ui/src/ui/control-ui-performance.test.ts ui/src/ui/controllers/chat.test.ts
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md ui/src/ui/app-chat.ts ui/src/ui/app-chat.test.ts ui/src/ui/app-render.helpers.ts ui/src/ui/app-render.helpers.node.test.ts ui/src/ui/app-render.ts ui/src/ui/app-settings.ts ui/src/ui/app-settings.refresh-active-tab.node.test.ts ui/src/ui/chat/build-chat-items.ts ui/src/ui/chat/history-limits.ts
  • git diff --check origin/main..HEAD
  • pnpm ui:build

Re-review progress:

@BunsDev
BunsDev marked this pull request as ready for review May 8, 2026 02:49
@BunsDev
BunsDev merged commit 5ae385b into main May 8, 2026
86 checks passed
@BunsDev
BunsDev deleted the meow/control-ui-responsive-refresh-main branch May 8, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant