Skip to content

fix(imessage): apply canonical outbound sanitizer#101430

Open
clawSean wants to merge 1 commit into
openclaw:mainfrom
clawSean:fix/imessage-sanitize-outbound-90684
Open

fix(imessage): apply canonical outbound sanitizer#101430
clawSean wants to merge 1 commit into
openclaw:mainfrom
clawSean:fix/imessage-sanitize-outbound-90684

Conversation

@clawSean

@clawSean clawSean commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

iMessage outbound cleanup used the internal-scaffolding sanitizer profile. That profile intentionally preserves some assistant-internal delivery artifacts, including downgraded tool-call text such as [Tool Call: …] blocks. Other messaging adapters already use the canonical delivery profile tracked by #90684.

Refs #90684.

Why This Change Was Made

This starts iMessage outbound cleanup with sanitizeAssistantVisibleText, then keeps the existing iMessage-specific separator and role-marker cleanup.

The change is deliberately channel-local:

  • no new config or shared delivery contract
  • no duplicate sanitizer pass
  • the same canonical delivery profile already used by merged sibling-channel fixes

User Impact

iMessage recipients no longer receive downgraded tool-call scaffolding that the old iMessage profile intentionally preserved. Ordinary assistant prose and the existing iMessage-specific cleanup remain unchanged.

Evidence

  • Exact head: e03f4b69fad3cf816947c457192e9126e6a45daa
  • Rebased base: 4d8e89fd5cc447da04ce5f0615a21cff7c491f51
  • git range-diff reports the single PR commit as patch-equivalent across the rebase.
  • The regression proves the material profile difference:
    • the internal-scaffolding profile preserves [Tool Call: …] downgraded text;
    • this PR's iMessage sanitizeText hook removes that block and preserves the visible answer.
  • Direct hook behavior:
input:  [Tool Call: read (ID: toolu_1)]
        Arguments: {"path":"/tmp/internal"}
        Done.
output: Done.
  • Focused current-head regression: vitest run extensions/imessage/src/outbound-tool-trace-sanitize.test.ts --config test/vitest/vitest.extension-imessage.config.ts — passed 2 tests.
  • Touched-file formatting passed.
  • git diff --check upstream/main...HEAD passed.
  • Prior redacted iMessage send/readback proof remains useful for confirming the adapter hook's output can be delivered unchanged over the iMessage service.
  • Hosted CI started on this exact head. The rebase picks up current main's workflow fixes for the prior branch-unrelated zizmor failure; hosted CI remains the canonical heavy validation lane.

AI-assisted change, manually reviewed and validated.

@openclaw-barnacle openclaw-barnacle Bot added channel: imessage Channel integration: imessage size: XS labels Jul 7, 2026
@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 25, 2026, 6:35 PM ET / 22:35 UTC.

ClawSweeper review

What this changes

The branch replaces iMessage’s internal-scaffolding cleanup with the shared assistant-visible delivery sanitizer and adds a regression test showing downgraded tool-call blocks are removed while ordinary prose remains unchanged.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for maintainer review. It is a focused iMessage message-delivery fix that reuses the established assistant-visible sanitizer, has regression coverage and recorded real-delivery proof, but intentionally changes what existing iMessage recipients see; a maintainer should accept that channel-level delivery policy before merge.

Priority: P1
Reviewed head: e03f4b69fad3cf816947c457192e9126e6a45daa
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, coherent channel-local patch with focused regression coverage and sufficient after-fix proof; it awaits a maintainer decision on the intentional delivery-filtering change.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body and review history provide redacted after-fix iMessage send/readback evidence plus exact-hook output showing internal tool-call text removed and ordinary prose preserved.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body and review history provide redacted after-fix iMessage send/readback evidence plus exact-hook output showing internal tool-call text removed and ordinary prose preserved.
Evidence reviewed 5 items PR implementation: The submitted diff changes the iMessage outbound sanitizer from the narrower internal-scaffolding profile to the existing canonical assistant-visible sanitizer, retaining the subsequent iMessage separator and role-marker cleanup.
Regression coverage: The added test exercises the production iMessage plugin outbound hook for both a downgraded tool-call block and ordinary assistant prose.
Sibling implementation precedent: Merged sibling fixes use the same shared sanitizer at their channel outbound boundaries, including Google Chat, Telegram, Slack, and Feishu; this PR keeps the change local to iMessage rather than introducing a competing sanitizer or config surface.
Findings None None.
Security None None.

How this fits together

OpenClaw’s shared outbound delivery flow calls each channel plugin’s text-sanitizing hook before the channel sends a message. The iMessage plugin’s hook removes internal assistant artifacts, then hands the cleaned text to iMessage-specific delivery code.

