Repository navigation
refactor(ui): load Template creator on first use - #187783
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis 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.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +160, Tests +921, Other +3. Total +1084 across 18 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 29, 2026, 1:56 PM ET / 17:56 UTC (Revision 5). |
|
@clawsweeper re-review Current head: ada9c59. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Exact head: |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* 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
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
76985e4c31c4c94c91e7ed79411c8189180b7ea8and passes with the new boundary.templates.drafts.createand zerochat.sendrequests. This uses production GatewayBrowserClient framing through the existing MockWebSocket transport, not a live Gateway.{"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}}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.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.78e7090b161e7dee04e4b42da778f8ef42a8f77fpass with zero entries; the later follow-up changes only the existing E2E test.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.