Skip to content

refactor(ui): replace lazy element controller with request factory - #174032

Merged
steipete merged 4 commits into
mainfrom
solid2/w-idiom-app-lazy-requests
Oct 16, 2026
Merged

steipete merged 4 commits into
mainfrom
solid2/w-idiom-app-lazy-requests

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Lazy custom-element requests still relied on a controller host callback and ad hoc revision signals in their Solid consumers. Replace the controller with a synchronous request factory and explicit subscriptions. Solid views use the existing owner projection; retained domain owners publish through their existing notification path.

The request owner still controls request identity, cancellation, stale-chunk recovery, preload publication, and the render-before-action-replay barrier. Global registration remains deduplicated by tag. The shell retains its production retry callback to persist pending actions across reload. Cancellation now uses the canonical recovery owner directly, removing a test-only injection.

All callers move together, including the recently landed new-session and chat-question consumers. The board regression waits for its real module import and verifies that loading yields to report content. No routes, tags, selectors, markup, styling, or lazy boundaries change; screenshots are not applicable to this ownership refactor.

Evidence

Proof Result
Request owner 13 tests passed after cancellation cleanup
Board consumer 7 tests passed, including deferred registration → rendered report
Integrated palette consumer 17 tests passed with one worker
UI types Passed
App and component test types, scoped lint/format Passed
Independent review Final 21-file cutover: no actionable P0–P2 findings
Paired builds and strict startup checks Passed on base c316ecaacdefc and this head: JS gzip 347,796 → 347,730 B (−66 B), raw 1,055,829 → 1,055,110 B; 8 JS / 1 CSS requests; CSS 38,786 B gzip unchanged
Full production Knip Same one inherited unused type on base and head: ui/src/pages/chat/chat-tool-icon-controller.ts:PluginToolIcon. No new findings or ignores.
Broad UI and browser proof Passed: ci:full run 38874967816, exact head 0d605ef155c3cc; no local E2E or parity
Touched production metrics Before After
LOC 5,040 5,013
Controller-pattern references 36 23
createEffect calls 13 13
untrack calls 19 19
addEventListener calls 4 4

Production shrinks by 27 lines; tests grow from 3,589 to 3,658 lines. Controller references count controller class declarations, ReactiveController/ReactiveControllerHost, lifecycle hooks, and requestUpdate. The remaining references belong to coupled owners outside this factory cutover. Added tests protect distinct subscription disposal, preload, replay-order, and deferred-registration boundaries. The simplification pass removed the obsolete class, manual notification counters, liveness flags, and cancellation seam.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T08:41:27.303572Z 0d605ef PR opened
ℹ️ 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.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces the lazy custom-element controller with a synchronous request factory and migrates its consumers to explicit subscriptions.

Example: Open the command palette before openclaw-command-palette is registered.

  • Before: The controller loads the module, waits for rendering, and replays the opening action.
  • After: The request factory preserves that sequence while publishing changes through subscriptions.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A coherent, smaller cutover with no actionable finding; supplied behavioral evidence is strongest at the in-process harness boundary.
Proof confidence 🦐 gold shrimp (3/6) The maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence exercises the request owner and real board module through in-process tests, without a claimed shipped-browser demonstration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No direct user-visible defect is claimed; the change removes legacy controller-host coupling from lazy UI consumers.
Reason: The maintainer-authored direction matches the repository's Solid migration policy, removes the obsolete class across its callers, and reduces production code.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it completes an owner-directed Solid cleanup, preserves the existing lazy-loading contracts, and introduces no actionable correctness finding.

Priority: P3
Reviewed head: 0d605ef155c3cca3af41cccb2115d6a9770b6841

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied validation does not include a completed browser scenario exercising lazy opening, failure/retry, and dismissal on this head.
Agent review details

How this fits together

The Control UI request owner receives optional-element descriptors and actions, coordinates shared module registration and recovery, and publishes loading state to shell and page consumers.

flowchart LR
  A[Shell and page actions] --> B[Request factory]
  B --> C[Shared module registration]
  C --> D[Custom element registry]
  B --> E[Owner subscriptions]
  E --> F[Solid views]
  F --> G[Render completion]
  G --> B
  B --> H[Action replay or recovery]
Loading

Technical review

Best possible solution:

Complete this focused factory cutover while preserving synchronous request ownership and the existing recovery and replay boundaries.

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

This is a behavior-preserving refactor, so no failing product reproduction is claimed or required.

Is this the best way to solve the issue?

The factory keeps the existing synchronous owner and adopts the established projection adapter without creating a competing loader or changing lazy boundaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3aa642027ea1.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Introduced change and complete cutover: The pinned introduced diff replaces the class, migrates its production callers, preserves request identity and render gating, and retains the shell's production retry callback; the retired class name has no remaining UI references. (ui/src/app/lazy-custom-element.ts:67, 0d605ef155c3)
  • Current-main behavior: Fetched main still uses LazyCustomElementRequestController, so this factory cutover remains distinct work. (ui/src/app/lazy-custom-element.ts:68, 3aa642027ea1)
  • Subscription and render lifecycle: Shell subscriptions join existing disconnect cleanup, projectOwner uses the existing owner-scoped disposal contract, and ShellPresentation still supplies the render-completion promise before replay. (ui/src/app/app-host.tsx:276, 0d605ef155c3)
  • Preserved recovery intent: The recovery and dismissal contracts documented in fix(ui): surface onboarding memory import load failures #126738 and fix(control-ui): recover boot and views after network failures #171825 remain in the factory: foreground replacement, activation dismissal, late-result suppression, and canonical stale-recovery cancellation. (ui/src/app/lazy-custom-element.ts:114, 0d605ef155c3)
  • Validation and CI attribution: The body reports focused owner, board, and palette tests plus type, lint, and paired-build checks. The failed context check requests authored body headings; its annotations identify no production-code failure. One real-Gateway browser shard remained in progress at the final read. (0d605ef155c3)
  • Repository policy and inspection limits: Root and UI AGENTS.md guidance was applied; ui/AGENTS.md is the only scoped UI policy file. The maintainer-notes directory and installed Solid cheatsheet are absent from this checkout; the existing projection implementation and repository Solid guidance were inspected. (ui/AGENTS.md:5, 0d605ef155c3)

Likely related people:

  • Peter Steinberger: Raw commit 5eda48e adds ui/src/app/lazy-custom-element.ts:136 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5eda48ed9996; files: ui/src/app/lazy-custom-element.ts)
  • Dallin Romney: Raw commit 56e32bb adds ui/src/app/lazy-custom-element.ts:102 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 56e32bb72309; files: ui/src/app/lazy-custom-element.ts)

PR surface

Source -27, Tests +69. Total +42 across 21 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 14 154 181 -27
Tests 7 105 36 +69
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 21 259 217 +42

Review metrics

Metric Value Why it matters
Production versus test LOC Production +154/-181; tests +105/-36 Production shrinks by 27 lines; the 69-line test increase covers subscription publication, replay ordering, and deferred registration.

Labels

Label changes:

  • add P3: This is an internal ownership cleanup with no intended user-visible behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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:

  • P3: This is an internal ownership cleanup with no intended user-visible behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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 October 16, 2026, 4:53 AM ET / 08:53 UTC.

@steipete
steipete merged commit 6169368 into main Oct 16, 2026
112 of 115 checks passed
@steipete
steipete deleted the solid2/w-idiom-app-lazy-requests branch October 16, 2026 09:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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