Skip to content

fix(ui): keep startup and diagram assets within budget - #157161

Merged
vincentkoc merged 5 commits into
mainfrom
fix/mermaid-renderer-asset-budget-20260924
Sep 24, 2026
Merged

vincentkoc merged 5 commits into
mainfrom
fix/mermaid-renderer-asset-budget-20260924

Conversation

@steipete

@steipete steipete commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Control UI exceeds its asset budgets after the Mermaid 12 upgrade and recent startup growth.

User Impact

Restores the diagram renderer used by the current stable release and loads Settings section labels only when Settings needs them. Settings labels stay unchanged. Mermaid 12's new diagram families and built-in ELK layout are deferred with the rollback to 11.17.2; diagram connector geometry can differ between these versions.

Why This Change Was Made

The isolated renderer serves Mermaid's complete classic bundle, which grew beyond its budget in version 12. Restoring the released pin brings it back under the existing cap. Moving section labels into the existing lazy Settings catalog also removes unnecessary startup bytes without changing translation keys or generated translations.

Original Evidence (19d4df17, historical)

  • Normal UI and native renderer builds pass. Strict gzip sizes: startup JavaScript 370,912 / 371,332 bytes, CSS 51,144 / 51,200, isolated Mermaid 974,554 / 983,040. No budgets were raised.
  • 88 renderer, presentation, asset, and browser recovery checks pass; 71 Settings/i18n checks pass. UI types, focused lint, and canonical i18n baseline/verification pass with no generated changes.
  • The three new lazy-loading regression cases cover the config form, Setup, and cold Settings search. Standalone test command: 8.73 seconds wall time, 1.12 seconds test bodies. CI cost is pending.
  • Fresh independent review found no actionable P0–P2 code findings. Canonical changed checks passed their package guards and type checks, then failed an existing core lint limit: unchanged src/infra/agent-run-registry.ts had 704 counted lines against its 700-line cap. That separate repair landed in refactor: share active run state precedence #157168. The final import-cycle check was not reached in that local attempt.
  • Exact-head CI passed at 19d4df173f0bc4844c850f1cc25b6490278ff76b. This receipt predates the native notice correction and main integration.

Native Notice Correction

The Mermaid 11 source-map audit confirms that ELK and Chevrotain implementation code are absent from the restored classic bundle. The correction removes their two complete shared notice sections, four Android/iOS license files and two Android inventory expectations. All remaining license texts, including both DOMPurify versions, stay unchanged. No runtime production code changes.

Historical corrected-source validation passed at 492492ceebaaebd0e0554dda626b5a926b22ddc6:

  • Native renderer build; exact Mermaid 11.17.2 classic checksum and generated NOTICE equality.
  • Packaged Android inventory: 83/83.
  • Settings cold-loading tests: 3/3.
  • Android packaged-license tests: 4/4, with no skips.

Focused iOS tests were not run on the Linux runner. The iOS resource-folder declaration, dynamic loader and existing tests were inspected; retained attributions are unchanged. These 492492ce component results remain historical. The integrated candidate preserves the Mermaid package/build inputs, native notice owners/tests/resources, Android Gradle inputs, dependency pins, and lockfile byte-for-byte. Main independently changed the English catalog; current-head CI below validates that integration.

Evidence

Current head: 19c426e034f143afe5cf695b3f78033442230f6e. The prior signed integration c02c3259 incorporates pinned main 02ad6b76, including the canonical release-artifact fixture repair 3928d51b. The original 13-path product change is preserved.

The current head adds one native wrapper inventory entry for the existing plugin-state contract. PR #157333 moved that contract into an eager worker import on main but omitted it from the wrapper's copied source inventory. The prior merged CI context exposed 12 failures across wrapper import, lease and refresh fixtures. This one-line packaging repair includes the contract without pulling in the intentionally lazy plugin-state implementation. Independent review and scoped P0–P2 autoreview found no actionable findings. The PR now changes 14 paths.

Prior integrated CI passed the changed product owners: all UI shards, the three Settings cold-loading cases, i18n, build artifacts and Android's whole third-party unit-test task. Strict gzip measurements were startup JavaScript 370,016 / 371,332 bytes, CSS 51,170 / 51,200, and Mermaid 974,554 / 983,040. The previously failing release-artifact suite also passed all 64 tests. Exact-head ClawSweeper found no actionable issue. Overall CI remained failed because of the wrapper inventory omission; those failures are not relabeled as passes.

