Skip to content

refactor(ui): finish browser panel ownership and component refs - #175293

Merged
steipete merged 7 commits into
mainfrom
solid2/w-idiom-components-browser-final
Oct 17, 2026
Merged

steipete merged 7 commits into
mainfrom
solid2/w-idiom-components-browser-final

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

The Browser panel routes rendering through a generic panel controller and bridge adapter. Replace that inheritance with one retained presentation factory, the native Solid bridge, and owner-scoped setup and cleanup. Keep synchronous navigation and native-browser admission in the existing TypeScript owner. The host completion promise still waits for the native bridge commit before presentation completion, and reattaching a host resumes capture even when its inputs are unchanged.

Retire the generic panel adapters and their controller-only tests after migrating their last consumer. Browser tests exercise public host methods, native events, rendered DOM and Gateway fixtures. FilePreview, Lightbox, HomeSession and OptionCard now use owned DOM refs or owner-scoped listeners; DockResizer and Sparkline use Solid class arrays. Tags, classes, routes and lazy imports remain unchanged.

Proof

Check Result
Browser route, hosted-tabs and paste 38 distinct cases passed; one fixture assertion was corrected and that case passed; passing cases were not rerun
OptionCard 5 cases passed
FilePreview 11 cases passed
HomeSession 1 case passed
Lightbox 21 cases passed, including image → video → image replacement
Final UI types pnpm tsgo:ui passed on the final integrated source
Final scoped lint/format Passed on the original changed files and all four repaired files
Final production Knip pnpm deadcode:knip passed after removing the unused adapters
Final independent review Complete integrated original diff plus complete-context four-file repair review: scoped-clean P0–P2 (0.94 confidence)
Base/head startup gzip and CSS requests Exact base 7dcd9a34be0d3e67df7c81ff306e6d2579db322b vs head e9c355f38fe: canonical builds and strict paired check passed; startup JS 337,547 → 337,542 B gzip (−5 B), 7 → 7 requests; CSS 38,697 → 38,697 B gzip, 1 → 1 request; chat boot −82 B, New boot −59 B
Before/after screenshots 12 synthetic frames captured across both builds: Browser dock, FilePreview, Lightbox, OptionCard, HomeSession selection, Sparkline hover. All 12 full frames inspected: synthetic data only. The six touched-surface crop pairs are embedded below; no visible change. Scratch Home fixture errors were corrected; other passing scenes were not rerun
Full UI CI ci:full run 39015028639 complete: all 3 UI unit shards pass; six unrelated or main-matching root jobs retained via native admin evidence

CI repair

The first full run (39013602031) exposed three Browser cases, two Board cases, one Chat case and coupled type errors caused by this cutover. The repair preserves the disconnected completion result, exercises refresh through the public browser-toggle entry point instead of navigation, and migrates Board/Chat assertions from the removed Lit renderRoot to the native light-DOM host. All six affected behavior cases and both failed UI core-type leaves passed once locally, as did UI types and scoped lint/format. The identity, focus, error and authorization assertions remain intact. The separate Reader metadata suite import failure was inherited and has been repaired on main by #175297 (6249e5b5051b). The original auto request was confirmed cancelled before the fix push; landing will use native replacement recovery for the reviewed repair head.

Size and ownership

Final true-scope metrics, including both adapter deletions and the two coupled Board/Chat tests: 25 changed paths and production LOC 2,363 → 2,237 (−126). Controller-pattern matching lines are 0 → 0; the removed Browser subclass inherited the lifecycle under a name outside that regex. Render effects fall 2 → 0, direct listeners 6 → 3, and semantic DOM queries 13 → 2. createEffect changes 5 → 6 for native presentation/geometry after committed DOM; untrack remains 4 → 4. No effect copies derived state. Test/helper LOC is 4,015 → 3,934 (−81).