flowchart LR
  A[Assistant reply text] --> B[Shared outbound delivery]
  B --> C[iMessage sanitizer hook]
  C --> D[Assistant-visible sanitizer]
  D --> E[iMessage-specific cleanup]
  E --> F[iMessage recipient]
  G[Regression test] --> C
Loading

Decision needed

Question Recommendation
Should iMessage adopt the same assistant-visible outbound filtering policy already used by sibling channels, accepting removal of text classified as internal scaffolding? Accept sibling-channel parity: Approve the iMessage-local canonical sanitizer after refreshing the merge result, so iMessage recipients no longer receive internal tool-call scaffolding.

Why: The patch is mechanically narrow and follows established sibling patterns, but the remaining decision is whether the channel should intentionally suppress this broader class of user-visible text.

Before merge

  • Resolve merge risk (P1) - This changes iMessage’s existing outbound filtering semantics: messages containing text recognized as assistant-internal scaffolding will now be removed before delivery, so maintainers should explicitly accept the same over-stripping tradeoff already accepted for sibling channels.
  • Resolve merge risk (P1) - The PR is behind current main; refresh the three-way merge and focused iMessage verification against the current base before landing, without assuming base drift itself removes behavior.
Agent review details

Security

None.

PR surface

Source 0, Tests +23. Total +23 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 1 23 0 +23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 25 2 +23

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #90684
Summary: This PR is a channel-specific candidate fix for the open outbound-sanitization umbrella; merged sibling channel fixes support the shared root cause but do not implement iMessage.

Members:

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

Merge-risk options

Maintainer options:

  1. Refresh and accept channel parity (recommended)
    Rebase or otherwise validate the exact merge result on current main, then merge the focused iMessage alignment if maintainers accept the established sanitizer policy.
  2. Defer to a shared outbound policy
    Pause this PR if maintainers prefer to decide all remaining channel sanitizer slices together rather than landing another channel-local adoption.

Technical review

Best possible solution:

Rebase or refresh the exact merge result against current main, retain the channel-local use of the canonical sanitizer, and land once the responsible maintainer accepts the user-visible message-delivery policy.

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

Yes from source and the supplied proof: the iMessage outbound hook currently uses the narrower internal-scaffolding profile, while the PR’s focused test demonstrates the preserved downgraded tool-call form and the proposed after-fix output.

Is this the best way to solve the issue?

Yes. Reusing the existing shared assistant-visible sanitizer at iMessage’s outbound hook is narrower and safer than adding channel-specific regexes or a new configuration surface; the remaining question is deliberate delivery-policy acceptance, not implementation shape.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 667abb18a140.

Labels

Label justifications:

  • P1: The patch addresses user-visible leakage of assistant-internal content in a live messaging channel.
  • merge-risk: 🚨 message-delivery: Merging changes the outbound text transformation applied to existing iMessage deliveries.
  • 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 (live_output): The PR body and review history provide redacted after-fix iMessage send/readback evidence plus exact-hook output showing internal tool-call text removed and ordinary prose preserved.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and review history provide redacted after-fix iMessage send/readback evidence plus exact-hook output showing internal tool-call text removed and ordinary prose preserved.

Evidence

What I checked:

  • PR implementation: The submitted diff changes the iMessage outbound sanitizer from the narrower internal-scaffolding profile to the existing canonical assistant-visible sanitizer, retaining the subsequent iMessage separator and role-marker cleanup. (extensions/imessage/src/monitor/sanitize-outbound.ts:24, e03f4b69fad3)
  • Regression coverage: The added test exercises the production iMessage plugin outbound hook for both a downgraded tool-call block and ordinary assistant prose. (extensions/imessage/src/outbound-tool-trace-sanitize.test.ts:7, e03f4b69fad3)
  • Sibling implementation precedent: Merged sibling fixes use the same shared sanitizer at their channel outbound boundaries, including Google Chat, Telegram, Slack, and Feishu; this PR keeps the change local to iMessage rather than introducing a competing sanitizer or config surface. (extensions/imessage/src/monitor/sanitize-outbound.ts:1, 696c62400803)
  • iMessage feature provenance: The existing iMessage outbound cleanup and role-marker behavior were recently maintained by the merged iMessage fix, providing an adjacent owner and confirming this file is the channel-local delivery boundary. (extensions/imessage/src/monitor/sanitize-outbound.ts:1, 770b19f496c1)
  • Real behavior proof and checks: The PR discussion records redacted iMessage send/readback proof, exact-head hook output, focused regression success, and a completed hosted proof check; the supplied current check state is green except for a non-final lint job. (e03f4b69fad3)

Likely related people:

  • ly-wang19: Authored the merged iMessage outbound-cleanup correction in the same sanitizer module, making them the strongest repository-history routing candidate for this channel-local behavior. (role: recent iMessage delivery-path contributor; confidence: high; commits: 770b19f496c1; files: extensions/imessage/src/monitor/sanitize-outbound.ts)
  • jailbirt: Authored the merged Google Chat sanitizer composition that established the same channel-local use of the shared assistant-visible sanitizer. (role: sibling channel sanitizer contributor; confidence: medium; commits: 696c62400803; files: extensions/googlechat/src/channel.ts)

Rank-up moves

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

  • Refresh the exact merge result against current main and have the iMessage/channel owner accept the message-delivery policy.

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 (8 earlier review cycles)
  • reviewed 2026-07-07T07:03:32.599Z sha 85a9727 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-07T07:11:03.692Z sha 85a9727 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-08T02:30:16.807Z sha cdef8c6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T23:00:27.658Z sha 175b832 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T23:07:16.660Z sha 175b832 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T23:15:05.662Z sha 175b832 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T03:01:23.266Z sha 2fd2b36 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T03:09:18.126Z sha 2fd2b36 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels Jul 7, 2026
@clawSean
clawSean force-pushed the fix/imessage-sanitize-outbound-90684 branch from 85a9727 to cdef8c6 Compare July 8, 2026 02:17
@clawSean

clawSean commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased onto current main (head cdef8c6101), focused tests 14/14, full pre-PR gate green including check:changed. The requested redacted real iMessage delivery proof has been added to the PR body: patched outbound.sanitizeText executed at the PR head, sanitized output delivered over a real iMessage send (service confirmed iMessage in the device's Messages store), tool-trace banner removed, ordinary prose preserved verbatim.

@clawsweeper

clawsweeper Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 8, 2026
@clawSean
clawSean force-pushed the fix/imessage-sanitize-outbound-90684 branch 2 times, most recently from 175b832 to 2fd2b36 Compare July 9, 2026 02:45
@clawSean

clawSean commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Updated proof for current head 2fd2b36b49.

Evidence in the PR body now covers:

  • base-only rebase onto upstream main 30b3a7cded
  • iMessage touched files unchanged from the live-proofed head cdef8c6101
  • focused tests: 2 files / 14 tests passed
  • git diff --check origin/main...HEAD clean
  • known gap: full local pre-PR wrapper was not rerun for this patch-identical refresh; GitHub CI is rerunning the full exact-head matrix

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 23, 2026
@clawSean

Copy link
Copy Markdown
Contributor Author

Still active and ready for maintainer review on exact head 2fd2b36b4903. All 73 hosted checks are green, ClawSweeper marks proof sufficient / patch quality platinum, and the PR includes redacted real iMessage delivery proof. The remaining step is maintainer review; no contributor repair is outstanding. Please keep this open.

@clawSean
clawSean force-pushed the fix/imessage-sanitize-outbound-90684 branch from 2fd2b36 to 164ab9e Compare July 24, 2026 04:22
@clawSean clawSean changed the title fix(imessage): sanitize outbound tool traces fix(imessage): apply canonical outbound sanitizer Jul 24, 2026
@clawSean

Copy link
Copy Markdown
Contributor Author

Refreshed for maintainer review on exact head 164ab9e2bbe.

The prior headline example was not a discriminating regression: current iMessage cleanup already strips that compact warning-line form. This update fixes the proof and framing around the real delta:

  • current main's internal-scaffolding profile intentionally preserves downgraded [Tool Call: …] text
  • this PR now applies the canonical delivery profile once, then retains iMessage-specific cleanup
  • the focused regression proves that previously preserved block is removed while visible prose survives
  • full exact-head contributor pre-PR gate passed; fresh hosted CI is running

This remains an XS, channel-local patch with no config or shared-contract change. The only remaining question is whether to land the focused iMessage alignment now or hold all remaining channel slices for a future shared-default design.

@steipete could you make that maintainer call when convenient?

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawSean

Copy link
Copy Markdown
Contributor Author

CI note for exact head 164ab9e2bbe: the sole completed failure is Workflow Sanity / actionlint, reporting zizmor findings in untouched .github/workflows/* files. Current main is failing the same Workflow Sanity check, so this is not introduced by the iMessage diff. The contributor pre-PR gate, including touched-file lint/type checks, is green.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jul 24, 2026
@clawSean
clawSean force-pushed the fix/imessage-sanitize-outbound-90684 branch from 164ab9e to e03f4b6 Compare July 25, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: imessage Channel integration: imessage merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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