Current-head CI passed at 19c426e034f143afe5cf695b3f78033442230f6e: 181 successful jobs and 9 intentionally skipped jobs. Its actual merged checkout d3cf20e5 includes the eager-import change and this inventory repair. The whole eager-import-closure suite passed 15/15 and operation-lock suite 146/146; main-refresh and worktree-provision are covered by the successful full CI inventory, without separately extracted file counts. All three UI shards, UI performance/i18n, build artifacts, Android's whole third-party unit-test task and iOS smoke passed. Current gzip sizes are startup JavaScript 370,049 / 371,332 bytes, CSS 51,170 / 51,200, and Mermaid 974,554 / 983,040. Exact-head ClawSweeper revision 8 reports no actionable findings, before-merge items, or rank-up moves. Native final qualification and merge remain pending.

Visual Comparison

Inspected synthetic screenshots below use identical diagram source, a 1440 × 1000 viewport, and the light theme in the normal-built Control UI with its mock Gateway. Before: baseline b078de41c413 with Mermaid 12.0.0. After: published head 19d4df173f0b with Mermaid 11.17.2. Both render the four-node flowchart and preserve the exact source through Show source → Show diagram. Renderer requests returned 200 and both final captures had zero page errors. The small connector/layout difference is visible; this is one desktop flowchart comparison, not exhaustive diagram-family or native-app proof.

Before: baseline Control UI with Mermaid 12.0.0

After: published PR head with Mermaid 11.17.2

Restore Mermaid 11.17.2 and its lockfile graph to bring the deferred renderer below the existing 960 KiB gzip limit. Preserve the released v2026.9.6 diagram contract and opaque-frame sanitizer; Mermaid 12-only diagram and ELK capabilities are rolled back.
@clawsweeper

clawsweeper Bot commented Sep 24, 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.

@steipete steipete self-assigned this Sep 24, 2026
@steipete
steipete marked this pull request as ready for review September 24, 2026 09:02
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Dependency graph changes

This maintainer PR changes the dependency graph. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 19c426e034f143afe5cf695b3f78033442230f6e
  • Maintainer: @steipete
  • Repository role: admin

These dependency graph changes were made:

  • pnpm-lock.yaml
  • packages/mermaid-renderer/package.json

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 12:38 PM ET / 16:38 UTC (Revision 8).

ClawSweeper review

What this changes

The branch restores the released Mermaid version for web and native diagrams, loads English Settings section labels with Settings, updates native license notices, and adds a required source to the PR wrapper inventory.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Current main still exceeds the reported renderer budget and keeps the Settings section labels in the eager catalog. The branch remains useful, and the earlier native notice finding has been resolved.

Priority: P2
Reviewed head: 19c426e034f143afe5cf695b3f78033442230f6e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused and has strong visible renderer proof, while current-head qualification remains subject to the normal repository gates.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The shared renderer pin is tied to inspected before/after Control UI chat screenshots showing a rendered diagram after the rollback; reported production-build sizes and native packaging checks supplement that visible result. The final head adds a wrapper inventory line, while the renderer inputs are unchanged. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The shared renderer pin is tied to inspected before/after Control UI chat screenshots showing a rendered diagram after the rollback; reported production-build sizes and native packaging checks supplement that visible result. The final head adds a wrapper inventory line, while the renderer inputs are unchanged. No stored-data contract changes.
Evidence reviewed 9 items Current-main renderer: Fetched main still pins Mermaid 12.0.0, so the central renderer change has not landed.
Shipped renderer version: The v2026.9.6 release commit pins Mermaid 11.17.2, the version restored by this branch.
Current-main Settings copy: Fetched main still places section labels in the eager English catalog.
Findings None None.
Security None None.

How this fits together

The Control UI and native chat use a shared Mermaid renderer to turn diagram source into sanitized images. Settings routes load translated section labels from the UI catalog before displaying headings or search results.

flowchart LR
A[Chat diagram source] --> B[Pinned Mermaid renderer]
B --> C[Sanitized diagram]
C --> D[Web and native chat]
B --> H[Native license notices]
E[Settings route or search] --> F[Lazy English labels]
F --> G[Settings headings]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -711, Tests +58, Config 0, Other -1454. Total -2107 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 5 133 844 -711
Tests 2 60 2 +58
Docs 0 0 0 0
Config 1 1 1 0
Generated 0 0 0 0
Other 6 23 1477 -1454
Total 14 217 2324 -2107

Review metrics

Metric Value Why it matters
Prior integrated asset headroom startup JS 1,316 B; CSS 30 B; Mermaid 8,486 B The reported integrated build clears all three limits, with especially little CSS margin for current-head qualification.

Technical review

Best possible solution:

Keep the released renderer version and complete native notices within the existing budgets; revisit Mermaid 12 capabilities in a separately budgeted renderer update.

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

Yes. Current main pins Mermaid 12 and the existing performance check enforces a 983,040-byte renderer limit; the PR records a pre-fix build above that limit. This read-only review did not rerun the build.

Is this the best way to solve the issue?

