Skip to content

fix: reduce WebUI session latency churn#76277

Merged
BunsDev merged 1 commit intomainfrom
meow/webui-runtime-latency-cluster
May 2, 2026
Merged

fix: reduce WebUI session latency churn#76277
BunsDev merged 1 commit intomainfrom
meow/webui-runtime-latency-cluster

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 2, 2026

Summary

  • avoid a full Control UI sessions.list reload when a message-phase sessions.changed payload already patched local session state
  • pass known sessionKey through file-only transcript update events so Gateway event handling can skip transcript-file-to-session lookup on hot paths
  • make media generation provider discovery lazy for explicit image/video/music model config, including the music execution path without reference-image validation

Root Cause

The latency cluster mixed several hot-path costs: UI-side full list invalidation on message updates, Gateway transcript update events without session keys, and eager provider/tool materialization even when explicit generation model config already selected the provider/model.

Validation

  • pnpm test ui/src/ui/app-gateway.sessions.node.test.ts
  • pnpm test src/gateway/session-transcript-key.test.ts src/gateway/session-message-events.test.ts
  • pnpm test src/agents/tools/media-tool-shared.test.ts src/agents/tools/image-generate-tool.test.ts src/agents/tools/video-generate-tool.test.ts src/agents/tools/music-generate-tool.test.ts
  • pnpm test ui/src/ui/app-gateway.sessions.node.test.ts src/agents/pi-embedded-runner/compact.hooks.test.ts src/agents/pi-embedded-runner/transcript-rewrite.test.ts src/agents/pi-embedded-runner/tool-result-truncation.test.ts src/agents/tools/image-generate-tool.test.ts src/agents/tools/video-generate-tool.test.ts src/agents/tools/music-generate-tool.test.ts
  • pnpm exec oxfmt --check --threads=1 ...
  • pnpm check:changelog-attributions
  • Testbox: OPENCLAW_TESTBOX=1 pnpm check:changed

Triage Notes

prtags auth is valid, but prtags group list/search returned 502 during triage, so no duplicate group or gated @clawsweeper comment was written yet.

Refs #76236
Refs #76203
Refs #76188
Refs #76107
Refs #76166

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels May 2, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 2, 2026

Codex review: found issues before merge.

Summary
The PR changes WebUI/Gateway session-change handling, transcript update session-key propagation, media generation provider laziness, plugin descriptor cache keys, Arcee provider policy, plugin install wording/trust, and Control UI dictation surfaces.

Reproducibility: yes. The review findings are reproducible by comparing the PR diff against current-main source/docs/tests for chat.transcribeAudio, Arcee Trinity compat, and official catalog npm plugin installs.

Next step before merge
Protected member-authored PR with blocking shipped-surface regressions needs maintainer/owner review before any repair lane should touch the branch.

Security
Cleared: No concrete security or supply-chain broadening was found; the plugin-install policy change is stricter but functionally regressive.

Review findings

  • [P2] Restore chat.transcribeAudio instead of deleting dictation — src/gateway/server-methods.ts:85
  • [P2] Preserve Trinity Large Thinking tool-disable compat — extensions/arcee/models.ts:47-49
  • [P2] Keep official catalog packages trusted — src/plugins/install.ts:117
Review details

Best possible solution:

Keep the focused latency fixes, but restore shipped dictation, Arcee Trinity no-tools compatibility, and catalog-derived official npm plugin trust before changed-gate validation.

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

Yes. The review findings are reproducible by comparing the PR diff against current-main source/docs/tests for chat.transcribeAudio, Arcee Trinity compat, and official catalog npm plugin installs.

Is this the best way to solve the issue?

No. The session reload, transcript-key, lazy media-provider, and descriptor-cache directions are maintainable, but the current patch mixes them with unrelated removals that break existing product and plugin behavior.