These metrics use the actual integrated main merge base above after Terminal landed and all four generic panel adapter/test files were deleted. No dependency or startup-boundary changes were made. Paired builds used the same existing toolchain and normalized build identity. The baseline initially lacked per-plugin dependency links; linking the existing package dependencies resolved that tooling prerequisite without an install. No cloud lease was created.

Inspected before/after captures

All captures use the same synthetic fixture and viewport. Crops focus on the touched component; complete frames were inspected for incidental data before upload.

Surface Before After
browser-dock Before browser-dock After browser-dock
file-preview Before file-preview After file-preview
lightbox Before lightbox After lightbox
recommended-option Before recommended-option After recommended-option
home-selection Before home-selection After home-selection
sparkline-hover Before sparkline-hover After sparkline-hover

Full CI attribution

Repaired-head run 39015028639 is complete. Latest scheduled main run 39013936147 fails the same five UI cases with the same assertion: both child-expansion variants at line 70, pinned-rail cold load at line 352, mobile Sessions inset at line 400, and Agents catalog model/fallback persistence at line 278. The older scheduled run passed the Agents case; only the latest matching evidence is used.

Failed job Attribution
checks-fast-baseline-ratchets Process mock-export check at src/process/exec-scope-settlement.test.ts:35; failed test, reaper, checker and baseline byte-identical to the tested main parent
check-test-types-core-5 Unrelated install-record test annotations at lines 254/262; test and production owner byte-identical to tested main
checks-ui-e2e (1/9) Both Sidebar child-expansion cases match latest scheduled main
checks-ui-e2e (3/9) Sessions mobile inset assertion matches latest scheduled main
checks-ui-e2e (7/9) Cold-load case matches latest main. Plugin skill-bundle line-clamp case passes main, but its installed-row assertion fails before FilePreview opens; test, plugin row CSS and preview sources are unchanged
checks-ui-e2e-real-gateway (2/2) Agents catalog config read matches latest scheduled main; all 27 inspected Agents/model/config/CLI/Gateway/fixture inputs are unchanged

The CI checkout is bff49af7ac720f82f25e9db7574a0627bae80b1e, with ordered parents 9ff9472609c79f3f753c7471548c1226bd99341c and repaired head e9c355f38fe8552677deb4602f255be264e3cc1d. Local merge-tree reproduces the exact tree and 25-path authored scope. Native replacement/admin recovery retains all six failed jobs and the downstream CI gate; this is not a claim that full CI passed.

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

clawsweeper Bot commented Oct 17, 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 17, 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-17T07:51:44.552641Z e9c355f New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30957b8284

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

export type BrowserPanelElement = HTMLElement &
BrowserPanelInputs &
BrowserPanelMethods &
Pick<BrowserPanelPresentation, "hostedTabs" | "activeHostedTabId" | "updateComplete">;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Migrate remaining renderRoot consumers

Removing renderRoot from the browser-panel host leaves unchanged callers reading undefined: ui/src/pages/chat/chat-pane-session-panel-toggle.test.tsx:428-433 now compares undefined with "Local preview", while ui/src/lib/board/widgets/browser.test.ts:113-118 and :254-255 expect queries through that accessor to return elements or null. These suites will fail whenever they run, so either preserve the light-DOM accessor or migrate all remaining callers to query the panel directly as part of this cutover.

AGENTS.md reference: AGENTS.md:L52-L53

Useful? React with 👍 / 👎.

@steipete
steipete enabled auto-merge (squash) October 17, 2026 07:33
@steipete
steipete disabled auto-merge October 17, 2026 07:42
@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR replaces the remaining Browser presentation class and generic panel adapters with a retained factory and native Solid bridge, and converts nearby components to owned refs and listeners.

Example: An embedded Browser panel displaying https://example.test/remote is detached and reattached with unchanged inputs.

  • Before: The retained owner can remain suspended after reattachment.
  • After: Attachment publishes presentation work so the retained owner refreshes and resumes the page.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful ownership simplification with inspected visual parity, but exact-head CI confirms incomplete test migration and failing replacement scenarios.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; inspected synthetic before/after captures support appearance preservation, while lifecycle coverage comes from mounted tests and remains limited by the listed failures.
