Skip to content

refactor(ui): deduplicate layout, clipboard, and polling scaffolds - #106003

Merged
steipete merged 6 commits into
mainfrom
codex/dedupe-ui-scaffolds
Jul 13, 2026
Merged

steipete merged 6 commits into
mainfrom
codex/dedupe-ui-scaffolds

Conversation

@steipete

@steipete steipete commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #105950

What Problem This Solves

The Control UI maintained duplicate dock-panel persistence, clipboard writes, polling lifecycle code, and workspace byte formatting. Those copies could drift; several copy actions already bypassed the canonical non-secure-context fallback.

Why This Change Was Made

This adds one parameterized dock-layout helper and one Lit reactive polling controller, routes all identified clipboard writes through the existing helper, and delegates workspace sizes to the shared normalization formatter. The nodes polling variant fit the controller cleanly; the non-Lit logbook state controller remains unchanged.

Out of scope: duration/relative-time helpers with distinct i18n namespaces remain a follow-up product decision. The dead-export baseline remains owned by its separate burn-down task.

User Impact

No visual or interaction layout changes. Copy actions now consistently retain the existing HTTP fallback; panel dimensions, polling cadence, and workspace size labels retain their prior behavior.

Production TypeScript is net 58 lines smaller. Commits are separated by dedup cluster.

Evidence

Blacksmith Testboxes tbx_01kxcrgr5m3f4ehtrkegjyv364, tbx_01kxcvfzkpddsbdg3w7kpc0gcq, tbx_01kxcw8nc7a8x4mqey2t7sgnq8, and current-base tbx_01kxcwt1y47whzr77vhjsbcscg:

  • pnpm test:ui: patch-identical head passed 3,742/3,742. Rebased exact head passed 3,741/3,742; the one untouched chat-tool-cards DOM-query failure passed 36/36 on immediate isolated rerun.
  • Focused UI and normalization tests: 329 passed.
  • pnpm tsgo:ui and pnpm tsgo:core:test: passed.
  • Full source lint plus touched-file lint: zero product findings; targeted rerun passed after one test-only cleanup.
  • Focused Chromium mock smoke: 7/7 passed, including non-secure clipboard fallback, terminal, logs, usage, and build-info flows.
  • Full Chromium mock suite: 154/158 passed. The same four failures reproduce unchanged at base b43e832fcc8000ed7287c7accc54e381db607f85 (48/52 on both trees).
  • oxfmt --check and git diff --check: passed.
  • Dead-export check: passed with the existing baseline unchanged.
  • Fresh final-head autoreview: no findings, patch correct at 0.90 confidence.
  • The eight smaller large files lower scripts/ts-max-loc-baseline-v2.json. This PR passed the LOC ratchet against base 6ef3e87583eda04fc3c790b68af86e021e68733c; current main at 8a2da4b1bf1555fe0bfaf705eb57300c673c81be is independently LOC-red on seven unrelated core/Codex files.

AI-assisted implementation and review.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR scripts Repository scripts labels Jul 13, 2026
@steipete
steipete force-pushed the codex/dedupe-ui-scaffolds branch from c83fd7a to c71f02b Compare July 13, 2026 04:34
@steipete
steipete force-pushed the codex/dedupe-ui-scaffolds branch from 7939015 to 7302656 Compare July 13, 2026 04:54
@steipete

Copy link
Copy Markdown
Contributor Author

Landing checkpoint for exact head 73026564b09525cf89efb7ee38581b3dcca73afe:

  • Requested UI dedup is complete; production TypeScript is net 58 lines smaller.
  • Blacksmith Testbox proof covers full UI tests, focused UI/normalization tests, UI/core test typing, lint, dead exports, LOC, and focused Chromium mock flows. Fresh autoreview reports no findings.
  • Hosted check-guards is blocked by current main (8a2da4b1bf1555fe0bfaf705eb57300c673c81be) being independently LOC-red on seven unrelated core/Codex files. The same violations reproduce from the exact base checkout; this PR does not touch those files.
  • Four scan-scope jobs failed on GitHub App installation rate limiting, not repository code.
  • Generated locale bundles and scripts/deadcode-exports.baseline.mjs remain untouched.

Unblocker: repair the LOC ratchet on main, then rerun the transient scan jobs and repo-native prepare/merge gates.

@steipete steipete self-assigned this Jul 13, 2026
@steipete
steipete merged commit 2ecd485 into main Jul 13, 2026
85 of 98 checks passed
@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 13, 2026, 1:03 AM ET / 05:03 UTC.

Summary
The PR centralizes repeated Control UI dock-layout persistence, clipboard access, polling lifecycle, and workspace byte formatting into shared helpers.

PR surface: Source -58, Tests +124, Other 0. Total +66 across 22 files.

Reproducibility: yes. at source level, though it was not live-reproduced: leave a chat pane idle beyond a minute and the timestamp subtree can remain cached because the new poll no longer changes the guard dependency.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: ui/src/components/dock-panel-layout.test.ts, serialized state: ui/src/components/dock-panel-layout.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #105950
Summary: This PR is the candidate implementation for the linked Control UI deduplication issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Restore an explicit minute-tick dependency for the guarded chat-message subtree and add regression coverage.
  • [P1] Provide redacted after-fix proof from a real Control UI session rather than mocked Chromium alone.
  • [P1] Rerun or obtain maintainer-confirmed attribution for the remaining required-check failures.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The evidence is tests and mocked Chromium only; add redacted real Control UI video, live output, or logs showing the changed flows, then update the PR body to trigger re-review or ask a maintainer for @clawsweeper re-review.

