Skip to content

refactor(apple): share native chat payload normalization - #129113

Merged
steipete merged 1 commit into
mainfrom
cleanup/apps-chat-value-normalization
Aug 25, 2026
Merged

steipete merged 1 commit into
mainfrom
cleanup/apps-chat-value-normalization

Conversation

@steipete

@steipete steipete commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Native chat event processing independently owned four equivalent string-normalization helpers. Each trimmed whitespacesAndNewlines and converted nil or empty results to nil, leaving identical behavior duplicated across event text, subagent activity, and two Swarm paths.

Why This Change Was Made

This moves the shared internal contract to ChatPayloadDecoding.trimmedNonEmptyString and removes the four private implementations. It deliberately excludes outbound request normalization and session/sidebar normalization because those ownership paths are under active PRs #112004, #112227, and #128286.

Rejected alternatives: a new utility file would add a source path and project-metadata burden; a module-wide generic String extension would broaden the API surface beyond this payload boundary.

Production LOC: +30/-39 (net -9) | Tests: +0/-0

User Impact

No user-visible behavior or compatibility change. Native chat payload normalization now has one owner instead of four, reducing future drift risk.

Evidence

Exact head: 9bac5c66ec55e80cd7efb329e325244728b5b6d0

  • node scripts/check-changed.mjs -- apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatPayloadDecoding.swift apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatSubagentActivity.swift apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatEventText.swift apps/shared/OpenClawKit/Sources/OpenClawChatUI/Swarm.swift — passed all guards and 7 routed Vitest shards (357 passed, 131 skipped).
  • git diff --check origin/main...HEAD — passed.
  • Deslop: clean; no comments, defensive branches, type laundering, compatibility shims, or style drift introduced.
  • Structured autoreview (.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main) — clean, no accepted/actionable findings.
  • Separate exact-head read-only Codex review — clean, no concrete P0–P2 findings; the shared payload owner is the narrowest behavior-neutral fix.
  • Exact-head hosted CI run 32831487295 — passed, including macos-swift (Swift compilation/format/lint), ios-build, both iOS screenshot jobs, and openclaw/ci-gate.

@clawsweeper

clawsweeper Bot commented Aug 25, 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 size: S maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 5:27 AM ET / 09:27 UTC.

ClawSweeper review

What this changes

The PR moves four equivalent native-chat string normalizers into ChatPayloadDecoding for event text, task activity, and Swarm state.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open for maintainer review: the refactor creates one private payload-normalization owner without changing the four callers’ semantics, and current main still has the duplicate local helpers. No actionable patch defect was found; exact-head native CI is still pending.

Priority: P3
Reviewed head: 9bac5c66ec55e80cd7efb329e325244728b5b6d0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused, source-equivalent consolidation with no identified correctness or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal refactor is exempt from the contributor real-behavior-proof gate; exact-head native CI remains the relevant merge validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal refactor is exempt from the contributor real-behavior-proof gate; exact-head native CI remains the relevant merge validation.
Evidence reviewed 5 items Shared normalization owner: The new helper trims whitespace/newlines and returns nil for absent or empty input, matching the removed local helper contracts.
Caller equivalence: Assistant-text extraction, subagent activity, and Swarm paths now call the same private helper at their prior normalization boundaries.
Existing behavior coverage: Existing owner tests cover assistant event text, subagent activity retention, and Swarm activity projection; this behavior-preserving refactor adds no test-only seam.
Findings None None.
Security None None.

Live Verification

Command: pnpm ios:build

Result: FAIL (partial) — step 2 expect_output BUILD SUCCEEDED: expected terminal output was not visible within 30 seconds: "BUILD SUCCEEDED"

