Repository navigation
perf(plugins): reduce settings load and repeated view work - #184126
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR defers WhatsApp translations, memoizes ClawRouter traffic selection, and retains MCP Relay controls during unrelated updates and pending actions. Example: Connected apps displays 300 grants while 20 unrelated host updates arrive.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides useful performance improvements within the existing plugin owners, with no actionable introduced defect found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI mounts plugin-owned settings and pages, supplies locale and connection updates, and receives rendered status and controls backed by existing Gateway requests. flowchart TD
A[Control UI host] --> B[Plugin view mounts]
B --> C[WhatsApp locale catalog]
B --> D[ClawRouter traffic memo]
B --> E[MCP Relay retained controls]
A --> F[Existing Gateway request owner]
F --> B
Technical reviewBest possible solution: Retain these focused optimizations within the existing plugin view and request owners. Do we have a high-confidence way to reproduce the issue? Current-main source shows eager foreign-catalog loading, repeated grant-traffic filtering, and unconditional MCP page rebuilding; no target code was executed during this review. Is this the best way to solve the issue? The changes remove unnecessary loading and repeated work using existing owners, preserve request settlement and permission handling, and introduce no unnecessary production layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4acca278a179. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +49, Tests +177, Docs +5. Total +231 across 9 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 25, 2026, 11:14 PM ET / October 26, 2026, 03:14 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
What Problem This Solves
English WhatsApp settings load every translation catalog, ClawRouter repeats the same traffic scan for each displayed total, and MCP Relay rebuilds connected-app controls during unrelated updates and pending actions.
User Impact
WhatsApp loads less JavaScript in English. ClawRouter spends less CPU loading and refreshing its pool view. MCP Relay keeps focused controls stable during unrelated updates and reduces work for refresh and revoke, while retaining permission updates and authoritative action results.
Why This Change Was Made
Keep English synchronous and load the existing foreign catalog when needed, reuse one reactive traffic selection per grant, and retain MCP Relay’s existing native controls while an action is pending. The existing plugin owners, lazy boundaries, routes, tags and CSS stay in place. There are no new dependencies.
The author simplification pass retained these three small changes and their distinct correctness tests. Growth is needed for asynchronous locale settlement and pending-control handling: nine touched files, production 1,096 → 1,145 LOC (+49), tests 571 → 748 (+177), and documentation +5 lines. No additional abstraction was introduced.
Evidence
pnpm tsgo:uipnpm deadcode:knipThese local checks precede publication; they are not an exact-head PR CI result. The selected patch reuses the same reviewed source and measured assets, rather than claiming a new performance run on current main.
Scoped Solid refactor checklist
Counts cover the five changed production files in this nine-file patch, excluding tests and the README. They reuse the verified AST census; the before blobs match the patch base and the after hashes match the selected source. The final controller guard also passed.
createEffectcreateRenderEffectuntrackaddEventListenerquerySelector/querySelectorAllflushgetOwnerrunWithOwneronCleanupAll direct listeners and DOM queries belong to MCP Relay’s existing plain-TypeScript/native-DOM page: two listeners remain unchanged, and queries rise 14 → 17 to remove old error feedback, update status, and disable controls while retaining rows. ClawRouter and WhatsApp retain zero direct DOM listeners and zero DOM queries. The new dynamic import loads a JSON catalog in the translation utility, rather than manually loading a component.
The other checklist categories remain unchanged: one stable JSX refresh handler, zero component lifecycle cleanup or owner-capture calls, zero legacy Solid 1 APIs or hand-written
createComponent, zero throwing context wrappers, zero literal-only memos, zero index-only list generators, and no hand-rolled keyed merge. Existing host subscriptions remain 2 → 2 at the mount owners with explicit disposal; request/admission state and native MCP busy/error handling stay with those owners. ClawRouter’s derived memo count is 1 → 2, with no new copied reactive state, mutation state, or sibling-loading coordination. WhatsApp retains the existing host-provided snapshot adapter and adds catalog data, not a second request owner.Workload and acceptance
Production plugin assets render through the real Control UI plugin/settings entry points, with synthetic Gateway data. ClawRouter uses 20 grants, 20 models, four quota windows per grant, 20 lane-traffic rows and 380 keyed grant-traffic rows; readiness checks all grants, 80 windows and 400 model rows before refresh, changed refresh and scroll. WhatsApp uses the packaged channel settings view, seven status facts (eight with a phone number), refresh, synthetic QR/login completion and phone insertion/removal. MCP Relay uses 300 grants, 20 unrelated host publications, refresh, pair dialog/code, revoke and consent presentation; consent decisions and external navigation are excluded.
Cold load uses a new browser context. Warm load remounts in the same document with resident modules; HTTP cache remains disabled. The remote profile delays every HTTP request and synthetic WebSocket delivery by 100 ms. A/B order alternates, timing uses native renderer thread CPU, and coverage/trace diagnostics are collected separately. The shared host was loaded, so A/A controls and CPU phases inform interpretation; no control or instrumentation overhead is subtracted.
The campaign seeks a measured ≥5% win in a real flow with behavior preserved. Its timing band is median regression ≤5% with p95 no worse, extending the sample when needed; a CPU regression above 20% in work this change can affect blocks acceptance. This complete 20-pair evidence supports the specific wins below with adverse tails explicitly retained, rather than universal clean timing. No candidate sample recorded a long task over 100 ms; aggregate action CPU may still exceed 100 ms across multiple tasks.
Reproduce each plugin/profile with the official assets and plugin-view benchmark:
For A/A, use the baseline root in both asset slots and
--pairs 10, with separate output directories. Preserve the frozen host and plugin manifests across the comparison; rebuilding current main is a new comparison. These commands describe reproduction and have not been rerun for this PR preparation.Build bytes and measurement boundary
Both benchmark variants used the same frozen production host. Its five initial JS assets total 271,569 B under the official checker’s transfer accounting: four gzip sidecars total 271,528 B, plus a 41 B entry served uncompressed because it has no gzip sidecar. Its one initial CSS asset is 31,981 B gzip. This is reconstructed frozen-host accounting, not a fresh-main startup result or a claimed startup reduction. Emitted plugin JS is not executed/unused coverage; current-candidate MCP coverage and post-GC diagnostics are separate from the accepted formal timing cohort.
These results measure renderer/mock behavior, not real Gateway, relay, provider or account latency. WhatsApp’s 1×1 synthetic PNG measures QR-state rendering and does not represent realistic QR decoding cost. Task CPU includes automation/DevTools phases; wall timing is not INP. Point-in-time heaps are not leak proof.
ClawRouter
The load/refresh improvement is accepted. Refresh task medians fall 18.90% locally and 10.79% remotely; refresh script medians fall 51.72%/51.94%. Package growth is 18 B gzip.
The adverse tails remain part of the result: local scroll script p95 rises 0.417 → 0.937 ms (+0.520 ms, 124.70%); remote scroll task p95 rises 7.527 → 8.417 ms (+0.890 ms, 11.82%) with a flat 6.993 ms median. Remote scroll script/style p95 rises by 0.136/0.028 ms. Every measured scroll sample has zero requests and zero layouts. Remote changed-refresh layout p95 rises 7.509 → 8.372 ms (+11.49%), while its layout median and total-task distribution improve. Local cold layout median/p95 changes +0.61%/+2.43%, against A/A +4.36%/+13.92%; local cold style p95 is +2.81%, and remote changed-refresh style p95 +0.30%. These data support the accepted load/refresh win, not an all-metrics-clean claim or definitive attribution of the short tails.
WhatsApp
The accepted benefit is reduced load bytes: cold diagnostic JS falls 76,148 → 48,041 B (−36.91%), with executed JS 59,861 → 31,672 B. The full timing cohort does not establish a general CPU speedup.
Local cold task p95 rises 248.985 → 253.832 ms (+4.847 ms, 1.95%). Remote QR script median rises 4.137 → 4.350 ms (+0.213 ms, 5.15%), and refresh style 2.095 → 2.237 ms (+0.142 ms, 6.80%). Their A/A medians move −5.98%/−4.21%, so those increases are disclosed rather than attributed away. Other small tails include local QR style p95 +0.293 ms (+10.35%) and phone-removal layout p95 +0.037 ms (+8.64%). All aggregate interaction task medians remain within 5%; p95s improve or stay flat apart from remote phone +0.90%, within the stated sub-1% noise band. This is a load-byte acceptance, not an all-metrics or CPU-speedup claim.
MCP Relay
The accepted MCP2 candidate retains grant controls through unrelated publications and pending actions. Across 120 passing samples, publication/refresh/revoke task medians fall 85.99%/33.19%/18.46% locally and 80.09%/19.70%/28.78% at 100 ms RTT. Publication samples preserve the original row and focus with zero child-list churn, compared with 6,120 mutations, 6,240 added nodes and 180 removed nodes on the base. Package growth is 86 B gzip.
Remote consent task median improves 5.38%, but task p95 rises 60.925 → 71.725 ms (+17.73%). The two highest candidate samples spend 45.740–48.826 ms in DevToolsCommandDuration, compared with base p95 30.002 ms. Script p95 improves 4.027 → 3.858 ms and TaskOtherDuration p95 improves 18.963 → 14.781 ms; style/layout remain within 3%. Both variants perform exactly two consent RPCs and two layouts in every sample. The same-assets A/A consent p95 is 79.353 → 61.904 ms, with a larger base tail. These measurements locate the observed tail in the DevTools phase without establishing a particular driver or production cause; no control or overhead subtraction is applied to the reported total.
Other adverse cells remain disclosed: remote warm task median/p95 rises 0.48%/2.26%, with script +3.00%/+4.19%; local pair-code style rises 0.675 → 0.712 ms (+0.037 ms, 5.41%), with p95 +4.02%. Local warm and pair-open task p95 rises 1.47%/2.52%, against same-asset A/A +5.40%/+4.98%. Local consent script rises 4.69%/1.11%. This accepts the measured publication/refresh/revoke win, not an all-metrics-clean result. The detailed phase exceptions above remain part of acceptance; totals are not adjusted to remove them.
Exact MCP2 diagnostic (one pair per profile)
Four additional trace/coverage attempts passed: one baseline/candidate pair locally and one at simulated 100 ms delivery, on the same frozen host/driver and exact accepted MCP2 source. These are single instrumented observations, excluded from formal timing distributions. Cold loaded/executed/unused V8 source bytes are 8,154/4,835/3,319 → 8,466/5,147/3,319 in both profiles: 312 added/executed bytes and unchanged unused bytes, not gzip-transfer sizes. The 20-publication action again changes 6,120 mutations/6,240 additions/180 removals to zero, retains row/focus, and reduces publication layouts from 20 to zero.
The action sum spans seven steps, not one task. One final collection with the view still mounted is not leak/disposal proof. Local cold layout increases 0.470 ms; remote final heap increases 18,904 B, with seven more nodes and identical live element counts. These observations do not establish timing stability or replace the formal consent-tail disclosure above.
Before and after
All captures use synthetic data at 1440 × 1000 and preserve the rendered contract. The WhatsApp pair is byte-identical. ClawRouter’s inspected top section differs in a synthetic timestamp; MCP Relay’s base loses focus and candidate retains it.
Inherited CI failures
The exact-head CI run 40261696367 failed two tests in
ui/src/e2e/settings-layout.e2e.test.ts:aligns every mobile settings page with the topbar content(approvals settings shell did not render) andkeeps settings rows, introductions, section headings, and Learn more links on one layout system(page-title timeout). Both exact names and error signatures also fail on the latest completed scheduled-main run 40260665877, at1a905c7faa1b58d34295f3a415132ab1bcf56701. The native inherited-failure route retains these failures as red; no local E2E rerun or all-green CI claim is made.