Repository navigation
refactor(ui): share reactive browser resource lifetimes - #176364
Conversation
Centralize resize and intersection observation, media and document visibility, and owned timers. Preserve initial adopter policies and defer observer target reads until refs settle.
|
🦞👀 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 centralizes browser observer, media, visibility, and timer cleanup for five Control UI consumers. Example: The About page displays copy feedback for 1800 milliseconds.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored refactor open. The shared lifecycle helpers preserve caller policy, and no actionable correctness or security defect was found; the failing browser checks have matching failures on main. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherControl UI components pass element references, browser events, and timer delays into reactive helpers, which deliver callbacks and release browser resources when their Solid owner ends. flowchart TD
A[Control UI components] --> B[Reactive resource helpers]
B --> C[Browser observers and listeners]
B --> D[Browser timers]
C --> E[Caller presentation policy]
D --> E
F[Solid owner disposal] --> B
Technical reviewBest possible solution: Retain the narrow resource helpers and caller-owned policies, with inherited CI handled through the existing landing workflow. Do we have a high-confidence way to reproduce the issue? This PR reports repeated lifecycle machinery rather than a specific user-visible bug; source inspection confirms that repetition, and no reproduction was run. Is this the best way to solve the issue? The smallest coherent approach is the proposed owner-scoped helpers with local setup removed from each adopter; existing polling policy and domain owners remain separate. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d0dcce33fd71. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +90, Tests +244, Docs +6. Total +340 across 13 files. Added test files: 3. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
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 18, 2026, 4:01 PM ET / 20:01 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
What Problem This Solves
Control UI components repeat browser observer, media, visibility, and timer lifetimes, making the Solid cleanup and equal-value refresh rules easy to get wrong during the ongoing refactor.
User Impact
No intended user-visible change. This is the first shared-primitives batch for the Solid refactor; tags, markup, styles, routes, and selectors stay the same.
Why This Change Was Made
Add small, separately imported owner-scoped primitives for resize/intersection observation, media queries, document visibility, intervals, and restartable timeouts. Initial adopters are the mascot, plugin install elapsed time, catalog skeleton measurement, Cron editor clearance, and About copy/wave feedback. The primitives own browser-resource cleanup; each caller retains its measurement, visibility, and product policy. Catalog measurement remains frame-coalesced, and Cron clearance still observes both the footer and scrollport.
Intervals are isolated through a memo so equal effective delays preserve the pending tick. No dependency or startup registration is added. The primitive-selection table documents the APIs.
Evidence
pnpm tsgo:ui--maxWorkers=1src/auto-reply/reply/reply-admission-ticket.tsandreply-turn-admission-owner.ts; both commands exit 1pnpm ui:buildNode 24.22.0; build identity variables differ, so the delta is not claimed as a pure source-only improvementci:fullrun 39159924107: all checks pass except the two real-Gateway shards; all four failing names match scheduledmainrun 39158806323This changes resource management, with no visual markup/style change; no screenshot claim is made. Existing mascot assertions now await the committed reactive update after platform events. Full UI E2E and retention/performance suites stay in CI under the campaign's local compute budget.
Refactor measurements
Counts cover the eight changed production files, including the three new primitive modules, against
1446ecc39398c6e4f53cda9a260342cb914e8cb8.createEffectcreateRenderEffectuntrackaddEventListenerquerySelector(All)The three added effects live in observer/timer primitives and implement genuine external synchronization. The existing mascot adds one playback reaction while the installer deletes its local timer effect. Production grows by 90 lines to provide six shared browser-resource contracts; the five initial adopters shrink overall. Tests add independent lifecycle/cancellation coverage.
Inventory and next batch
Inventory across production
ui/src: 33 resize observers in 32 files, 11 intersection observers, 31 media-query calls in 27 files, 19 intervals, 220 timeout calls, and 7 document-title assignments. These include plain TypeScript owners and are not all conversion candidates. Existinglisten, visible polling, stream following, scroll-state observation, near-viewport observation, dock persistence, and the resizable divider already cover part of the requested inventory. Domain persistence remains in plain owners; no competing localStorage signal is introduced.Follow-up in this lane: remove redundant tracking suppression from reactive adapters, preserve deliberate initial snapshots, and cover the remaining matching resource patterns without copying transcript geometry, overlay focus policy, or domain storage into a second owner.
Review found that observer target memos ran before refs were assigned. The primitive now gates target reads until
onSettled; a realmountSolidref-order regression failed on the first draft and passes with the correction.Remaining effect categories in the touched production files: observer-resource binding (
ui/src/lib/reactive/observers.ts:24,41), interval-resource binding (ui/src/lib/reactive/timers.ts:5), and imperative canvas playback/render synchronization (ui/src/components/openclaw-mascot.tsx:95,107). No feature render effects, tracking suppression, DOM queries, or direct DOM listener registrations were introduced.Inherited CI failures
The exact names below fail both on this PR and the latest completed scheduled
mainrun, not merely in the same shards. Native inherited-failure admission is requested with the captured checkout and test evidence; failed CI is not represented as green.The PR run tested merge
a30c73ed9074c18d44ee107e53f670c7c1c82e5f, with ordered parentsa8307013add13130826a2ceb5b7c14a923a02aa4and9057da791b8ea21f4b94ef826d0c4c015bd91f5a. The failed test sources are unchanged between that baseline and tested merge.