Skip to content

refactor(ui): load Template creator on first use - #187783

Merged
vincentkoc merged 4 commits into
mainfrom
perf/control-ui-creator-boot-publication-20261030
Oct 29, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
perf/control-ui-creator-boot-publication-20261030

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Opening chat currently constructs the Template creator flow and loads its implementation and review copy before anyone starts creating a template. The sidebar action also imports that full flow eagerly.

User Impact

Chat boot loads less JavaScript. The first creator action loads the existing implementation on demand; direct Templates navigation and chat review still share the same flow. Creating, reviewing, retrying and publishing keep their existing behavior.

Why This Change Was Made

A lightweight context-owned publication slot connects the sidebar, direct Templates route and dormant review. It reserves the clicked agent and connection before loading, deduplicates repeated clicks, and keeps only the latest eligible target while the import is pending. Retired connections can collect before that import settles.

The full flow and creator-only English copy move to a cold chunk. English catalogs still merge synchronously in either registration order. Existing idle warmups, locale behavior and issued-write lifetimes are unchanged.

CI identified a static flow/owner import cycle in the first implementation. The publication slot now owns an explicit leaf contract with no implementation backreference; both the full flow and its observers use that one slot. The actual failed Madge guard first reproduced the cycle and now reports zero cycles.

Production: +230/-63 lines (net +167); tests: +925/-4. The added production code owns first-use admission, bounded pending custody and publication, including the shared leaf contract. It replaces eager construction without duplicating the creator workflow. Release-note context: defer Template creator implementation and copy until first use.

Evidence

  • The actual two-entry emitted-closure regression fails on frozen base 76985e4c31c4c94c91e7ed79411c8189180b7ea8 and passes with the new boundary.
  • Held-import, exact connection/capability, duplicate-click, direct-route takeover, loader retry and retired-client collection tests pass. Collection first failed with the unbounded waiter implementation.
  • The repaired boundary passes 23 focused owner/flow/review/closure tests, nine affected compiler graphs, UI types and targeted lint/format checks. Catalog composition and chunking checks also pass.
  • Four mock-socket browser cases pass together: allowed cold-sidebar/duplicate-click admission; held import followed by actual Connection settings replacement; held import followed by a read-only hello on the same client and revision; and the existing close-during-publish/failure/retry flow. The two retired-authority cases await the actual runtime module plus a browser task, then observe zero templates.drafts.create and zero chat.send requests. This uses production GatewayBrowserClient framing through the existing MockWebSocket transport, not a live Gateway.
  • The task-opt-in real Gateway proof also passes in that same five-case invocation. The served UI entry matches the qualified build, browser traffic uses native WebSocket connections to two isolated real Gateways, and inference is local and synthetic. The allowed path creates a real draft artifact, receives successful create/send responses and reaches inference once. Held-import actions after actual Connection Apply replacement or actual device-token revocation and disconnect send neither write and leave both Gateways' draft artifacts unchanged. The chunk is evaluated and a browser task completes before checking absence. Child registry credentials/config are isolated; this does not publish to ClawHub.
  • Safe final-effect verdict (all cases use the authenticated built UI and evaluate the held runtime):
{"transport":"native browser WebSocket to actual Gateway","allowed":{"acceptedWrites":["templates.drafts.create","chat.send"],"draftFiles":[1,0],"inferenceRequests":1},"replacement":{"writes":[],"draftFiles":[1,0],"inferenceRequests":1},"revoked":{"writes":[],"draftFiles":[1,0],"inferenceRequests":1}}
  • Canonical cold/authenticated-warm capture, full private-QA preparation and the final changed-source UI build pass. Matched assets use frozen base 76985e4c31c4c94c91e7ed79411c8189180b7ea8, identical capture policy and harnesses, Node 26.12.1 and fixed build metadata. The previously built baseline was reused only after its source/input signature, canonical manifest, full image, runtime, dependencies and build context matched exactly.
  • Published candidate head: f49c3c7d6495bbe862cf677a69c40e6735562c04. Measured production/UI tree: 78e7090b161e7dee04e4b42da778f8ef42a8f77f; final test-source tree: 97cee8b88fd7d216a8d59ef85cd721ec47ba563a. The test-only follow-up preserves all production bytes and the exact consumed-input signature and generated UI image, so the existing build and asset comparison remain applicable.
  • The strict asset gate passes with no violations or warnings and unchanged limits: chat boot 1,274,731 → 1,272,579 gzip bytes (-2,152); New 779,378 → 779,354 (-24); startup 90,469 → 90,578 (+109). Request counts remain 20/15/3; CSS is unchanged.
  • Production and full-tree unused-file scans on measured tree 78e7090b161e7dee04e4b42da778f8ef42a8f77f pass with zero entries; the later follow-up changes only the existing E2E test.
  • Fresh independent reviews found no actionable issue. Exact-head CI run 40923989103 completed successfully; the effective-lane watcher is GREEN (34 superseded check results remain in GitHub's raw rollup). ClawSweeper revision 4 covers this exact head and reports no findings, before-merge tasks or security blockers; no Rank-up moves remain.

This measures delivered size, not interaction latency. It does not establish that the separate resident-history PR fits its budget; that requires a fresh integrated measurement.

@vincentkoc vincentkoc self-assigned this Oct 29, 2026
@clawsweeper

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

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR defers Template creator implementation and English copy until first use while preserving the shared creation and review flow.

Example: Open Chat without selecting Create Template.

  • Before: Chat constructs the creator flow and loads its implementation; reported boot JavaScript is 1,274,731 gzip bytes.
  • After: The creator remains dormant until requested; reported boot JavaScript is 1,272,579 gzip bytes.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong final-effect evidence supports a coherent refactor with no actionable findings; ordinary exact-head CI remains pending.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The public native-WebSocket verdict exercises the authenticated built UI against two isolated real Gateways with local synthetic inference: allowed creation records accepted draft/send responses, one draft artifact, and one inference request; held actions after Connection Apply replacement or token revocation emit neither write after module evaluation and leave artifacts unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Opening Chat downloads and constructs optional Template authoring code before the user requests it.
Reason: The maintainer-authored direction has a measured delivered-size benefit and preserves the established creator workflow.

Merge readiness

✅ Ready for maintainer review

No actionable findings at the reviewed head; this useful maintainer-authored refactor should remain open while exact-head CI completes.

Priority: P3
Reviewed head: f49c3c7d6495bbe862cf677a69c40e6735562c04

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI connects sidebar creation actions and direct Templates navigation to one context-owned creator flow, which sends draft and chat requests to the Gateway and presents package review.

flowchart LR
  A[Sidebar action] --> B[Deferred admission]
  B --> C[Creator runtime]
  D[Templates route] --> C
  C --> E[Shared publication slot]
  E --> F[Chat review]
  C --> G[Gateway draft and chat APIs]
Loading

Technical review

Best possible solution:

Keep one creator flow behind the deferred loader and shared publication contract, preserving current-authority checks and existing review behavior.

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

Current-main source eagerly imports and constructs the creator through dormant Chat review and imports it from the sidebar; this review verified that path without executing target code.

Is this the best way to solve the issue?

The change removes eager implementation edges while reusing the existing flow, lazy-import helper, capability checks, projection adapter, and catalog merger.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8b8c33ef334b.

Provenance checked

  • Creator workflow and dormant review keeps the original intent (c9a7947: Provide authoring in the existing main chat with exact package review and explicit publication.)
  • Review readiness and issued-write lifetime keeps the original intent (dfb972c: Let Solid present the plain owner's admitted review promise without moving request or publication authority into rendering.)
  • Creator and virtualizer chunk grouping changes intended behavior with a stated reason (603b8fa: Share creation helpers independently of Chat when Chat and the roster co-loaded the creator.)
  • Optional English catalog registration keeps the original intent (1532cce: Load optional copy with its consumer while preserving synchronous registration, namespace identity, and locale fallback.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Patrick Erichsen: Raw commit c9a7947 adds ui/src/pages/claws/creator-flow.ts:42 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c9a7947148bb; files: ui/src/pages/claws/creator-flow.ts)

PR surface

Source +160, Tests +921, Other +3. Total +1084 across 18 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 11 228 68 +160
Tests 6 925 4 +921
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 0 +3
Total 18 1156 72 +1084

Review metrics

Metric Value Why it matters
Production versus tests Production +230/-63; tests +925/-4. Production growth provides bounded first-use admission and a cycle-free publication contract; tests cover emitted loading boundaries, locale composition, lifecycle, and final-effect authority.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a measured boot-size improvement that preserves the existing optional creator workflow.
  • 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.

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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-29T16:31:43.829Z sha 1606901 :: needs changes before merge. :: [P2] Complete the production refactor before merging the enabled regression
  • reviewed 2026-10-29T17:07:05.367Z sha ada9c59 :: needs real behavior proof before merge. :: [P2] Break the static dependency cycle between the owner and flow
  • reviewed 2026-10-29T17:24:39.674Z sha d7811cc :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-29T17:49:17.875Z sha f49c3c7 :: needs maintainer review before merge. :: none

Reviewed October 29, 2026, 1:56 PM ET / 17:56 UTC (Revision 5).

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L and removed size: S labels Oct 29, 2026
@vincentkoc vincentkoc added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 29, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review October 29, 2026 17:00
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Current head: ada9c59.

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 29, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head: f49c3c7d6495bbe862cf677a69c40e6735562c04. The PR body now includes the native-WebSocket real Gateway final-effect verdict: an allowed real draft and accepted send reach local inference; held actions after Connection Apply replacement or device-token revocation/disconnect emit neither write and leave draft artifacts unchanged. All five browser cases pass; same-client read-only capability coverage remains. This follow-up changes only the existing E2E test.

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 29, 2026
@vincentkoc
vincentkoc merged commit aa65a0e into main Oct 29, 2026
150 of 151 checks passed
@vincentkoc
vincentkoc deleted the perf/control-ui-creator-boot-publication-20261030 branch October 29, 2026 18:06
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
* test(ui): guard creator boot boundary

* refactor(ui): defer Template creator implementation until first use

* fix(ui): separate Template creator publication from implementation

* test(ui): prove deferred creator authority through Gateway
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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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