Skip to content

test(control-ui): guard chat streaming runtime budgets - #128154

Merged
vyctorbrzezowski merged 4 commits into
mainfrom
perf/ci-performance-gates
Aug 23, 2026
Merged

vyctorbrzezowski merged 4 commits into
mainfrom
perf/ci-performance-gates

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

The Control UI has bundle-size budgets and process-level performance scenarios, but no in-browser runtime guards for chat stream render coalescing, bounded live tool state, long-transcript cost, or idle main-thread work. A regression could render on every streamed delta, retain an unbounded tool stream, or leak long sessions while CI remained green.

Why This Change Was Made

This adds browser-level budgets to the existing mocked-Gateway Control UI E2E lane:

  • 240 streamed deltas must remain frame-scheduled and commit no more than 180 host updates.
  • The first tool lifecycle is observed before result: absent before the 80ms throttle, partially projected after it, and completed immediately by result. The flood then continues through 60 calls and retains exactly the newest 50 cards.
  • A 400-message transcript plus rich streamed turn stays within load-time and post-GC heap ceilings.
  • A settled stream stays within aggregate and long-task idle budgets.
  • The duration-weighted UI E2E sequencer accounts for this suite at 34 seconds.

No production code, config, dependency, or public contract changes.

User Impact

Operators see no behavior change. Developers get a focused CI failure when chat streaming coalescing, tool-stream throttling or retention, long-session cost, or idle work regresses.

Evidence

Environment: Linux, Playwright Chromium 1.62.1, OPENCLAW_VITEST_MAX_WORKERS=2.

Focused E2E command:

OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-stream-runtime-budgets.e2e.test.ts

Three consecutive green runs on 2b706a53aad, 4/4 tests each:

Run Duration
1 36.45s
2 30.73s
3 32.74s

Negative proof:

  • Forcing every non-terminal phase to flush immediately made the pre-throttle sample find one card instead of zero.
  • Removing flushToolStreamSync(host) from the 80ms timer left zero cards after the throttle instead of the required partial card.
  • Removing the pending-frame dedupe and stale-callback fence from requestChatPageUpdate made the burst fail at 241 > 180 updates while 240/241 still ran inside rAF.

Production was restored after each mutation; the committed diff remains E2E/test support only.

Additional validation:

  • OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs test/vitest-ui-e2e-config.test.ts (4/4)
  • node scripts/check-changed.mjs -- ui/src/e2e/chat-stream-runtime-budgets.e2e.test.ts test/vitest/vitest.ui-e2e.sequencer.ts
  • .agents/skills/autoreview/scripts/autoreview --mode local --max-priority P2 (clean; no actionable findings)
  • Production LOC: +0/-0; tests/test support: +670/-0 from the PR base.

@vyctorbrzezowski vyctorbrzezowski self-assigned this Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Aug 23, 2026
@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review August 23, 2026 08:22
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Aug 23, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. labels Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 12:41 PM ET / 16:41 UTC.

ClawSweeper review

What this changes

The branch adds mocked-Gateway Control UI E2E budgets for streamed rendering, deferred and bounded tool cards, long-transcript cost, idle work, and the UI E2E duration scheduler.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness finding. The PR adds focused browser coverage for existing Control UI stream invariants; it should remain open until its exact-head UI E2E shards finish and the clean merge result is rechecked.

Priority: P2
Reviewed head: fed953720969dd4da9d222e0465a11e56f707b8d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The test-only patch is coherent and covers real browser behavior; exact-head sharded UI E2E completion remains the final merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: The PR is authored by a repository member; its body nevertheless provides focused mocked-Gateway Chromium runs and negative regression checks.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The PR is authored by a repository member; its body nevertheless provides focused mocked-Gateway Chromium runs and negative regression checks.
Evidence reviewed 7 items Changed test surface: The exact branch delta is one scheduler hint and one new 669-line Control UI E2E suite; no production files change.
Rendering owner and caller: Current main batches chat deltas through an animation-frame request and the event handler selects that mode for chat deltas and agent events.
Bounded tool-stream contract: Current main caps the live tool stream at 50 entries and uses an 80ms deferred synchronization timer; the new suite exercises both behaviors through the browser boundary.
Findings None None.
Security None None.

Live Verification

Command: OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-stream-runtime-budgets.e2e.test.ts

Result: FAIL (failed) — step 1 run OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-stream-runtime-budgets.e2e.test.ts: terminal command did not produce output within 20 seconds: "OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-stream-runtime-budgets.e2e.test.ts"

OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-stream-runtime-
budgets.e2e.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128154-yAKpjm/target$ OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run --config test/vitest/vitest
.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-stream-runtime-budgets.e2e.test.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128154-yAKpjm/target

OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-stream-runtime-
budgets.e2e.test.ts










































Assertions:

  • FAIL expect_output: 4 passed

How this fits together

Gateway chat and agent events enter the Control UI, where chat state batches streamed rendering and projects live tool cards. The new E2E suite drives that boundary in Chromium and feeds its expected duration to the CI shard sequencer.

flowchart LR
A[Mock Gateway events] --> B[Control UI chat state]
B --> C[Frame-scheduled rendering]
B --> D[Live tool-card projection]
C --> E[Browser runtime-budget suite]
D --> E
E --> F[UI E2E shard scheduler]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main and several exact-head UI E2E shards are still running; merge only after those checks are green and GitHub still reports a clean merge result.
  • Complete next step (P2) - The protected maintainer item has no repair finding; the remaining action is exact-head UI E2E and clean-merge verification.
