Skip to content

feat(macos): render Mermaid diagrams in native chat - #135746

Merged
steipete merged 5 commits into
mainfrom
codex/macos-mermaid-diagrams
Sep 2, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/macos-mermaid-diagrams

Conversation

@steipete

@steipete steipete commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Related: #135293

Follows the landed Android implementation in #135342 and shared Apple/iOS implementation in #135470.

What Problem This Solves

Mac chat and Quick Chat show Mermaid source instead of the diagrams available in the Control UI and mobile apps. Completed diagrams now render inline with compact controls. This also fixes missing display equations in full chat and Quick Chat conversations disappearing when their expanded preview opens.

Why This Change Was Made

Mac reuses the shared Apple renderer and pinned offline assets introduced for iOS. A bounded WebKit renderer produces native transcript images; expanded previews display sanitized SVG with JavaScript disabled.

The fixes stay with their owners. Quick Chat recognizes its attached window family and ties deferred focus checks to the presentation that scheduled them. The math bridge reports SwiftMath’s measured size to SwiftUI, preventing a split-view host from allocating an equation zero space. The Mac preview explicitly fits both axes so its existing 900×600 ideal size is honored.

User Impact

Users can read or copy source and expand a diagram from the small corner menu. Copy also appears on hover or keyboard focus, and clicking the diagram opens the vector preview. Close or Escape returns to the conversation. Invalid diagrams retain readable source, temporary failures offer Retry, and incomplete streaming fences remain code.

The native chat documentation describes these controls and the correct cache locations. No Gateway configuration, permission, persistent store or database migration is added.

Evidence

Final source: 9d495af861022b32d6ad63697a81b869763e1118. All checks completed: 169 passed, 15 skipped, zero pending or failed, including the required CI gate, Mac tests/release build, iOS build, iPhone/iPad screenshot tests and all selected Periphery scans. Main CI, iOS Periphery, shared-kit Periphery and intersection.

Surface Before After — final 9d495af
Full chat Mac chat before Mermaid rendering Mac chat renders the reference diagram and display equation
Quick Chat Quick Chat before Mermaid rendering Quick Chat renders the diagram and equation with compact controls

Expanded Mermaid preview with native Close control

These are unedited app-window captures of synthetic messages, inspected independently before upload. Before uses the older pre-feature build d903d89736807b10c29ba9e8358535de22fbf363, rather than the immediate parent. All after images were freshly captured from the final 9d build. Both app builds are signed by OpenClaw Foundation.

  • Final signed build: the canonical arm64 Debug package passed, including runtime JavaScript, native code, MLX, offline resources, the bundled worker and post-sign worker checks. It uses the supported runtime-only mode that omits SDK declaration emission. The installed app’s commit, executable, five Mermaid resources and Developer ID signature were verified in the isolated Mac VM.
  • Final native interactions: full chat and Quick Chat render the reference graph and E = mc². Source/view switching, menu expansion and direct-image activation work. Both previews measure 900×600. Mouse Close and Escape return to the conversation. Quick Chat retains its parent while the larger sheet is open, dismisses both on an outside click, reopens as an empty 620×56 bar, and dismisses on a switch to Finder. The same app process remains running. Source Copy matches all 279 bytes; Quick Chat Copy replaced a distinct clipboard marker.
  • Final controller tests: a fresh build from clean 9d ran all eight Quick Chat tests in the VM: eight passed, none failed or skipped. This includes stale-presentation focus fencing and permission/capture focus behavior. Strict SwiftLint, SwiftFormat, native source-inventory verification and Codex autoreview passed.
  • Regression and stress evidence: the same math regression fails before the fix and passes after it in direct and split-view hosts resized 960 → 620 → 960 points. The failing host allocated 0×0 despite a measured 63.88×14.28 equation. On signed 398, the native sweep reached all 40 diagrams: 33 rendered initially and seven required explicit Retry. All 40 equations rendered; malformed source remained readable and copied exactly while the following valid graph/math rendered. These stress results retain their original source attribution; their renderer, assets and math owner are unchanged in 9d. The larger-preview resizing check passed on a262, before the final mechanical callback relocation.

An earlier Mac release check caught the strict 800-line type-body limit. Grouping unchanged delegate callbacks in their conformance extension reduced the body from 807 to 791 lines; the final release check passed. Unassigned Apple jobs were recovered through the workflows’ documented hosted retry route, retaining completed successful work. All resulting checks finished successfully.

The latest ClawSweeper review’s rank-up requests are addressed by the final signed native evidence above and completed checks. Physical Mac trackpad pinch remains unverified because the available automation has no supported magnification gesture; WebKit magnification is enabled. The iOS simulator pinch result remains iOS-only evidence.

Recorded follow-up from the live run: preserve paragraph separators in shared native prose. The existing /help rendering joins paragraph text such as [input]More:; the prose pipeline predates this feature. This is separate from Mermaid presentation.

Measured against the landed iOS parent: production +110/-42 (net +68), tests +124, documentation +18/-1, source inventory +1/-1. The final callback relocation adds two structural lines and changes no callback statements. The production growth enables desktop controls and repairs shared presentation ownership while reusing the existing renderer and resource lifecycle.

@steipete steipete self-assigned this Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos size: XS maintainer Maintainer-authored PR labels Sep 2, 2026
@steipete
steipete marked this pull request as ready for review September 2, 2026 00:59
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 12:49 AM ET / 04:49 UTC.

ClawSweeper review

What this changes

This branch renders completed Mermaid code fences in macOS full chat and Quick Chat, adds compact desktop diagram controls and previews, and repairs related Quick Chat focus and math-layout behavior.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this maintainer-authored PR open for normal exact-head validation and maintainer review. The implementation uses the existing shared Apple renderer at the correct Markdown and Quick Chat owner boundaries, with no blocking code defect found; the final head’s native package/live confirmation and CI are still pending.

Priority: P2
Reviewed head: 9d495af861022b32d6ad63697a81b869763e1118

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused reuse of the existing renderer with credible owner-boundary regression tests; exact-head macOS validation remains the material pre-merge check.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable as an external-contributor proof gate because the repository state identifies this as a MEMBER-authored PR. The PR body records signed macOS captures and interactions at a pre-relocation commit, but states exact-head validation is still pending; that remains a maintainer landing check rather than a contributor-proof failure.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable as an external-contributor proof gate because the repository state identifies this as a MEMBER-authored PR. The PR body records signed macOS captures and interactions at a pre-relocation commit, but states exact-head validation is still pending; that remains a maintainer landing check rather than a contributor-proof failure.
Evidence reviewed 8 items Current-main behavior: Current main compiles the Mermaid block path only for iOS, so macOS falls back to a readable code block; the PR expands that platform gate to macOS while retaining the completed-fence condition.
Renderer ownership and safeguards: The existing shared renderer owns bounded request admission, a nonpersistent WebKit document, result-origin checks, cancellation, and recovery; the existing preview uses JavaScript-disabled, CSP-restricted SVG display. The PR activates this owner on macOS rather than adding a second renderer.
Caller and streaming invariant: Both completed and streaming assistant transcript paths call the Markdown renderer; existing block-segmenter coverage keeps unclosed fences as readable code, matching the PR’s completion-only activation.
Findings None None.
Security None None.

How this fits together

Native chat turns streamed Markdown into transcript blocks for full chat and the menu-bar Quick Chat panel. Completed Mermaid blocks now pass to the shared Apple renderer, whose result is shown inline or in a native macOS preview.

flowchart LR
A[Streamed chat Markdown] --> B[Markdown block renderer]
B --> C{Completed Mermaid fence}
C -->|No| D[Readable code block]
C -->|Yes| E[Shared Apple renderer]
E --> F[Inline macOS diagram]
F --> G[Preview and copy controls]
G --> H[Quick Chat window handling]
Loading