pnpm ios:buildrunner@runnervm76f27:/tmp/clawsweeper-live-proof-129113-HP6i8v/target$ pnpm ios:build
$ bash -c 'export PATH="$PATH:/opt/homebrew/bin:/usr/local/bin"; ./scripts/ios-configure-signing.sh && ./scripts/ios-write-version-xcconfig.sh && node scripts/i
os-write-swift-filelist.mjs && cd apps/ios && xcodegen generate && xcodebuild -project OpenClaw.xcodeproj -scheme OpenClaw -destination "${IOS_DEST:-generic/pla
tform=iOS Simulator}" -configuration Debug build'
WARN: Unable to detect an Apple Team ID; keeping existing iOS signing override (if any).
Prepared iOS version settings: ios=2026.8.1 marketing=2026.8.1 build=1 commit=9bac5c66ec55e80cd7efb329e325244728b5b6d0 built=2026-08-25T09:27:58.000Z
Prepared iOS Swift file list: apps/ios/SwiftSources.input.xcfilelist
bash: line 1: xcodegen: command not found
[ELIFECYCLE] Command failed.
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129113-HP6i8v/target$ pnpm ios:build
$ bash -c 'export PATH="$PATH:/opt/homebrew/bin:/usr/local/bin"; ./scripts/ios-configure-signing.sh && ./scripts/ios-write-version-xcconfig.sh && node scripts/i
os-write-swift-filelist.mjs && cd apps/ios && xcodegen generate && xcodebuild -project OpenClaw.xcodeproj -scheme OpenClaw -destination "${IOS_DEST:-generic/pla
tform=iOS Simulator}" -configuration Debug build'
WARN: Unable to detect an Apple Team ID; keeping existing iOS signing override (if any).
Prepared iOS version settings: ios=2026.8.1 marketing=2026.8.1 build=1 commit=9bac5c66ec55e80cd7efb329e325244728b5b6d0 built=2026-08-25T09:27:59.000Z
Prepared iOS Swift file list: apps/ios/SwiftSources.input.xcfilelist
bash: line 1: xcodegen: command not found
[ELIFECYCLE] Command failed.
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129113-HP6i8v/target$
































Assertions:

  • FAIL expect_output: BUILD SUCCEEDED

How this fits together

Incoming native-chat events and task/Swarm snapshots are decoded into Apple chat state. This normalization feeds assistant-text extraction and the activity projections rendered by native clients.

flowchart LR
A[Gateway chat and task payloads] --> B[Native chat payload decoding]
B --> C[Trim empty values]
C --> D[Assistant text extraction]
C --> E[Subagent activity state]
C --> F[Swarm activity state]
D --> G[Native chat display]
E --> G
F --> G
Loading

Before merge

  • Resolve merge risk (P1) - The exact-head ios-build and macos-swift checks are still pending, so native compilation and lint validation should complete before merge.
Agent review details

Security

None.

PR surface

Other -9. Total -9 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 30 39 -9
Total 4 30 39 -9

Review metrics

Metric Value Why it matters
Production versus test delta production +30/-39 (net -9); tests unchanged The refactor removes duplicated production logic while adding no test-only surface.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the normalization private to payload decoding and merge once the exact-head Apple native checks confirm compilation and linting.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the normalization private to payload decoding and merge once the exact-head Apple native checks confirm compilation and linting.

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

Not applicable: this is a behavior-preserving refactor, and source comparison establishes the relevant normalization equivalence.

Is this the best way to solve the issue?

Yes: a private helper on the existing payload-decoding owner removes duplication without expanding a generic String API or crossing a product boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6fb330349200.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P3: This is a behavior-neutral internal cleanup with no reported user-facing 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: This maintainer-authored internal refactor is exempt from the contributor real-behavior-proof gate; exact-head native CI remains the relevant merge validation.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main history credits Peter Steinberger for the native-chat restoration and the subagent-activity refactor that own the affected call paths. (role: recent native-chat and task-activity contributor; confidence: high; commits: d4fd9cc96a71, 73ae58326326; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatEventText.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatSubagentActivity.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/Swarm.swift)

Rank-up moves

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

  • Let the exact-head ios-build and macos-swift checks complete successfully before merge.

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 (2 earlier review cycles)
  • reviewed 2026-08-25T07:39:22.174Z sha 9bac5c6 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T07:59:21.323Z sha 9bac5c6 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 25, 2026
@steipete
steipete marked this pull request as ready for review August 25, 2026 09:21
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Independent landing verification is clean at exact head 9bac5c66ec55e80cd7efb329e325244728b5b6d0.

  • Local changed-file proof passed all guards and 7 routed Vitest shards: 357 passed, 131 skipped.
  • git diff --check, deslop, structured autoreview, and a separate exact-head read-only Codex review are clean; no findings required changes.
  • Hosted CI run 32831487295 passed on the exact head, including macos-swift, ios-build, both iOS screenshot jobs, and openclaw/ci-gate.
  • ClawSweeper found no source or security finding; its requested native rank-up proof is now satisfied by that exact-head Apple run.

No proof gaps remain for this behavior-neutral internal refactor; proceeding through the repository-native prepare/merge gates.

@steipete
steipete merged commit 7a5de93 into main Aug 25, 2026
150 of 151 checks passed
@steipete
steipete deleted the cleanup/apps-chat-value-normalization branch August 25, 2026 09:54

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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