Agent review details

Security

None.

PR surface

Tests +670. Total +670 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 670 0 +670
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 670 0 +670

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests/test support +670/-0 The added coverage protects existing UI behavior without changing runtime code.
UI E2E scheduling 1 duration hint added: 34 seconds This feeds the serial Chromium shard balancer and is the merge-relevant CI-cost change.

Merge-risk options

Maintainer options:

  1. Complete exact-head UI E2E validation (recommended)
    Wait for the current head's sharded Chromium checks to pass, then recheck that the behind-main branch remains cleanly mergeable.

Technical review

Best possible solution:

Keep the browser-level regression gate and land it once the exact-head sharded UI E2E run confirms the added 34-second workload is stable.

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

Not applicable: this is preventative test coverage, and the PR body supplies a focused mocked-Gateway E2E run for the protected path.

Is this the best way to solve the issue?

Yes. Browser E2E is the appropriate owner-boundary layer for frame scheduling and rendered tool-card retention, while existing unit tests retain deterministic coverage of the underlying state logic.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 17ecb9db67a0.

Labels

Label justifications:

  • P2: This is a bounded Control UI regression-prevention improvement with no operator-visible behavior change.
  • merge-risk: 🚨 automation: The added 34-second Chromium suite changes CI shard load and needs exact-head stability confirmation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR is authored by a repository member; its body nevertheless provides focused mocked-Gateway Chromium runs and negative regression checks.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame attributes the render queue, tool-stream bounds, and UI E2E sequencer lines to the same recent commit. (role: current-main streaming-surface author; confidence: medium; commits: 2aa4b694e116; files: ui/src/pages/chat/chat-state-render.ts, ui/src/pages/chat/tool-stream.ts, test/vitest/vitest.ui-e2e.sequencer.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the current head's UI E2E shards complete successfully, then refresh mergeability against main.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (7 earlier review cycles)
  • reviewed 2026-08-23T08:29:45.204Z sha 731fbbe :: found issues before merge. :: [P2] Measure all idle work, not only long tasks
  • reviewed 2026-08-23T09:01:16.570Z sha 731fbbe :: needs changes before merge. :: [P2] Measure aggregate idle task time | [P2] Assert the actual oldest-eviction boundary
  • reviewed 2026-08-23T10:07:41.567Z sha 731fbbe :: needs changes before merge. :: [P2] Measure aggregate idle task time | [P2] Assert the first retained tool card
  • reviewed 2026-08-23T10:29:24.954Z sha 731fbbe :: found issues before merge. :: [P2] Measure aggregate idle task time | [P2] Assert the first retained tool card
  • reviewed 2026-08-23T10:53:15.076Z sha 573987c :: needs changes before merge. :: [P2] Assert coalescing rather than rAF context | [P2] Teach the sharder this suite's measured duration | [P2] Cover or stop claiming throttled tool projection
  • reviewed 2026-08-23T13:44:26.307Z sha 07fd210 :: found issues before merge. :: [P2] Assert the deferred tool projection before completion
  • reviewed 2026-08-23T14:58:21.110Z sha 2b706a5 :: needs maintainer review before merge. :: none

@vyctorbrzezowski vyctorbrzezowski changed the title chore(control-ui): guard chat streaming runtime budgets with e2e gates Guard chat streaming runtime budgets with end-to-end gates Aug 23, 2026
@vyctorbrzezowski vyctorbrzezowski changed the title Guard chat streaming runtime budgets with end-to-end gates test(ui): guard chat streaming runtime budgets with e2e gates Aug 23, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. label Aug 23, 2026
@vyctorbrzezowski vyctorbrzezowski changed the title test(ui): guard chat streaming runtime budgets with e2e gates test(control-ui): guard chat streaming runtime budgets Aug 23, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 23, 2026
@vyctorbrzezowski
vyctorbrzezowski force-pushed the perf/ci-performance-gates branch from 2b706a5 to fed9537 Compare August 23, 2026 16:34
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Land-ready verification on head fed953720969dd4da9d222e0465a11e56f707b8d:

  • Three consecutive focused Chromium runs passed all four budgets in 30.49s, 30.41s, and 32.27s, below the 34-second sequencer hint.
  • Metrics remained stable: host updates 106-118/180, frame-scheduled ratio ~0.99, transcript load 904-1268ms/30000ms, heap ~21MB/96MB, idle task 112-127ms/600ms, zero long tasks.
  • Mutation proof: disabling frame coalescing failed at 241 host updates; raising tool retention to 100 failed with 60 cards instead of 50. Production owners were restored with no residual diff.
  • node scripts/check-changed.mjs passed.
  • Fresh autoreview returned no accepted/actionable findings.
  • Exact-head CI run 32652098461 passed, including all 12 UI E2E shards.
  • Native review-validate-artifacts and OPENCLAW_TESTBOX=1 scripts/pr prepare-run 128154 passed using hosted exact-head evidence.

Production LOC: +0/-0. Tests and test support: +670/-0.

@vyctorbrzezowski
vyctorbrzezowski merged commit 7941c05 into main Aug 23, 2026
145 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the perf/ci-performance-gates branch August 23, 2026 16:50
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 24, 2026
* test(control-ui): gate chat stream runtime budgets in e2e

* test(control-ui): strengthen stream runtime budget gates

* test(control-ui): close stream budget review gaps

* test(control-ui): prove deferred tool projection
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 merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant