Skip to content

test(ui): measure usable first-run replies without losing RPC events - #194958

Merged
steipete merged 3 commits into
mainfrom
solid2/w-perf-first-run-reconnect-1107
Nov 8, 2026
Merged

steipete merged 3 commits into
mainfrom
solid2/w-perf-first-run-reconnect-1107

Conversation

@steipete

@steipete steipete commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What problem this solves

The first-run benchmark could keep collecting renderer CPU for another 449–500 ms after a reply was visible because its locator wait backed off, and its readiness marker did not require the composer to be enabled. It also read the RPC record array and cleared it later, dropping shutdown/hello records that arrived between those operations (two WebKit restart pairs were missing in 20 journeys).

Result

Use the existing visible-control wait on animation frames, require both the new reply and enabled composer for reply readiness, retain exact synthetic-text assertions, and drain captured RPC records atomically. No production UI, reconnect policy, protocol, dependency, or bundle changes remain.

The final diff is two benchmark files: 1,923 → 1,926 lines (+19/−16). The existing helper owns the wait; no new state or abstraction is introduced.

Proof

Check Result
Real isolated Gateway journeys Corrected harness: 30 Chromium, 20 Firefox, and 3 WebKit rotated base/control/head triplets; every UI journey completes
Reply collection boundary Corrected Chromium post-readiness collection tail median 54–58 ms, max 76 ms in the inspected cohort; the old 449–500 ms tail is removed
RPC capture All corrected Chromium/Firefox restart triplets and all 3 corrected WebKit triplets retain shutdown plus accepted new hello; older WebKit comparison retained only 18/20
Script types Passed after merging current main
Scoped formatting/lint Passed
Production Knip Passed
Independent review Full helper context supplied; no actionable P0–P2 findings
Broad CI ci:full; 42450147355 passed on exact head 81961c955e1

The benchmark's CLI cleanup still reports Gateway shutdown was not acknowledged and clean after the completed journeys (accepted acknowledgment, process terminated by the existing watchdog). This remains a recorded local failure, not a passing exit code; it is outside this change and was not investigated here.

Commands used the existing scripts/bench-control-ui-rpc-payloads.ts --first-run workload with immutable base/head bundles, headless engines, desktop localhost, fresh isolated state and synthetic provider data. Chromium ran the predeclared 20-triplet comparison plus one fixed 10-triplet extension; Firefox ran 20, and WebKit ran a three-triplet capture supplement. The original 35-condition first-run coverage includes desktop/mobile, localhost/100 ms RTT, and Chromium 1×/4×. No local full E2E suite was run.

Investigation outcome

An experimental 700 ms announced-restart retry seed was removed before landing. It shortened Chromium shutdown→usable composer from 5,042.9 to 4,496.5 ms (30 pairs), but second-reply CPU p95 remained 257.9 → 272.1 ms (+5.5%) after the fixed extension; readiness p95 was 365.6 → 372.5 ms (+1.9%). A/A did not clear the recorded parity rule. This is not a claim of statistically proven harm; it is insufficient evidence to land the runtime change. No further resampling or remote performance-acceptance matrix was run after that failure.

Related landed fixes: provider-setup crash #194866 and activation layout stability #194914. This PR changes measurement only and makes no UI latency-win claim.

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Nov 8, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lowers the browser reconnect backoff seed from 800 ms to 700 ms after an authenticated expected-restart announcement.

Example: A connected browser receives shutdown with restartExpectedMs: 1500, then disconnects.

  • Before: With zero jitter, the first reconnect is scheduled after 800 ms.
  • After: With zero jitter, the first reconnect is scheduled after 700 ms; ordinary disconnects retain 800 ms.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and has no concrete correctness finding, but changed-behavior performance proof remains explicitly pending.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: After setup restarts the Gateway, the browser can remain reconnecting after the Gateway is already available.
Reason: The maintainer-authored direction addresses a repeatedly observed delay with a narrow change and an explicit acceptance rule.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored draft open; the focused reconnect optimization is distinct from the merged layout fix, and no actionable introduced defect was found.

Priority: P2
Reviewed head: 495e258cb32be592c3ca0c7632e120faff8b6bb3

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply the declared real-Gateway base/control/head restart measurements through accepted hello and usable composer, including browser profiles, median/p95 results, and unaffected-flow acceptance.
Agent review details

How this fits together

GatewayBrowserClient translates browser connection policy into the shared GatewayProtocolClient, which owns WebSocket handshakes, reconnect scheduling, jitter, cancellation, and server retry floors.

flowchart LR
  A[Gateway restart announcement] --> B[Browser connection adapter]
  B --> C[Shared protocol client]
  C --> D[Retry supervisor]
  D --> E[WebSocket reconnect]
  E --> F[Accepted hello and usable Chat]
Loading

Technical review

Best possible solution:

Retain the existing reconnect owner and ship the narrow announced-restart adjustment only if it meets the declared performance acceptance.

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

Source establishes the existing 800 ms reconnect seed and the proposed announced-restart exception; the linked investigation reports a repeated reconnect tail, but this review ran no product code or tests.

Is this the best way to solve the issue?

The change is a small, coherent performance experiment using the existing retry owner; the helper extraction preserves synchronous hello delivery and the regression distinguishes announced from ordinary reconnects.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0b4fc062a553.

Provenance checked

  • Browser reconnect policy changes intended behavior with a stated reason (7c9b8ba: The shared-client refactor preserved browser-specific 800 ms/1.7x/15 s policy while centralizing protocol lifecycle ownership.)
  • Pairing event handling keeps the original intent (9e0734b: Pending, declined, and expired pairing outcomes must remain with the pairing owner and must not silently create new requests.)
  • Early Gateway regression fixtures keeps the original intent (4420648: The early connection hands off ordered events and retains protocol-owned recovery while discarding retired buffered events.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 9e0734b adds ui/src/api/gateway.ts:273 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9e0734be272f; files: ui/src/api/gateway.ts)

PR surface

Source +8, Tests 0. Total +8 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 9 1 +8
Tests 1 22 22 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 31 23 +8

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: This tunes a recoverable reconnect delay after setup; the reported flow eventually succeeds and does not establish a blocked first run.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This tunes a recoverable reconnect delay after setup; the reported flow eventually succeeds and does not establish a blocked first run.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 7, 2026, 10:32 PM ET / November 8, 2026, 03:32 UTC.

Wait on animation frames for the expected reply and enabled composer, and drain first-run RPC records atomically. Withdraw the reconnect tuning that did not clear the recorded timing parity rule. Merge current main.
@steipete steipete changed the title perf(ui): shorten reconnect after an announced setup restart test(ui): measure usable first-run replies without losing RPC events Nov 8, 2026
@steipete
steipete marked this pull request as ready for review November 8, 2026 05:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T05:18:37.499696Z 81961c9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete enabled auto-merge (squash) November 8, 2026 05:23
@steipete
steipete merged commit f3f82c6 into main Nov 8, 2026
178 of 183 checks passed
@steipete
steipete deleted the solid2/w-perf-first-run-reconnect-1107 branch November 8, 2026 05:30
@steipete

steipete commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 9, 2026
…penclaw#194958)

* perf(ui): shorten announced restart reconnect backoff

* fix(perf): align first-run reply and RPC measurement windows
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 ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S 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