Skip to content

perf(ui): surface chat ACK server timing#89801

Merged
vincentkoc merged 1 commit into
mainfrom
control-first-message-next
Jun 3, 2026
Merged

perf(ui): surface chat ACK server timing#89801
vincentkoc merged 1 commit into
mainfrom
control-first-message-next

Conversation

@vincentkoc
Copy link
Copy Markdown
Member

Summary

  • Adds optional chat.send ACK server timing for operator UI clients so Control UI can separate server pre-ACK time from browser/request time on first sends.
  • Preserves public WebChat behavior by omitting the new ACK timing payload for non-operator WebChat clients.
  • Normalizes the optional timing payload in the Control UI controller and records the flattened values in existing control-ui.chat.send ACK timing events.
  • Out of scope: changing send scheduling, model dispatch, transport auth, or visible chat rendering.

Linked context

Maintainer-requested follow-up for Control WebUI clean first-message slowness discovery.

Real behavior proof

  • Behavior or issue addressed: Control UI first-send telemetry could not distinguish browser/network request duration from server-side pre-ACK work.
  • Real environment tested: OpenClaw local linked worktree plus Blacksmith Testbox via Crabbox.
  • Exact steps or command run after this patch:
    • node scripts/run-vitest.mjs run src/gateway/server.chat.gateway-server-chat-b.test.ts -- --reporter=verbose
    • node scripts/run-vitest.mjs run ui/src/ui/controllers/chat.test.ts ui/src/ui/app-chat.test.ts -- --reporter=verbose
    • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/ui/e2e/chat-flow.e2e.test.ts -- --reporter=verbose
    • git diff --check
    • OPENCLAW_OXLINT_SKIP_PREPARE=1 OPENCLAW_OXLINT_SKIP_LOCK=1 node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/gateway/server-methods/chat.ts src/gateway/server.chat.gateway-server-chat-b.test.ts ui/src/ui/controllers/chat.ts ui/src/ui/app-chat.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/app-chat.test.ts
    • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main
    • node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --label control-first-message-next-rebased-check --idle-timeout 90m -- env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 corepack pnpm check:changed
  • Evidence after fix: Gateway test passes with Control UI mode=webchat receiving serverTiming; public webchat-ui regression verifies the field is omitted. Testbox tbx_01kt6jcjzh9esd723hvjnjvekh passed check:changed with lanes=core, coreTests.
  • Observed result after fix: Control UI ACK timing events include serverReceivedToAckMs, serverLoadSessionMs, and optional serverPrepareAttachmentsMs when the Gateway provides them.
  • What was not tested: live provider latency on a real user account.
  • Proof limitations or environment constraints: mocked UI E2E validates the browser flow and gateway traffic shape; live provider runtime timing still needs field observation once merged.

Tests and validation

  • Gateway focused: 31 tests passed.
  • Control UI unit focused: 197 tests passed.
  • Control UI mocked browser E2E: 12 tests passed.
  • Static: git diff --check, targeted oxlint clean.
  • Remote changed gate: Blacksmith Testbox through Crabbox passed on tbx_01kt6jcjzh9esd723hvjnjvekh.
  • Autoreview: clean, no accepted/actionable findings.

Risk checklist

  • Did user-visible behavior change? No
  • Did config, environment, or migration behavior change? No
  • Did security, auth, secrets, network, or tool execution behavior change? No
  • Highest-risk area: accidentally exposing operator-only timing metadata to public WebChat clients.
  • Mitigation: server gate uses operator UI identity, and regression coverage asserts public WebChat clients do not receive serverTiming.

Current review state

  • Next action: wait for PR checks, then squash merge if clean.
  • Waiting on: GitHub PR checks after push.
  • Bot or reviewer comments addressed: local autoreview initially caught the Control UI mode=webchat gating bug; the fix and regression coverage are included.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime labels Jun 3, 2026
@vincentkoc vincentkoc self-assigned this Jun 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Jun 3, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Jun 3, 2026

ClawSweeper status: review started.

I am starting a fresh review of this pull request: perf(ui): surface chat ACK server timing This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@byungskers
Copy link
Copy Markdown

Nice scope for the ACK timing split — this looks useful for separating gateway work from client-side paint/queue delays.

One follow-up I’d love a maintainer sanity check on: this adds a new response field on chat.send, but I didn’t see a protocol/docs touch in the diff. If serverTiming is intentionally Control-UI-only and best-effort, maybe that’s fine as an internal contract; otherwise it could be worth documenting somewhere near the gateway chat response shape so future clients don’t accidentally start depending on an undocumented field.

@vincentkoc
Copy link
Copy Markdown
Member Author

Land-ready proof for f296a6b2e1cbe0df5a13a9fab544c96645bd7454:

  • Local focused gateway: node scripts/run-vitest.mjs run src/gateway/server.chat.gateway-server-chat-b.test.ts -- --reporter=verbose -> 31 passed.
  • Local focused Control UI unit: node scripts/run-vitest.mjs run ui/src/ui/controllers/chat.test.ts ui/src/ui/app-chat.test.ts -- --reporter=verbose -> 197 passed.
  • Local mocked Control UI browser E2E: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/ui/e2e/chat-flow.e2e.test.ts -- --reporter=verbose -> 12 passed.
  • Static: git diff --check and targeted oxlint clean.
  • Remote changed gate: Crabbox -> Blacksmith Testbox tbx_01kt6jcjzh9esd723hvjnjvekh, pnpm check:changed, lanes core, coreTests, exit 0.
  • Autoreview: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main clean, no accepted/actionable findings.
  • PR CI: all checks green or neutral at merge review time.

Known proof gap: no live provider timing capture; this PR only adds/threads telemetry and proves the Gateway/UI contract shape.

@vincentkoc vincentkoc merged commit b1fccd0 into main Jun 3, 2026
189 of 195 checks passed
@vincentkoc vincentkoc deleted the control-first-message-next branch June 3, 2026 11:11
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 4, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request Jun 4, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request Jun 4, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request Jun 4, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request Jun 4, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request Jun 4, 2026
849261680 pushed a commit to 849261680/openclaw that referenced this pull request Jun 7, 2026
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 gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants