Repository navigation
improve: ship less JavaScript for sidebar previews in Chat and New Session - #201252
Conversation
Co-authored-by: vyctorbrzezowski <[email protected]>
…ssion Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 1e6838bb-fd8a-8c7a-9b77-9e35d1906974
|
🦞👀 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. |
Co-authored-by: vyctorbrzezowski <[email protected]>
Worked on by: - @vyctorbrzezowski Co-authored-by: vyctorbrzezowski <[email protected]> OpenClaw-Publication: 911e09ff-1d13-8433-8da4-36d3f75bf576
|
Codex review: needs maintainer review before merge. What this changesThis PR simplifies Markdown link scanning to reduce JavaScript downloaded by Chat and New Session while preserving text output. Example: Open Chat or New Session.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR makes a focused, measured reduction to shared preview code, with no actionable correctness or security defect found. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared normalization package converts Markdown into plain-text previews for UI and Gateway consumers, and removes link destinations and images for web_fetch text extraction. flowchart TD
A[Markdown text] --> B[Shared link scanner]
B --> C[Plain text flattener]
C --> D[Sidebar and session previews]
C --> E[Cron and other excerpts]
B --> F[Web fetch text extraction]
Technical reviewBest possible solution: Land the compact scanner through the existing shared owner once the exact-head CI gate is resolved. Do we have a high-confidence way to reproduce the issue? This is a behavior-preserving optimization rather than a bug report; source inspection confirms the redundant representations, and no target code was executed during review. Is this the best way to solve the issue? The change follows the smallest complete approach: retain the parser and its contracts, record removal ranges once, and delete the redundant helper and maps without adding another owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f8727fdcd3a1. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -25, Tests +20. Total -5 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel 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 Reviewed November 18, 2026, 9:29 AM ET / 14:29 UTC. |
|
Re-ran checks-fast-baseline-ratchets once. It failed because GitHub's hosted runner lost contact with the server, not because of a test result. cc @vyctorbrzezowski |




Related: #200929
What Problem This Solves
Chat and New Session both download the code that turns Markdown into plain text for live sidebar previews. Its link scanner kept three separate maps to decide which markup to remove, and both routes are already over their startup JavaScript budgets.
User Impact
No visible change. Sidebar preview text, and when it appears, stay the same. Chat and New Session each download 321 fewer gzip bytes of JavaScript, with no added requests.
Why This Change Was Made
The shared plain-text flattener now records the link markup to skip in one map and applies the edits in source order. It keeps the preview's existing treatment of nested labels, escaped image markers, empty links and unfinished Markdown, without adding a dependency or deferring work. Swapping in micromark was ruled out: it treats empty links, nested links and unfinished fences differently from what the preview intentionally shows.
Evidence
The paired performance comparison against
fb34e996e8e469035e3238734bba3afb1236eb19passed: Chat and New Session boot JS each −321 B gzip, startup unchanged, request counts unchanged at 21, 17 and 3. A differential run matched the previous output across 49 owner-fixture calls, 1,310 transcript fixtures and streamed prefixes, and 100,000 generated inputs in flatten, label and omit modes. New committed cases cover composed linked images, escaped bangs, empty labels and nested image omission. 412 focused tests (shared scanner, sidebar roster and narration, Cron, server consumers), lint, formatting and the UI typecheck passed.Requested by @vyctorbrzezowski.
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by