Yes. The branch restores the shipped renderer pin without raising budgets and uses the existing lazy Settings registrar while preserving translation keys and the shared English object.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs an existing asset-budget failure with a bounded effect on diagram and Settings loading.
  • merge-risk: 🚨 compatibility: The maintainer-authored PR explicitly accepts deferring Mermaid 12-only diagrams and ELK layout; the latest stable release already uses the restored version.
  • 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. Sufficient (screenshot): The shared renderer pin is tied to inspected before/after Control UI chat screenshots showing a rendered diagram after the rollback; reported production-build sizes and native packaging checks supplement that visible result. The final head adds a wrapper inventory line, while the renderer inputs are unchanged. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The shared renderer pin is tied to inspected before/after Control UI chat screenshots showing a rendered diagram after the rollback; reported production-build sizes and native packaging checks supplement that visible result. The final head adds a wrapper inventory line, while the renderer inputs are unchanged. No stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The shared renderer pin is tied to inspected before/after Control UI chat screenshots showing a rendered diagram after the rollback; reported production-build sizes and native packaging checks supplement that visible result. The final head adds a wrapper inventory line, while the renderer inputs are unchanged. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (7 earlier review cycles)
  • reviewed 2026-09-24T09:10:21.380Z sha 19d4df1 :: needs changes before merge. :: none
  • reviewed 2026-09-24T09:32:01.569Z sha 19d4df1 :: needs changes before merge. :: none
  • reviewed 2026-09-24T10:32:52.189Z sha 19d4df1 :: blocked before merge. :: [P2] Align native notices with the restored Mermaid bundle
  • reviewed 2026-09-24T10:53:12.216Z sha 19d4df1 :: blocked before merge. :: [P2] Align native notices with the restored Mermaid bundle
  • reviewed 2026-09-24T15:28:03.630Z sha 492492c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T15:53:03.290Z sha 492492c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T16:10:00.726Z sha c02c325 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. labels Sep 24, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The inspected, synthetic before-and-after Mermaid screenshots are now embedded in the PR body and were also delivered in the originating chat. Both images were verified to load on the public PR page. The same fenced source renders before and after, and both Show source → Show diagram roundtrips passed without page errors. The visible connector geometry difference is documented.

Exact-head CI is green. The separate inherited registry lint failure was fixed on main by #157168; its original failed local check remains disclosed.

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc vincentkoc self-assigned this Sep 24, 2026
@clawsweeper clawsweeper Bot added 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Sep 24, 2026
@vincentkoc vincentkoc closed this Sep 24, 2026
@vincentkoc vincentkoc reopened this Sep 24, 2026
* commit '02ad6b76b1a2ee2b414b170072e6e3e606fda3d4': (122 commits)
  fix(build): scope normalization declarations to package sources (#157174)
  fix: exit after validating Codex model references (#157323)
  fix(gateway): guard workspace adoption during active work (#157259)
  fix(update): rebuild stale Git runtimes when source is already current (#156996)
  fix: require a click before diagnosing failed updates (#157359)
  test(release): provide sealed artifact inputs to writer fixtures
  fix(ios): preserve chat state and adapt layout when iPad windows resize (#156683)
  fix(test): prepare native UI fixtures before compilation
  fix(test): await outbound delivery readiness before assertions
  fix: clarify deferred Codex catalog refresh warnings (#157352)
  fix(skills): refresh skills after watched directories are replaced (#156324)
  ci: reduce Node fixture overhead and defer seven release matrices (#157341)
  chore(test): stop Codex Computer Use and Signal batching tests flaking under load (#157334)
  fix(gateway): retain owned suspension status during restart (#157258)
  fix(ci): scope desktop status assertions to the selected worker
  chore(i18n): refresh native locales (#157337)
  test(daemon): use the native PowerShell probe budget (#157289)
  fix(exec): avoid gateway stalls during background task writes (#157177)
  test(cli): isolate preaction title setter state
  fix(test): synchronize Git backoff cancellation readiness (#157315)
  ...
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 24, 2026
@vincentkoc
vincentkoc merged commit 26b464f into main Sep 24, 2026
239 of 243 checks passed
@vincentkoc
vincentkoc deleted the fix/mermaid-renderer-asset-budget-20260924 branch September 24, 2026 17:02
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
* fix: keep Mermaid diagrams within the asset budget

Restore Mermaid 11.17.2 and its lockfile graph to bring the deferred renderer below the existing 960 KiB gzip limit. Preserve the released v2026.9.6 diagram contract and opaque-frame sanitizer; Mermaid 12-only diagram and ELK capabilities are rolled back.

* perf(ui): load Settings section labels with Settings

* fix(native): align Mermaid 11 license notices

* fix(ci): include plugin-state contract in PR wrapper

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios app: web-ui App: web-ui dependencies-changed PR changes dependency-related files merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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.

2 participants