Patch quality 🦪 silver shellfish (2/6) 3 actionable review findings remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Browser and nearby UI components retain migration-era lifecycle and DOM lookup machinery that complicates preserving rendering, focus, and cleanup.
Reason: The established feature owner authored this continuation of the Solid migration, and it removes obsolete shared infrastructure without adding configuration or public capabilities.

Merge readiness

⛔ Needs changes before merge - 3 items remain

Keep this maintainer-authored refactor open; its direction is sound, but incomplete caller migration and broken replacement tests need repair before merge.

Priority: P3
Reviewed head: 30957b8284fa88ed4bbdea72aca4332b8c86ead4

Before merge

  • Migrate the remaining browser host accessor consumers (P2) - Removing renderRoot here leaves ui/src/lib/board/widgets/browser.test.ts and ui/src/pages/chat/chat-pane-session-panel-toggle.test.tsx reading undefined. Their optional queries consequently return undefined instead of null or the Local preview image, and exact-head CI confirms those failures. Finish the cutover by querying the light-DOM panel directly in both files, as the migrated Browser suites already do.
  • Preserve background-refresh semantics in the rewritten tests (P2) - The replacement Reload click invokes reloadPage → openUrl → /navigate, whereas the previous test exercised capture-only refresh. The first fixture does not handle /navigate, so its screenshot never updates; the second test expects input focus to survive navigation even though that path exits capture modes. Exact-head CI fails at lines 145 and 179. Exercise background refresh through the public presentation/toggle path and retain the original screenshot and focus assertions.
  • Dispose the owning bridge root in the cancellation test (P2) - This fixture mounts a pre-created custom element, so mounted.unmount() removes its wrapper rather than synchronously disposing the Browser bridge root. The native bridge deliberately defers disposal to a microtask, allowing the pending render to complete first; exact-head CI therefore resolves true at line 333. Mount the Solid BrowserPanelHost component so unmount disposes the actual owning root and the test measures cancellation of uncommitted work.

Findings

  • [P2] Migrate the remaining browser host accessor consumers — ui/src/components/browser/browser-panel-registration.tsx:23-24
  • [P2] Preserve background-refresh semantics in the rewritten tests — ui/src/components/browser/browser-panel.test.ts:143
  • [P2] Dispose the owning bridge root in the cancellation test — ui/src/components/browser/browser-panel.test.ts:328-333

Tests

  • Missing end-to-end proof: Static captures do not exercise browser detach/reattach or pending-render cancellation, and base-fail/head-pass evidence for the added regressions is not supplied.
Agent review details

How this fits together

The Control UI Browser presentation connects host properties and DOM lifecycle to synchronous browser navigation, capture, native-browser, and dock owners, producing rendered controls and hosted-tab notifications.

flowchart LR
  A[Chat and dashboard callers] --> B[Native Solid bridge]
  B --> C[Browser presentation factory]
  C --> D[Synchronous browser owner]
  C --> E[Dock layout owner]
  D --> F[Gateway and native browser]
  C --> G[Solid browser view]
Loading

Technical review

Best possible solution:

Complete the caller migration and repair the replacement tests while preserving the existing navigation, background-refresh, and bridge disposal contracts.

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

Source inspection and exact-head CI annotations establish the stale-accessor and replacement-test failures; no local execution or current-main product reproduction was performed.

Is this the best way to solve the issue?

The retained factory and existing native bridge fit the established ownership direction, but the replacement tests must preserve the behavior their predecessors protected.