Risk before merge

  • [P1] Merging the chat portion as written can leave idle message-relative timestamps stale until another chat dependency changes.
  • [P1] The exact head still has failing required UI/guard and scan/security jobs; the PR attributes them to base LOC drift and GitHub App rate limiting, but they need a clean rerun or maintainer-confirmed attribution before merge.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the shared layout, clipboard, polling, and formatting helpers, but preserve a minute-tick dependency in the guarded chat render path, cover it with a focused regression test, and demonstrate the affected flows in a real Control UI session.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] A maintainer should review the chat invalidation repair and accept real browser proof; ClawSweeper should not auto-repair while contributor-owned behavior proof is missing and the protected maintainer label is present.

Security
Cleared: The diff adds no dependency, workflow, permission, secret-handling, download, publishing, or other concrete security or supply-chain concern.

Review findings

  • [P2] Preserve the chat thread’s relative-time invalidation — ui/src/pages/chat/chat-pane.ts:260
Review details

Best possible solution:

Keep the shared layout, clipboard, polling, and formatting helpers, but preserve a minute-tick dependency in the guarded chat render path, cover it with a focused regression test, and demonstrate the affected flows in a real Control UI session.

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

Yes at source level, though it was not live-reproduced: leave a chat pane idle beyond a minute and the timestamp subtree can remain cached because the new poll no longer changes the guard dependency.

Is this the best way to solve the issue?

No. The shared-helper direction is maintainable, but the chat polling migration is not behavior-preserving until it restores the memoized subtree's explicit invalidation signal.

Full review comments:

  • [P2] Preserve the chat thread’s relative-time invalidation — ui/src/pages/chat/chat-pane.ts:260
    requestUpdate() alone cannot refresh the relative labels because renderChatThread memoizes the message subtree with guard(). The removed relativeTimeVersion existed specifically to change that dependency on every minute tick, so idle timestamps now remain stale until another guarded input changes. Restore an explicit tick/version dependency and add a focused idle-timestamp regression test.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ef9383d88ab8.

Label changes

Label changes:

  • add P2: This is a bounded Control UI refactor with one normal-priority user-visible timestamp regression and incomplete merge proof.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.

Label justifications:

  • P2: This is a bounded Control UI refactor with one normal-priority user-visible timestamp regression and incomplete merge proof.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
Evidence reviewed

PR surface:

Source -58, Tests +124, Other 0. Total +66 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 19 254 312 -58
Tests 2 124 0 +124
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 8 8 0
Total 22 386 320 +66

What I checked:

  • Source-level regression: The new minute poll calls requestUpdate(), but it does not update a value consumed by the guarded chat-message subtree, so an otherwise idle thread can keep cached relative timestamps. (ui/src/pages/chat/chat-pane.ts:260, 73026564b095)
  • Prior invariant: The PR base explicitly documented that a version bump had to accompany requestUpdate() because guard() memoizes the message subtree; this PR removes that version and its timer. (ui/src/pages/chat/components/chat-thread.ts:168, 8a2da4b1bf15)
  • Polling abstraction: PollController correctly owns interval start, stop, and Lit disconnection cleanup, so the defect is the missing chat render dependency rather than the controller lifecycle itself. (ui/src/lit/poll-controller.ts:1, 73026564b095)
  • Coverage gap: The new controller tests verify interval lifecycle, but they do not exercise ChatPane together with the guarded chat thread or prove that displayed relative times advance while idle. (ui/src/lit/poll-controller.test.ts:1, 73026564b095)
  • Behavior proof: The PR body reports unit, type, lint, Testbox, and mocked Chromium runs, but no after-fix real Control UI recording, live transcript, or diagnostic output. (73026564b095)
  • Canonical work item: The linked issue defines the four intended deduplication clusters and remains open while this PR is the candidate implementation.

Likely related people:

  • steipete: Historical commits introduced and split major Control UI and chat-rendering surfaces, making this the strongest routing candidate for the shared lifecycle and memoization boundary. (role: feature owner and recent area contributor; confidence: high; commits: e3ff8c4d28, 1acbd6aea0, 6a684fdf6c; files: ui/src/ui, ui/src/pages/chat/chat-pane.ts, ui/src/pages/chat/components/chat-thread.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete deleted the codex/dedupe-ui-scaffolds branch July 13, 2026 05:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash after explicit maintainer instruction to waive advisory CI failures; no required branch-protection checks were configured.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 13, 2026
…penclaw#106003)

* refactor(ui): share dock panel layout

* refactor(ui): centralize clipboard writes

* refactor(ui): centralize polling lifecycle

* refactor(ui): reuse shared byte formatter

* chore(ci): refresh UI LOC ratchet

* fix(ui): keep dock layout type internal
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 maintainer Maintainer-authored PR scripts Repository scripts size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: deduplicate Control UI scaffolds

1 participant