Skip to content

refactor(ui): consolidate page lifecycle and rendering - #167780

Merged
steipete merged 3 commits into
mainfrom
deslop/d10-p3-20261007
Oct 9, 2026
Merged

steipete merged 3 commits into
mainfrom
deslop/d10-p3-20261007

Conversation

@steipete

@steipete steipete commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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 on 7294c691f2ce7a0a26191faff4a44cf32a3212bb.

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.

  • Native node scripts/check-changed.mjs passed, including all 27 core test-type graphs, production UI types, formatting, lint, styles and all three Knip scans with zero unused exports.
  • Full ui/src/pages suite: 828 files and 11,521 passing tests. Three existing optional WebKit cases skipped; the opt-in memory Chromium scenario ran.
  • Additional shared components and browser coverage: 50 files and 439 passing tests, including 42 Chromium files.
  • Focused E2Es for changed pages and rebase resolutions: all 35 selected files and 193 tests passed, with no missing targets or skips.
  • Runtime and Madge cycles: zero. Lint-suppression test: all three passed. Exact-head local refresh also passed 12 Model Providers files and 220 tests.
  • Eight paired visual states have zero differing pixels in full frames and crops. Processes/Subagents metadata text, computed styles and bounds also match. Both standalone UI builds passed.
  • Independent isolated review completed all three passes. Its one P2 finding was rejected after source verification: ordered rendering requires the immutable Markdown value to be truthy, so removing a duplicate check cannot add a suffix to a media-only message. No actionable findings remain.

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 public pet.seed=42 input 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.

Before: eight Control UI states

After: eight Control UI states

@clawsweeper

clawsweeper Bot commented Oct 9, 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 marked this pull request as ready for review October 9, 2026 10:57
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR consolidates Control UI page rendering and lifecycle bookkeeping while preserving existing controls, appearance, and behavior.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful consolidation with inspected visual parity, reported browser coverage, and no actionable defect found in the reviewed paths.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected paired browser captures demonstrate preserved rendering across eight affected states, including both shared-panel consumers; the full body reports complementary browser/E2E coverage and a passing reaction scenario after the final callback restoration. Screenshots establish visual parity, while source comparison verifies unchanged stored formats and no migration requirement.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: Removing repeated lifecycle and renderer bookkeeping has maintenance value without expanding product surface. Prior merged consolidation by the same area contributor establishes the direction.

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
Reviewed head: de73bda58a2839f64dfdbdb11fa6288feee519e7

Before merge

None.

Findings

None.

Provenance

  • Realtime Talk lifecycle bookkeeping: original intent not found (unknown: File history identifies prior UI refactors, but unavailable older blobs limited content-dependent introduction research and did not establish the original lifecycle rationale.)
Agent review details

How this fits together

The 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
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Applicable repository policy: Read the complete root and UI AGENTS.md files and applied their ownership, async-result scoping, behavior-preservation, and test-value guidance. No maintainer-notes directory was present. (ui/AGENTS.md:5, de73bda58a28)
  • Shared panel lifecycle: The extracted lifecycle preserves context replacement, selection clearing, disposal, and session/agent/presentation synchronization. Processes and Subagents retain separate data owners and their different finished-section defaults. (ui/src/pages/chat/components/chat-session-panel.ts:35, de73bda58a28)
  • History and delivery invariants: The introduced history retry loop retains current-consumer checks, retry deadlines, abortable delays, and cleanup. Send admission calls the existing outbox owner directly, and the reused connection predicate preserves the captured client and connection epoch. (ui/src/pages/chat/chat-history-request.ts:197, de73bda58a28)
  • Stored-data compatibility: Snapshot deletion retains the same IndexedDB stores and exact-key versus prefix operations, including their different error contracts. Snapshot serialization, metadata budgeting, and draft revision comparisons remain equivalent; no stored format or migration is introduced. (ui/src/pages/chat/session-snapshot-database.ts:144, de73bda58a28)
  • Inspected visual proof: Inspected the downloaded before/after composites linked in the PR body: Chat transcript/composer, optional question, CI popover, New Session, Agents files, Appearance, Processes, and Subagents have matching visible layouts. These captures belong to 9ef526a and establish rendering parity, not authorization or network behavior. (9ef526af8589)
  • Final correction and proof continuity: GitHub's exact-head commit patch changes only the reaction owner and its test, restoring the void callback wrapper. Those paths are absent from the final introduced delta. The full PR body separately reports browser/E2E coverage on the broadly tested candidate and a passing reaction browser scenario after the correction. (ui/src/pages/chat/chat-pane-reactions.ts:126, de73bda58a28)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is internal maintenance with no intended user-visible change or urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-09T11:05:21.465Z sha 9ef526a :: blocked before merge. :: none

Reviewed October 9, 2026, 7:28 AM ET / 11:28 UTC (Revision 2).

@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Oct 9, 2026
@steipete
steipete merged commit 81901bf into main Oct 9, 2026
102 checks passed
@steipete
steipete deleted the deslop/d10-p3-20261007 branch October 9, 2026 11:35
steipete added a commit that referenced this pull request Oct 9, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
* refactor(ui): consolidate page lifecycle and rendering

* refactor(ui): keep profile order lock type local

* fix(ui): preserve the void reaction callback
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
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.
steipete added a commit that referenced this pull request Oct 15, 2026
## 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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
## 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.
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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