Full review comments:

  • [P2] Migrate the remaining browser host accessor consumers — ui/src/components/browser/browser-panel-registration.tsx:23-24
    Removing renderRoot here leaves ui/src/lib/board/widgets/browser.test.ts and ui/src/pages/chat/chat-pane-session-panel-toggle.test.tsx reading undefined. Their optional queries consequently return undefined instead of null or the Local preview image, and exact-head CI confirms those failures. Finish the cutover by querying the light-DOM panel directly in both files, as the migrated Browser suites already do.
    Confidence: 1
  • [P2] Preserve background-refresh semantics in the rewritten tests — ui/src/components/browser/browser-panel.test.ts:143
    The replacement Reload click invokes reloadPage → openUrl → /navigate, whereas the previous test exercised capture-only refresh. The first fixture does not handle /navigate, so its screenshot never updates; the second test expects input focus to survive navigation even though that path exits capture modes. Exact-head CI fails at lines 145 and 179. Exercise background refresh through the public presentation/toggle path and retain the original screenshot and focus assertions.
    Confidence: 0.99
  • [P2] Dispose the owning bridge root in the cancellation test — ui/src/components/browser/browser-panel.test.ts:328-333
    This fixture mounts a pre-created custom element, so mounted.unmount() removes its wrapper rather than synchronously disposing the Browser bridge root. The native bridge deliberately defers disposal to a microtask, allowing the pending render to complete first; exact-head CI therefore resolves true at line 333. Mount the Solid BrowserPanelHost component so unmount disposes the actual owning root and the test measures cancellation of uncommitted work.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 22799f805a84.

Provenance checked

  • Browser presentation and shared panel lifecycle changes intended behavior with a stated reason (89564fa: The initial Solid migration retained synchronous controllers and shared committed-DOM lifecycle adapters to preserve existing hosts and connection behavior.)
  • Browser navigation and capture ownership keeps the original intent (5673afc: Browser factories retained synchronous navigation admission, current-request checks, capture cancellation, and the DOM completion fence.)
  • Bridge completion lookup keeps the original intent (23da5a7: The bridge reads its inherited completion getter with the real host receiver and preserves completion ordering.)
  • OptionCard focus keeps the original intent (d7c245e: Direct Solid rendering preserved selection, disabled behavior, focus, callbacks, and existing markup.)
  • Lightbox media ownership keeps the original intent (02d223b: The media implementation moved behind lazy loading; this PR preserves that boundary while replacing DOM queries with mounted-node refs.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm --dir ui test src/components/browser/browser-panel.test.ts src/components/browser/browser-panel-route.test.ts src/components/browser/browser-panel-hosted-tabs.test.ts src/components/browser/browser-panel-paste.test.ts src/lib/board/widgets/browser.test.ts src/pages/chat/chat-pane-session-panel-toggle.test.tsx
  • pnpm tsgo:ui
  • git diff --check

What I checked:

PR surface

Source -126, Tests -82. Total -208 across 23 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 12 470 596 -126
Tests 11 414 496 -82
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 23 884 1092 -208

Review metrics

Metric Value Why it matters
Production versus test LOC Production −126 net; tests and test helpers −82 net. Removing the final generic adapters reduces production code despite the retained presentation factory; replacement fixtures also reduce test code overall.

Labels

Label changes:

  • add P3: This is an internal UI ownership refactor with no intended feature or appearance change; the confirmed blockers concern its test migration.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is an internal UI ownership refactor with no intended feature or appearance change; the confirmed blockers concern its test migration.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • 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 execution lanes are retired.

Reviewed October 17, 2026, 3:45 AM ET / 07:45 UTC.

@steipete
steipete merged commit 3a70852 into main Oct 17, 2026
97 of 109 checks passed
@steipete
steipete deleted the solid2/w-idiom-components-browser-final branch October 17, 2026 08:14
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…claw#175293)

* refactor(ui): replace browser presentation class with factory

* refactor(ui): simplify browser bridge completion lookup

* refactor(ui): retire shared panel adapters and own component refs

* fix(ui): preserve browser host completion and public test contracts
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. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant