Skip to content

improve(ios): avoid reparsing unchanged chat messages - #198111

Merged
vyctorbrzezowski merged 1 commit into
mainfrom
openclaw/ios-markdown-preparation-reuse
Nov 14, 2026
Merged

vyctorbrzezowski merged 1 commit into
mainfrom
openclaw/ios-markdown-preparation-reuse

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Chat refreshes can prepare Markdown again for unchanged visible messages, including user messages and assistant messages with media.

User Impact

Mounted messages can reuse their prepared Markdown without changing their layout, styling, selection, accessibility, or disclosure state.

Why This Change Was Made

The renderer now accepts raw text cheaply and retains one prepared result for its mounted lifetime. Source replacement, completion changes, and changes to the localized default disclosure summary rebuild the complete document synchronously. Already-prepared snapshots still pass through unchanged.

This also covers completed list items, expanded progress-card Markdown, the full-message reader, and sidebar notepad Markdown through the same renderer. It does not freeze streaming prefixes or claim to eliminate prior-block preparation on a new streaming delta. There is no global cache, new async rendering phase, or change to word-fade timing.

Evidence

Maintainer verification on ff3fdd25559658ad0570c1f62247a17bfbe635dc, compared with 0633f256350b5580a5bdbcd8a6a5782750de03d4:

  • iOS Debug/Release and macOS builds passed. Source-selected Markdown/math tests passed 27 candidate and 25 baseline tests; temporary manifests were restored.
  • In the actual app with unchanged synthetic Gateway history, reconnect invoked the renderer three times on both sides, but prepared three snapshots on the base and zero on the candidate. Appearance changes similarly required one preparation on the base and none on the candidate.
  • Inspected screenshots and sampled video frames preserved readable content and presentation. Sibling disclosure toggles showed no additional gain.
  • Five Release RSS pairs had overlapping ranges, establishing no meaningful process-wide memory benefit. Cold-call counts were unmatched. No latency or CPU improvement is claimed.

Work sessions

Linked for team reference; these sessions aren’t public.

Worked on by

Worked on by:
- @mikengyn
- @vyctorbrzezowski

Co-authored-by: mikengyn <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
OpenClaw-Publication: 31f2e24a-0df0-4786-a292-2c1fef57acec
@clawsweeper

clawsweeper Bot commented Nov 13, 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. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR retains one prepared Markdown document per mounted native renderer and rebuilds it when semantic input changes.

Example: A mounted user message containing “Hello world” is refreshed without changing its text.

  • Before: Reconstructing the renderer prepares the same Markdown again.
  • After: The renderer reuses its prepared document while preserving the displayed formatting.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The source change is coherent and has no identified correctness finding, but required native execution and performance evidence are absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Unchanged visible native chat messages can repeat Markdown preparation during refreshes.
Reason: The maintainer-authored direction removes identifiable repeated work within the shared renderer without changing public options or intended rendering.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: it addresses repeated preparation still present on main, and source review found no concrete introduced correctness defect.

Priority: P2
Reviewed head: ff3fdd25559658ad0570c1f62247a17bfbe635dc

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide the planned native mounted-refresh comparison showing warm preparation reuse, synchronous semantic replacement, unchanged rendering and interaction, and the declared performance acceptance results; baseline-red/head-green execution is also unshown.
Agent review details

How this fits together

The shared Apple chat renderer converts raw Markdown or supplied snapshots into SwiftUI blocks for iOS and macOS chat surfaces.

flowchart TD
A[Chat and reader surfaces] --> B[Raw Markdown input]
B --> C[Mounted renderer preparation]
C --> D[Markdown render snapshot]
E[Streaming snapshot owner] --> D
D --> F[SwiftUI blocks and images]
Loading

Technical review

Best possible solution:

Retain the single mounted preparation slot at the existing renderer boundary, preserving synchronous replacement and prepared streaming snapshots.

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

Source establishes eager preparation whenever raw-text callers reconstruct the renderer, but the frequency and user-visible cost have not been demonstrated by execution.

Is this the best way to solve the issue?

The proposed lifetime and semantic key fit the existing renderer owner, preserve prior rendering contracts, and avoid a global cache or parallel parser.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 03c925b74467.

Provenance checked

  • Raw-text initialization and supplied snapshots keeps the original intent (83f0527: Prepared snapshots support word-paced streaming without parsing on each animation frame.)
  • Disclosure summaries and recursive rendering keeps the original intent (138675a: Native disclosures localize only the fallback summary and preserve authored summaries and nested content.)
  • Reveal preparation eligibility keeps the original intent (a410b4d: Only the last eligible incomplete prose block needs reveal metadata; completed snapshot behavior remains intact.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 83f0527 adds apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatMarkdownRenderer.swift:27 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 83f052772429; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatMarkdownRenderer.swift)

PR surface

Source +78, Tests +71. Total +149 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 90 12 +78
Tests 1 71 0 +71
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 161 12 +149

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Repeated native Markdown preparation is a bounded performance improvement without an established urgent user-facing regression.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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.

Reviewed November 13, 2026, 12:29 AM ET / 05:29 UTC.

@vyctorbrzezowski vyctorbrzezowski self-assigned this Nov 14, 2026
@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review November 14, 2026 16:58
@vyctorbrzezowski
vyctorbrzezowski merged commit 1240284 into main Nov 14, 2026
157 of 159 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the openclaw/ios-markdown-preparation-reuse branch November 14, 2026 17:51
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
Reuse prepared Markdown for unchanged mounted messages while invalidating on content, completion, and localized-summary changes.

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

Labels

P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S 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