Full review comments:

  • [P2] Restore chat.transcribeAudio instead of deleting dictation — src/gateway/server-methods.ts:85
    The branch removes the Gateway handler registration and public method for chat.transcribeAudio while current main still exposes documented Control UI microphone dictation through that RPC. After merge, existing WebChat clients using the dictation button would receive an unknown-method failure instead of a transcript. Keep the RPC/UI/tests and make the media-provider path lazy without deleting the feature.
    Confidence: 0.96
  • [P2] Preserve Trinity Large Thinking tool-disable compat — extensions/arcee/models.ts:47-49
    The new Arcee catalog keeps only supportsReasoningEffort: false for Trinity Large Thinking and deletes the provider-policy hook/tests that add supportsTools: false. Current docs and tests say this default reasoning model has no tool/function-calling support; dropping the compat flag makes OpenClaw send tool schemas to a model that should not receive them.
    Confidence: 0.94
  • [P2] Keep official catalog packages trusted — src/plugins/install.ts:117
    The hard-coded trusted package map only allows @openclaw/codex, replacing the current catalog-derived trust list. Official catalog npm plugins such as @openclaw/feishu then lose the trusted scanner path covered by current tests, so installs that were intentionally allowed can be blocked or warned as unsafe even when the package and expected plugin id match.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.92

What I checked:

  • Protected PR routing: Provided PR context shows authorAssociation MEMBER and the protected maintainer label, so this cleanup workflow should keep it open for maintainer handling rather than close it. (5f0af99171d8)
  • Current main ships chat.transcribeAudio: Current main imports and registers chatTranscribeAudioHandlers in the core Gateway handler map, and lists chat.transcribeAudio in WebChat methods/scopes; the PR diff removes those registrations plus UI/docs/tests. (src/gateway/server-methods.ts:15, 9ef7f241f605)
  • Dictation implementation is active behavior: The current handler decodes browser audio, enforces payload limits, transcribes through media understanding, returns { text, provider, model }, and deletes the temp file; docs describe the same Control UI dictation behavior. (src/gateway/server-methods/chat-transcribe-audio.ts:68, 9ef7f241f605)
  • Arcee Trinity no-tools compat is intentional: Current main defines ARCEE_TRINITY_LARGE_THINKING_COMPAT with supportsTools: false, applies/tests it for direct and OpenRouter-backed Arcee models, and documents Trinity Large Thinking as not supporting tools; the PR removes that compat path. (extensions/arcee/provider-policy.ts:8, 9ef7f241f605)
  • Official npm plugin trust is catalog-derived: Current main builds the trusted official npm package map from listOfficialExternalPluginCatalogEntries() and tests @openclaw/feishu; the PR replaces this with a hard-coded @openclaw/codex map and removes the catalog coverage. (src/plugins/install.ts:119, 9ef7f241f605)
  • The targeted latency issue is real: Current main still reloads sessions.list after every sessions.changed event, emits several transcript updates as file-only strings, and eagerly passes media provider arrays into explicit model-config resolution, matching the PR's stated hot-path cluster. (ui/src/ui/app-gateway.ts:744, 9ef7f241f605)

Likely related people:

  • steipete: Related PR feat(webchat): add server-side dictation #76021 identifies steipete as the author, and local history/blame shows commit 68359ca added the WebChat/Gateway dictation handler, UI, docs, and tests that this PR removes. (role: introduced shipped dictation behavior; confidence: high; commits: 68359cacbf58; files: src/gateway/server-methods/chat-transcribe-audio.ts, src/gateway/server-methods.ts, ui/src/ui/app.ts)
  • vincentkoc: Local history shows Vincent Koc authored the current Arcee Trinity compatibility commit and the trusted official npm install commit that this PR partially removes. (role: recent provider/install maintainer; confidence: high; commits: dd43caa27aa1, 5ed7f1fd264d; files: extensions/arcee/provider-policy.ts, extensions/arcee/models.ts, extensions/arcee/index.ts)

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

@BunsDev BunsDev self-assigned this May 2, 2026
@BunsDev BunsDev requested a review from Copilot May 2, 2026 22:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reduces Control WebUI/Gateway session-related latency by avoiding unnecessary full session-list reloads, carrying session keys through transcript update events to skip file→session lookup, and making media generation provider discovery lazy when explicit model config is present.

Changes:

  • Control UI: skip loadSessions() on sessions.changed when a message-phase patch was successfully applied locally.
  • Gateway/session plumbing: include sessionKey in file-only transcript update emissions to avoid hot-path transcript-file key resolution.
  • Media tools: make provider listing lazy in resolveCapabilityModelConfigForTool, and update image/video/music generation tools + tests to verify explicit model paths don’t enumerate providers.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ui/src/ui/app-gateway.ts Avoids full session reload when a message-phase sessions.changed patch was applied.
