Repository navigation
refactor(ui): consolidate page lifecycle and rendering - #167780
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: needs maintainer review before merge. What this changesThis PR consolidates Control UI page rendering and lifecycle bookkeeping while preserving existing controls, appearance, and behavior. Review scores
ProductKind: Refactor · Worth it: Yes Merge readiness✅ Ready for maintainer review Keep open: this is useful, owner-backed maintenance that remains distinct from current main. The reviewed changes and supplied proof establish no actionable introduced defect. Priority: P3 Before mergeNone. FindingsNone. Provenance
Agent review detailsHow this fits togetherThe Control UI presents conversations, session controls, and settings in the browser. Its pages consume Gateway-owned state and manage local rendering, loading, and cleanup. flowchart LR
A[User navigation and controls] --> B[Page controllers]
C[Gateway-owned state] --> B
B --> D[Scoped browser state]
D --> E[Shared rendering and lifecycle]
E --> F[Conversation panels and settings]
F --> A
Technical reviewBest possible solution: Keep shared presentation mechanics with the existing data owners and preserve their distinct admission, recovery, and cleanup contracts. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes behavior-preserving maintenance rather than a reported bug. Is this the best way to solve the issue? Yes: the inspected consolidations remove duplicate bookkeeping and forwarding seams while retaining existing owners, variant-specific guards, and operation ordering. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6725e5741303. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfacePR surface statistics unavailable: the file list is incomplete. 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 HistoryReview history (1 earlier review cycle)
Reviewed October 9, 2026, 7:28 AM ET / 11:28 UTC (Revision 2). |
The page lifecycle refactor in #167780 replaced historyIntentConsumed with the nullable gesture timer. Observe that current owner in the real-Gateway loading proof while retaining the strict readiness, startup ordering, pagination, and avatar assertions.
* refactor(ui): consolidate page lifecycle and rendering * refactor(ui): keep profile order lock type local * fix(ui): preserve the void reaction callback
The page lifecycle refactor in openclaw#167780 replaced historyIntentConsumed with the nullable gesture timer. Observe that current owner in the real-Gateway loading proof while retaining the strict readiness, startup ordering, pagination, and avatar assertions.
## What Problem This Solves An aborted IndexedDB transaction could report that an account-scoped chat snapshot clear succeeded, even though its cached records remained. ## User Impact Explicit scope clearing now reports transaction errors. Ordinary single-session cache eviction remains best effort. No schema, rendered UI, config, or protocol changes. ## Why This Change Was Made Use the existing transaction completion owner instead of treating complete, error, and abort as equivalent success events. The narrow regression uses a real IndexedDB transaction abort and verifies the record was not deleted. ## Best-effort tradeoffs accepted - Single-session eviction remains intentionally best effort; explicit scope clearing rejects on failure. No new best-effort concession is introduced. The swallowed transaction outcomes originated in #162428 and survived #167780/#168206; the regression demonstrates the bug without claiming a human incident. Net production LOC: **2 removed**. This is a silent-failure bug fix, exempt from the cleanup batch floor. ## Evidence - Before repair: the scope-clear regression failed because its promise resolved instead of rejecting; the single-session control passed. - After repair: 23 tests passed across the new invalidation regression and the existing snapshot store suite. New regression bodies: 6 ms; loaded-host wrapper: 167.37 s (Vitest 112.44 s). - Formatting and `git diff --check` pass. - Independent P0-P2 review found no issue in this packet. The complete multi-packet review found one unrelated MCP diagnostic issue, corrected separately. - Targeted production and regression graph typecheck passes, including after the fixture lint repair. Runtime import cycles: zero. Production import edges are unchanged, so this cut cannot add a static import component. The full madge scan was stopped after30minutes without a result; no full static scan pass is claimed. - Changed-file check: conflict-marker and line-cap gates pass. Max-lines itself passed but its combined command failed on inherited environment-count ratchet drift (452 variables, budget453). The subsequent broad assertion scan was deliberately stopped after the aggregate command exceeded20minutes; no passing aggregate check is claimed. - Lint-suppression test:2/3 pass, existing inventory mismatch96vs94 in untouched `ui/src/test-helpers/control-ui-streaming-reply.ts` (no-unnecessary-type-conversion and unbound-method, two each). No baseline/suppression changes. Exact-head hosted CI remains the broad gate. - Targeted source-backed lint found one unbound-method reference in the regression. The fixture now binds the native method to its test database; no suppressions were added. The fixed graph typecheck and affected two-case regression pass (120.26s wrapper /71.77s Vitest; bodies435ms). No fixed-head lint pass is claimed; exact-head hosted lint is required before merge. The change does not modify rendering; behavior is proved at the IndexedDB boundary. Exact-head hosted CI run38824831588 completed with the ci-gate successful; no failed jobs, CI reruns, dispatches or green-only pushes. Hosted lint supplies the fixed-fixture lint gate. Earlier draft-only skipped CI is not counted as proof.
## What Problem This Solves An aborted IndexedDB transaction could report that an account-scoped chat snapshot clear succeeded, even though its cached records remained. ## User Impact Explicit scope clearing now reports transaction errors. Ordinary single-session cache eviction remains best effort. No schema, rendered UI, config, or protocol changes. ## Why This Change Was Made Use the existing transaction completion owner instead of treating complete, error, and abort as equivalent success events. The narrow regression uses a real IndexedDB transaction abort and verifies the record was not deleted. ## Best-effort tradeoffs accepted - Single-session eviction remains intentionally best effort; explicit scope clearing rejects on failure. No new best-effort concession is introduced. The swallowed transaction outcomes originated in openclaw#162428 and survived openclaw#167780/openclaw#168206; the regression demonstrates the bug without claiming a human incident. Net production LOC: **2 removed**. This is a silent-failure bug fix, exempt from the cleanup batch floor. ## Evidence - Before repair: the scope-clear regression failed because its promise resolved instead of rejecting; the single-session control passed. - After repair: 23 tests passed across the new invalidation regression and the existing snapshot store suite. New regression bodies: 6 ms; loaded-host wrapper: 167.37 s (Vitest 112.44 s). - Formatting and `git diff --check` pass. - Independent P0-P2 review found no issue in this packet. The complete multi-packet review found one unrelated MCP diagnostic issue, corrected separately. - Targeted production and regression graph typecheck passes, including after the fixture lint repair. Runtime import cycles: zero. Production import edges are unchanged, so this cut cannot add a static import component. The full madge scan was stopped after30minutes without a result; no full static scan pass is claimed. - Changed-file check: conflict-marker and line-cap gates pass. Max-lines itself passed but its combined command failed on inherited environment-count ratchet drift (452 variables, budget453). The subsequent broad assertion scan was deliberately stopped after the aggregate command exceeded20minutes; no passing aggregate check is claimed. - Lint-suppression test:2/3 pass, existing inventory mismatch96vs94 in untouched `ui/src/test-helpers/control-ui-streaming-reply.ts` (no-unnecessary-type-conversion and unbound-method, two each). No baseline/suppression changes. Exact-head hosted CI remains the broad gate. - Targeted source-backed lint found one unbound-method reference in the regression. The fixture now binds the native method to its test database; no suppressions were added. The fixed graph typecheck and affected two-case regression pass (120.26s wrapper /71.77s Vitest; bodies435ms). No fixed-head lint pass is claimed; exact-head hosted lint is required before merge. The change does not modify rendering; behavior is proved at the IndexedDB boundary. Exact-head hosted CI run38824831588 completed with the ci-gate successful; no failed jobs, CI reruns, dispatches or green-only pushes. Hosted lint supplies the fixed-fixture lint gate. Earlier draft-only skipped CI is not counted as proof.
What Problem This Solves
Control UI pages repeat rendering, lifecycle, and state bookkeeping across the same workflows.
User Impact
No user-visible change: controls, text, layout, configuration, protocol and stored data remain unchanged.
Why This Change Was Made
Consolidates shared Chat panel and disclosure behavior, attachment rendering, history/send/outbox paths, and page controls while keeping meaningful differences explicit. Derived renderer state replaces redundant flags; single-use forwarding helpers are removed. Gateway authority checks, cancellation, recovery and replay ordering remain with their existing owners.
This file-by-file pass removes 1,770 net production lines across 308 production paths, counting the five new shared helpers and excluding tests, fixtures, test support and generated files. Test edits migrate removed internal seams without changing assertions. Two assertion-baseline counts decrease to match removed duplicate casts. No dependency, protocol, schema or persisted-data changes.
Evidence
Final source:
de73bda58a2839f64dfdbdb11fa6288feee519e7, based on7294c691f2ce7a0a26191faff4a44cf32a3212bb.The comprehensive proof below ran on
9ef526af8589dece83202c6adb68cadbe45e3197. Full hosted lint subsequently caught an owned callback-contract mismatch: inlining a void reaction callback into its async operation left an unchanged consumer receiving a Promise. The final correction restores the reaction owner and its test exactly to the base. All 335 remaining PR paths are byte-identical to the broadly tested candidate.node scripts/check-changed.mjspassed, including all 27 core test-type graphs, production UI types, formatting, lint, styles and all three Knip scans with zero unused exports.ui/src/pagessuite: 828 files and 11,521 passing tests. Three existing optional WebKit cases skipped; the opt-in memory Chromium scenario ran.The final correction passed the formerly failing caller lint, full UI lint apart from one explicitly waived size finding in
ui/src/components/session-organizer-operations.runtime.ts, untouched and byte-identical to main, production UI types, both cycle checks, 13 reaction unit tests, three suppression tests, and the browser reaction E2E (1 file / 1 test, 19.912 seconds). Fresh isolated review found no actionable issues. Assertions and the void callback contract were preserved.The screenshots were captured on
9ef526af; the final callback correction changes no rendered content, text or styles. The screenshots use inspected synthetic data. New Session uses the existing publicpet.seed=42input to control independently verified per-load decorative-pet randomness while keeping the pet visible. No global RNG, storage, geometry or screenshot masks were overridden.Proof scope, timing and coverage
The comprehensive proof ran on standard AWS Crabbox with Node 24.19.0 and pnpm 12.7.0. The canonical receiver verified the committed source tree, base, complete 337-path diff and source hashes before execution; source checks remained clean after every phase. Native changed checks took 716.462 seconds, full pages 282.028 seconds, focused unit/browser coverage 24.488 seconds, and the 35 E2Es 249.910 seconds. No test timeout, worker, retry or skip setting was changed.
On an earlier candidate, the complete selected E2E lane passed all 531 files and 2,390 tests without skips, including both real-Gateway files. That is prior-source evidence; final-source results are reported separately above.
The implementation pass covered 967 page production files (975 inventoried paths minus eight test-support files, including the nested chat/test-helpers module) plus adjacent shared pickers. Per-file dispositions and measured rejected trials are retained in the lane's coverage log. More than two hours of implementation and source audit were completed, excluding verification freezes.
Test-cost measurement used one worker: the initial 21 mechanically changed test files passed 504 tests in 429.819 seconds; the subsequent Activity fixture migration and Dashboard sibling passed 42 tests in 142.701 seconds on the loaded local host. The existing optional Chromium memory case passed separately in the remote browser lane. No test cases or assertions were added or weakened.