Before merge

  • Resolve merge risk (P1) - The PR body says the final-head signed package, interactive native check, and hosted CI are still pending; the supplied macOS visual proof is attributed to an earlier commit before the final delegate relocation. The read-only environment could not independently compare that promisor parent or open the attached captures.
  • Complete next step (P2) - The remaining work is exact-head native validation and protected maintainer handling, not a concrete repair suitable for an automated fix branch.
Agent review details

Security

None.

PR surface

Docs +17, Other +192. Total +209 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 18 1 +17
Config 0 0 0 0
Generated 0 0 0 0
Other 6 235 43 +192
Total 7 253 44 +209

Review metrics

Metric Value Why it matters
Production versus test delta production +110/-42 (net +68); tests +124 The production growth is tied to the new macOS presentation capability and owner-boundary focus/layout repairs, while regression coverage is separately substantial.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #135293
Summary: This PR is the macOS implementation candidate for the open native-chat Mermaid umbrella; the Android and iOS PRs are already merged platform-specific predecessors.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the shared renderer approach, then complete exact-head signed macOS interaction evidence and CI before merging.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the shared renderer approach, then complete exact-head signed macOS interaction evidence and CI before merging.

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

Not applicable to the primary feature request; current-main source directly establishes the macOS iOS-only render gate, while native UI execution was not possible in this read-only Linux review environment.

Is this the best way to solve the issue?

Yes. Reusing the existing bounded shared Apple renderer and opening its macOS platform gate is the maintainable solution; a separate macOS Mermaid engine would duplicate security and lifecycle policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8cfd23c94c1d.

Labels

Label justifications:

  • P2: This is a user-visible native chat improvement with bounded macOS scope and no demonstrated release-blocking regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable as an external-contributor proof gate because the repository state identifies this as a MEMBER-authored PR. The PR body records signed macOS captures and interactions at a pre-relocation commit, but states exact-head validation is still pending; that remains a maintainer landing check rather than a contributor-proof failure.

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)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted exact-head signed macOS evidence for inline rendering, preview Close/Escape return, and Quick Chat outside-click behavior.
  • Wait for the exact-head hosted checks to complete successfully before merging.

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 (4 earlier review cycles)
  • reviewed 2026-09-02T01:07:27.147Z sha d0ded21 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T02:30:12.693Z sha 610faa2 :: needs changes before merge. :: [P1] Hop global event-monitor callbacks onto the main actor
  • reviewed 2026-09-02T02:48:05.281Z sha 398efb6 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T03:26:05.322Z sha a26281c :: needs maintainer review before merge. :: none

Preserve Quick Chat while focus and clicks remain in its attached window family, and fence deferred focus checks to their presentation. Give SwiftMath its measured Mac size in full chat and enlarge the diagram preview. Cover split-view math layout and stale presentation callbacks.
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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 P2 Normal backlog priority with limited blast radius. 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 2, 2026
Use the Swift NSWindow.parent property name for child-window ancestry.
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Sep 2, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Sep 2, 2026
@steipete
steipete merged commit 3c540a2 into main Sep 2, 2026
350 of 361 checks passed
@steipete
steipete deleted the codex/macos-mermaid-diagrams branch September 2, 2026 06:18
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
* feat(macos): render Mermaid diagrams in native chat

* fix(macos): keep chat previews and equations visible

Preserve Quick Chat while focus and clicks remain in its attached window family, and fence deferred focus checks to their presentation. Give SwiftMath its measured Mac size in full chat and enlarge the diagram preview. Cover split-view math layout and stale presentation callbacks.

* fix(macos): compile preview window ownership checks

Use the Swift NSWindow.parent property name for child-window ancestry.

* fix(macos): honor diagram preview dimensions

* refactor(macos): group Quick Chat window delegate callbacks
steipete added a commit that referenced this pull request Oct 13, 2026
* refactor(apple): simplify old shared and macOS bookkeeping

Replace redundant generations with existing cancellation or actual owner
identity, consolidate parallel fallback/policy paths, and remove test-only
forwarding layers. Preserve authority, FIFO, durable state, resource bounds,
public protocol/config shapes, signing, permissions, and visible rendering.

Reuse canonical session-key normalization for Voice Wake delivery selection:
opaque Signal group IDs remain case-sensitive and main aliases are not added.
Use canonical IP-literal policy for discovery labels and remote CLI validation.

Best-effort tradeoffs accepted

- Palette generation (#159350): synthetic direct completions bypassed the sole cancellation-owning caller; unsupported future callers can show stale results until the next search. Current cancellation/request/agent checks remain.
- Link preview generation (#160710): synthetic URL replacement without caller cancellation is outside the SwiftUI task lifecycle; a late cosmetic result can remain until the next refresh. Network/SSRF checks and bounded caches remain.
- Sidebar preview generation (#147197): same-request overlapping cache reads can finish out of order; no linked human failure report, and a later refresh replaces the cosmetic projection. Owner/request checks remain.
- Source-preview producer revision (#148906): duplicate of exact task cancellation, with no human failure report. Consumer revision and authenticated resource authority remain.
- Mermaid generations (#135470/#135746): feature stress fixtures, no linked human race report. Exact subscriber cancellation and job/WebView identity retain the same admission; no extra failure accepted.
- Camera JPEG UUID (#107879): duplicates exact task cancellation; #107804 was a human feature request, not a generation-specific incident. Captured session/agent/route and attachment admission remain.
- Discovery generation (#145435): speculative queued callbacks, no linked human incident. A stopped browser may publish one late discovery projection; next discovery/refresh repairs it. Connection authority remains separate.
- FSEvents generation (#145453): synthetic stop/restart fixtures, no linked human incident. An old callback after restart may cause one extra refresh; serial lifecycle ownership and pending-work cancellation remain.
- Menu generations (#139688): feature-local late-result fixtures, no linked human incident. Exact task cancellation replaces duplicate tokens; drain-before-disconnect and real consumer/window authority remain.
- Cron generation (#131466/#137502): #138209 cut every load over to one cancel-and-drain chain. No direct concurrent load caller remains; cancellation and physical source leases stay checked after awaits.
- WebChat visibility acknowledgement/retry (#113634/#137089): synthetic timeout/reconnect interleavings, no linked human incident. A timed-out visibility update is best effort until the next transition/reconnect; FIFO and live socket leases remain.
- WebChat cleanup UUID (#113634/#137089): retain one bounded completed Task handle per live connection instead of matching cleanup tokens. Completion releases captures; replacement/retirement removes the handle.
- Child-exit polling (#145437): synthetic missed-notification coverage, no linked human report. A lost OS exit notification may wait for the existing deadline; final non-reaping liveness/status checks and cleanup remain.
- Realtime iterator borrowing trap (#156772): every real consumer awaits its own iterator sequentially. Unsupported concurrent next calls no longer get a custom custody protocol; bounded stream/cancellation/socket checks remain.
- Receipt projection admission (#161745): both real callers already match receipt and row identity immediately before synchronous projection. Those effect checks remain; no unsupported internal caller is defended twice.
- Recap attribution heuristics (#112188/#113084): synthetic guard matrix, no linked human race report. Missing initial rows or very late unrelated completion may supply a cosmetic footer; per-session freshness, failed-turn handling and settled results remain.
- PortGuardian per-write schema scans (#110527): synthetic live-handle version advance, no linked human incident. Concurrent external schema upgrades are best effort until reopen; initial admission, migration locks, receipts, transactions and durability remain.
- Unread queue counter (#110019): actual Task equality replaces the duplicate integer token. Exact-tail reclamation, bounded bookkeeping, FIFO and route authority remain unchanged.

Review dispositions: the claimed Task compilation failure is disproved by the
selected SDK's Equatable conformance and native builds. Repeated receipt
identity admission is unnecessary at its internal projector because both real
callers retain it immediately before projection. Per-write schema revalidation
was declined under the explicit best-effort policy above.

Proof and scope

Net production reduction: 369 lines (148 added, 517 deleted), excluding tests.
Fresh seven-day census permits all substantive production edits; the only
recent caller change is the unavoidable one-line fallback-to-parse rename.

Shared Swift build passed. Final focused shared tests passed 396 cases in six
suites (6.683s execution), Watch decoder tests passed five cases (0.003s), and
isolated whole-owner native tests passed 16 cases. macOS SwiftPM compiled all
products and the test bundle. Final macOS and iOS/Watch xcodebuild builds passed
(89.60s and 120.87s wall), without signing changes or app launches.

Canonical Apple lint/format checks passed; the initial iOS format failure in
WatchCommands was ours and corrected, with no gate weakened. Lint-suppression
tests passed 3/3 (14.09s wall). Earlier runtime cycles and Madge each reported 0;
the TypeScript graph is unchanged. Native localization stayed at 4476 entries.
The 45 original packaging/elevation timeout cases passed one focused retry
(94.79s wall), with no assertion/budget change and no claim of a diagnosed fix.

Known gaps: seven issues remained in the earlier ChatStreamReplayTests
narration=false package cases; causality/current-main attribution is unproven.
App-hosted macOS tests were not executed on the operator desktop. No hosted CI
or PR was started: the explicit BELOW-500 rule requires a branch-only handoff.

* refactor(ui): consolidate old UI owners and validation

Share route decoding, attachment retention, gallery preparation, transient
identity encoding, override copying, and extension classification. Remove
duplicate admission/schema mirrors and obsolete supported-browser fallbacks.
Both Lit and Solid paths remain; no rendering change is intended. No config,
protocol, persisted shape, dependency, or public SDK change.

Best-effort tradeoffs accepted

- Malformed internal native requests (#140988): all callers are typed and
  native hosts validate at the effect; their error replaces the renderer mirror.
- Worker replacement during an identity query (#140484): added for synthetic
  autoreview interleavings, not a human incident. Return false; normal worker
  announcements and foreground recovery observe the next active worker.
- Native readiness changing between synchronous checks (#140484/#109719):
  rely on queued events. A broken native event can require another worker event
  or reload; camera readiness retains its existing five-second error deadline.
- Overlapping application-root health reporters (#152638): startup mounts one
  root. Unsupported overlapping roots are last-publication-wins; the actual
  reported health/status feature and native trusted-document checks remain.
- Polling after stop (#139704): its sole owner retires eligibility first.
  Scheduling now uses that owner admission, not a separate read-only generation.
- Resetting an observer without retiring its connection (#116887): no production
  caller does this. Canonical connection epochs remain the sole retirement owner;
  unsupported direct live-scope reset no longer fences an old response separately.
- Upload policy changing during local reads (#158567): decoded/hash work can
  finish. Draft publication and every upload request retain live policy checks.
- Missing supported browser primitives (#105240/#151388/#100024/#102745):
  unsupported runtimes error instead of code-point initials, skipped input yield,
  wall-clock timing, or approximate microtask paint. The human progress-card fix
  in #151386 keeps its browser yield and durable FIFO handoff unchanged.
- URL APIs disappearing after URL creation (#100024/#149330): supported browsers
  keep paired APIs. An unsupported replaced global can throw during cleanup;
  undefined URLs, creation fallback, cancellation and release ordering remain.
- Malformed internal MCP calls bypassing AppBridge (#161747): may throw. The SDK
  still rejects malformed wire blocks before dispatch, proved over real in-memory
  App/AppBridge transport. UI content, authority, confirmation and custody policy
  remain. The introducing PR cites no human incident for the second mirror.

Production: +176/-394, net -218 lines across 21 eligible old files. Tests: +30.
Focused owner/sibling tests, targeted types/lint/format, lint-suppression and
independent P0-P2 review pass. Import edges are unchanged; runtime/Madge cycle
proof remains zero. Whole-tree Knip timed out at existing limits; heavy gallery
renderer runs did not reach assertions, while its owning controller suite passed.

* refactor(ui): remove obsolete Fetch capability branch

The supported Control UI browser floor includes Fetch. Start attachment
metadata reads directly rather than leaving an unsupported runtime in a
permanent checking state.

Best-effort tradeoffs accepted

- Missing global Fetch: the guard originated in #64104, whose feature report
  cites no human missing-Fetch incident. An unsupported runtime that replaces
  Fetch now reaches the existing rejected-request/unavailable path. Metadata
  validation, auth/tickets, allow POST, cancellation, resource admission,
  expiry and bounded retry remain unchanged. No intended rendering change.

Unchanged lifecycle baseline: 21/21, 25.09 s. Final lifecycle and attachment
siblings: 50/50, 14.77 s. UI types, typed lint, formatting and lint-suppression
checks pass. This cut removes five production lines including formatter
reflow, bringing the lane to 223 net production lines removed.
Fresh independent P0-P2 review is scoped-clean with no actionable findings.

* fix(ui): use global frame scheduling APIs

Preserve double-frame paint timing and cancellation without requiring a Window object in renderer-free hosts that supply the standard global APIs. The existing access suite reproduces seven unhandled errors before this fix and passes on main; all 130 affected cases plus 262 timing/state/send sibling cases now pass without test changes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…#170823)

* refactor(apple): simplify old shared and macOS bookkeeping

Replace redundant generations with existing cancellation or actual owner
identity, consolidate parallel fallback/policy paths, and remove test-only
forwarding layers. Preserve authority, FIFO, durable state, resource bounds,
public protocol/config shapes, signing, permissions, and visible rendering.

Reuse canonical session-key normalization for Voice Wake delivery selection:
opaque Signal group IDs remain case-sensitive and main aliases are not added.
Use canonical IP-literal policy for discovery labels and remote CLI validation.

Best-effort tradeoffs accepted

- Palette generation (openclaw#159350): synthetic direct completions bypassed the sole cancellation-owning caller; unsupported future callers can show stale results until the next search. Current cancellation/request/agent checks remain.
- Link preview generation (openclaw#160710): synthetic URL replacement without caller cancellation is outside the SwiftUI task lifecycle; a late cosmetic result can remain until the next refresh. Network/SSRF checks and bounded caches remain.
- Sidebar preview generation (openclaw#147197): same-request overlapping cache reads can finish out of order; no linked human failure report, and a later refresh replaces the cosmetic projection. Owner/request checks remain.
- Source-preview producer revision (openclaw#148906): duplicate of exact task cancellation, with no human failure report. Consumer revision and authenticated resource authority remain.
- Mermaid generations (openclaw#135470/openclaw#135746): feature stress fixtures, no linked human race report. Exact subscriber cancellation and job/WebView identity retain the same admission; no extra failure accepted.
- Camera JPEG UUID (openclaw#107879): duplicates exact task cancellation; openclaw#107804 was a human feature request, not a generation-specific incident. Captured session/agent/route and attachment admission remain.
- Discovery generation (openclaw#145435): speculative queued callbacks, no linked human incident. A stopped browser may publish one late discovery projection; next discovery/refresh repairs it. Connection authority remains separate.
- FSEvents generation (openclaw#145453): synthetic stop/restart fixtures, no linked human incident. An old callback after restart may cause one extra refresh; serial lifecycle ownership and pending-work cancellation remain.
- Menu generations (openclaw#139688): feature-local late-result fixtures, no linked human incident. Exact task cancellation replaces duplicate tokens; drain-before-disconnect and real consumer/window authority remain.
- Cron generation (openclaw#131466/openclaw#137502): openclaw#138209 cut every load over to one cancel-and-drain chain. No direct concurrent load caller remains; cancellation and physical source leases stay checked after awaits.
- WebChat visibility acknowledgement/retry (openclaw#113634/openclaw#137089): synthetic timeout/reconnect interleavings, no linked human incident. A timed-out visibility update is best effort until the next transition/reconnect; FIFO and live socket leases remain.
- WebChat cleanup UUID (openclaw#113634/openclaw#137089): retain one bounded completed Task handle per live connection instead of matching cleanup tokens. Completion releases captures; replacement/retirement removes the handle.
- Child-exit polling (openclaw#145437): synthetic missed-notification coverage, no linked human report. A lost OS exit notification may wait for the existing deadline; final non-reaping liveness/status checks and cleanup remain.
- Realtime iterator borrowing trap (openclaw#156772): every real consumer awaits its own iterator sequentially. Unsupported concurrent next calls no longer get a custom custody protocol; bounded stream/cancellation/socket checks remain.
- Receipt projection admission (openclaw#161745): both real callers already match receipt and row identity immediately before synchronous projection. Those effect checks remain; no unsupported internal caller is defended twice.
- Recap attribution heuristics (openclaw#112188/openclaw#113084): synthetic guard matrix, no linked human race report. Missing initial rows or very late unrelated completion may supply a cosmetic footer; per-session freshness, failed-turn handling and settled results remain.
- PortGuardian per-write schema scans (openclaw#110527): synthetic live-handle version advance, no linked human incident. Concurrent external schema upgrades are best effort until reopen; initial admission, migration locks, receipts, transactions and durability remain.
- Unread queue counter (openclaw#110019): actual Task equality replaces the duplicate integer token. Exact-tail reclamation, bounded bookkeeping, FIFO and route authority remain unchanged.

Review dispositions: the claimed Task compilation failure is disproved by the
selected SDK's Equatable conformance and native builds. Repeated receipt
identity admission is unnecessary at its internal projector because both real
callers retain it immediately before projection. Per-write schema revalidation
was declined under the explicit best-effort policy above.

Proof and scope

Net production reduction: 369 lines (148 added, 517 deleted), excluding tests.
Fresh seven-day census permits all substantive production edits; the only
recent caller change is the unavoidable one-line fallback-to-parse rename.

Shared Swift build passed. Final focused shared tests passed 396 cases in six
suites (6.683s execution), Watch decoder tests passed five cases (0.003s), and
isolated whole-owner native tests passed 16 cases. macOS SwiftPM compiled all
products and the test bundle. Final macOS and iOS/Watch xcodebuild builds passed
(89.60s and 120.87s wall), without signing changes or app launches.

Canonical Apple lint/format checks passed; the initial iOS format failure in
WatchCommands was ours and corrected, with no gate weakened. Lint-suppression
tests passed 3/3 (14.09s wall). Earlier runtime cycles and Madge each reported 0;
the TypeScript graph is unchanged. Native localization stayed at 4476 entries.
The 45 original packaging/elevation timeout cases passed one focused retry
(94.79s wall), with no assertion/budget change and no claim of a diagnosed fix.

Known gaps: seven issues remained in the earlier ChatStreamReplayTests
narration=false package cases; causality/current-main attribution is unproven.
App-hosted macOS tests were not executed on the operator desktop. No hosted CI
or PR was started: the explicit BELOW-500 rule requires a branch-only handoff.

* refactor(ui): consolidate old UI owners and validation

Share route decoding, attachment retention, gallery preparation, transient
identity encoding, override copying, and extension classification. Remove
duplicate admission/schema mirrors and obsolete supported-browser fallbacks.
Both Lit and Solid paths remain; no rendering change is intended. No config,
protocol, persisted shape, dependency, or public SDK change.

Best-effort tradeoffs accepted

- Malformed internal native requests (openclaw#140988): all callers are typed and
  native hosts validate at the effect; their error replaces the renderer mirror.
- Worker replacement during an identity query (openclaw#140484): added for synthetic
  autoreview interleavings, not a human incident. Return false; normal worker
  announcements and foreground recovery observe the next active worker.
- Native readiness changing between synchronous checks (openclaw#140484/openclaw#109719):
  rely on queued events. A broken native event can require another worker event
  or reload; camera readiness retains its existing five-second error deadline.
- Overlapping application-root health reporters (openclaw#152638): startup mounts one
  root. Unsupported overlapping roots are last-publication-wins; the actual
  reported health/status feature and native trusted-document checks remain.
- Polling after stop (openclaw#139704): its sole owner retires eligibility first.
  Scheduling now uses that owner admission, not a separate read-only generation.
- Resetting an observer without retiring its connection (openclaw#116887): no production
  caller does this. Canonical connection epochs remain the sole retirement owner;
  unsupported direct live-scope reset no longer fences an old response separately.
- Upload policy changing during local reads (openclaw#158567): decoded/hash work can
  finish. Draft publication and every upload request retain live policy checks.
- Missing supported browser primitives (openclaw#105240/openclaw#151388/openclaw#100024/openclaw#102745):
  unsupported runtimes error instead of code-point initials, skipped input yield,
  wall-clock timing, or approximate microtask paint. The human progress-card fix
  in openclaw#151386 keeps its browser yield and durable FIFO handoff unchanged.
- URL APIs disappearing after URL creation (openclaw#100024/openclaw#149330): supported browsers
  keep paired APIs. An unsupported replaced global can throw during cleanup;
  undefined URLs, creation fallback, cancellation and release ordering remain.
- Malformed internal MCP calls bypassing AppBridge (openclaw#161747): may throw. The SDK
  still rejects malformed wire blocks before dispatch, proved over real in-memory
  App/AppBridge transport. UI content, authority, confirmation and custody policy
  remain. The introducing PR cites no human incident for the second mirror.

Production: +176/-394, net -218 lines across 21 eligible old files. Tests: +30.
Focused owner/sibling tests, targeted types/lint/format, lint-suppression and
independent P0-P2 review pass. Import edges are unchanged; runtime/Madge cycle
proof remains zero. Whole-tree Knip timed out at existing limits; heavy gallery
renderer runs did not reach assertions, while its owning controller suite passed.

* refactor(ui): remove obsolete Fetch capability branch

The supported Control UI browser floor includes Fetch. Start attachment
metadata reads directly rather than leaving an unsupported runtime in a
permanent checking state.

Best-effort tradeoffs accepted

- Missing global Fetch: the guard originated in openclaw#64104, whose feature report
  cites no human missing-Fetch incident. An unsupported runtime that replaces
  Fetch now reaches the existing rejected-request/unavailable path. Metadata
  validation, auth/tickets, allow POST, cancellation, resource admission,
  expiry and bounded retry remain unchanged. No intended rendering change.

Unchanged lifecycle baseline: 21/21, 25.09 s. Final lifecycle and attachment
siblings: 50/50, 14.77 s. UI types, typed lint, formatting and lint-suppression
checks pass. This cut removes five production lines including formatter
reflow, bringing the lane to 223 net production lines removed.
Fresh independent P0-P2 review is scoped-clean with no actionable findings.

* fix(ui): use global frame scheduling APIs

Preserve double-frame paint timing and cancellation without requiring a Window object in renderer-free hosts that supply the standard global APIs. The existing access suite reproduces seven unhandled errors before this fix and passes on main; all 130 affected cases plus 262 timing/state/send sibling cases now pass without test changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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