ui/src/ui/app-gateway.sessions.node.test.ts Adds coverage for the new message-phase no-reload behavior.
src/config/sessions/transcript.ts Passes sessionKey through file-only transcript update events.
src/agents/tools/media-tool-shared.ts Allows lazy provider sources (thunk) and memoizes resolution.
src/agents/tools/image-generate-tool.ts Uses lazy provider listing for explicit image model config.
src/agents/tools/image-generate-tool.test.ts Tests explicit-config path does not list runtime providers; refactors env stubbing.
src/agents/tools/video-generate-tool.ts Uses lazy provider listing for explicit video model config.
src/agents/tools/video-generate-tool.test.ts Adds explicit-config “no provider listing” test; improves env isolation.
src/agents/tools/music-generate-tool.ts Makes provider selection lazy when no reference images; threads providerId via parsed model ref.
src/agents/tools/music-generate-tool.test.ts Verifies explicit-config execution doesn’t list runtime providers.
src/agents/pi-embedded-runner/transcript-rewrite.ts Emits transcript update with {sessionFile, sessionKey}.
src/agents/pi-embedded-runner/transcript-rewrite.test.ts Updates assertions for new transcript update payload shape.
src/agents/pi-embedded-runner/tool-result-truncation.ts Emits transcript update with {sessionFile, sessionKey}.
src/agents/pi-embedded-runner/tool-result-truncation.test.ts Adds listener assertion including sessionKey.
src/agents/pi-embedded-runner/compaction-hooks.ts Emits transcript update with {sessionFile, sessionKey}.
src/agents/pi-embedded-runner/compact.hooks.test.ts Updates assertions for new transcript update payload shape.
src/agents/command/attempt-execution.ts Emits transcript update with {sessionFile, sessionKey} after persisting turn transcript.
CHANGELOG.md Documents the performance-related fixes and references relevant issues.

@BunsDev BunsDev marked this pull request as ready for review May 2, 2026 22:29
@BunsDev
Copy link
Copy Markdown
Member Author

BunsDev commented May 2, 2026

@copilot resolve the merge conflicts in this pull request

Copy link
Copy Markdown
Contributor

Copilot AI commented May 2, 2026

@copilot resolve the merge conflicts in this pull request

Done — merged latest main into the branch. The only conflict was in CHANGELOG.md where both sides added entries to ### Fixes; resolved by keeping all entries from both sides (commit 276fd38f).

Copilot finished work on behalf of BunsDev May 2, 2026 22:43
@BunsDev BunsDev closed this May 2, 2026
@BunsDev BunsDev force-pushed the meow/webui-runtime-latency-cluster branch from 37a2367 to 5ed7f1f Compare May 2, 2026 23:20
@BunsDev BunsDev reopened this May 2, 2026
@BunsDev BunsDev requested a review from a team as a code owner May 2, 2026 23:21
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts commands Command implementations extensions: arcee size: XL and removed size: XS labels May 2, 2026
Rewrite PR branch onto current main with verified history and changelog attribution for @BunsDev.
@BunsDev BunsDev reopened this May 2, 2026
@BunsDev BunsDev merged commit 05c9492 into main May 2, 2026
105 checks passed
@BunsDev BunsDev deleted the meow/webui-runtime-latency-cluster branch May 2, 2026 23:39
lxe pushed a commit to lxe/openclaw that referenced this pull request May 6, 2026


Reduce WebUI/Gateway latency churn by avoiding redundant session reloads, carrying session keys through transcript update events, and deferring explicit media provider discovery. Includes changelog attribution and closes the referenced runtime latency issues.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026


Reduce WebUI/Gateway latency churn by avoiding redundant session reloads, carrying session keys through transcript update events, and deferring explicit media provider discovery. Includes changelog attribution and closes the referenced runtime latency issues.
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 commands Command implementations docs Improvements or additions to documentation extensions: arcee gateway Gateway runtime maintainer Maintainer-authored PR scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants