fix(nextcloud-talk): strip internal tool-trace banners from outbound text#103355
fix(nextcloud-talk): strip internal tool-trace banners from outbound text#103355miorbnli wants to merge 2 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 10, 2026, 9:04 AM ET / 13:04 UTC. Summary PR surface: Source +2, Tests +41. Total +43 across 2 files. Reproducibility: yes. Current main lacks the optional hook, core's conditional call is explicit, merged sibling fixes establish the same failure mode, and exact-head terminal output demonstrates the corrected adapter result. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the channel-owned public SDK sanitizer hook and focused adapter tests, then refresh the branch onto current main and land after exact-head checks pass. Do we have a high-confidence way to reproduce the issue? Yes. Current main lacks the optional hook, core's conditional call is explicit, merged sibling fixes establish the same failure mode, and exact-head terminal output demonstrates the corrected adapter result. Is this the best way to solve the issue? Yes. Reusing the established public SDK sanitizer through the standard channel-owned outbound hook is narrower and more maintainable than new configuration, channel-local parsing, or a new global delivery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5a451f92f993. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +2, Tests +41. Total +43 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
…text The Nextcloud Talk outbound adapter had no sanitizeText hook, so internal assistant tool-trace scaffolding (e.g. "⚠️ 🛠️ `exec (agent)` failed", raw <tool_call>/<function_response> XML) leaked verbatim into delivered chat messages. The same one-line sanitizeText hook was already shipped to 13 sibling channels (mattermost openclaw#98693, feishu openclaw#98705, twitch openclaw#103109, signal openclaw#97360, slack openclaw#97367, matrix openclaw#97372, irc openclaw#97214, telegram, googlechat openclaw#90684, qqbot openclaw#90132, discord, whatsapp openclaw#71830, sms). Add sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text) to the outbound base adapter, matching those precedents. Co-Authored-By: Claude <[email protected]>
createChatChannelPlugin resolves the { base, attachedResults } outbound shape
into a flat ChannelOutboundAdapter (resolveChatChannelOutbound spreads base to
the top level), so the test must read outbound.sanitizeText directly, not
outbound.base.sanitizeText. The previous access failed check-test-types with
TS2339 (Property 'base' does not exist on type 'ChannelOutboundAdapter').
Co-Authored-By: Claude <[email protected]>
ac1e405 to
fad7fab
Compare
|
@clawsweeper re-review The PR body Evidence section has been updated with exact-head output from the patched adapter: the colocated test imports nextcloudTalkPlugin and asserts on nextcloudTalkPlugin.outbound.sanitizeText directly (the hook added by this PR). Branch rebased onto current main. Requesting a fresh review. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
Closing as a duplicate of #101712, now landed in The canonical fix covers both Nextcloud Talk delivery surfaces: the standard outbound adapter and the custom inbound reply path. It also preserves attachments/reply IDs, leaves low-level caller-authored text literal, and reports fully stripped internal-only replies as non-visible. Thank you @miorbnli — the useful regression coverage from this PR was folded into #101712, and your co-author credit is preserved in the landed commit alongside @Pick-cat. |
What Problem This Solves
The Nextcloud Talk outbound adapter had no
sanitizeTexthook. Core delivery (src/infra/outbound/deliver.ts:889-896) only runs the per-channel assistant-text sanitizer when the adapter provides one; without it, internal assistant tool-trace scaffolding is delivered verbatim to the chat. Users see raw banners like⚠️ 🛠️exec (agent)`` failedand raw<tool_call>`/`<function_response>` XML in their Nextcloud Talk messages.Why This Change Was Made
sanitizeTexthook that strips internal runtime scaffolding before delivery.sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text)to the outbound base adapter — the identical one-line hook already shipped to 13 sibling channels: mattermost (fix(mattermost): strip internal tool-trace banners from outbound text #98693), feishu (fix(feishu): strip internal tool-trace banners from outbound text #98705), twitch (fix(twitch): strip internal tool-trace banners from outbound text #103109), signal (fix(signal): sanitize internal tool-trace lines from outbound text #97360), slack (fix(slack): sanitize internal tool-trace lines from outbound text #97367), matrix (fix(matrix): sanitize internal tool-trace lines from outbound text #97372), irc (fix(irc): sanitize internal tool-trace lines from outbound text #97214), telegram, googlechat (Feishu (and non-Discord channels) should apply sanitizeAssistantVisibleText() on outbound text #90684), qqbot (fix(qqbot): sanitize outbound text to strip reasoning/thinking content #90132), discord, whatsapp (fix(whatsapp): sanitize tool XML and hide configured error text #71830), and sms.User Impact
Internal tool-trace banners and leaked XML scaffolding no longer reach Nextcloud Talk users. Ordinary assistant prose is preserved unchanged.
Linked context
N/A (no existing issue). Sibling fixes: #103109, #98693, #98705.
Evidence
Terminal capture of
node --import tsxruntime verification calling the patched adapter hooknextcloudTalkPlugin.outbound.sanitizeText(the exact hook added by this PR) on the exact PR head:This calls the real
nextcloudTalkPlugin.outbound.sanitizeText(resolved from{ base: { sanitizeText: ({ text }) => sanitizeAssistantVisibleText(text) } }viaresolveChatChannelOutbound), proving the patched Nextcloud Talk adapter routes assistant text through the sanitizer before delivery.node --import tsxscript that importsnextcloudTalkPluginand callsoutbound.sanitizeTextdirectly, plus colocated vitestnode scripts/run-vitest.mjs extensions/<channel>/src/outbound-tool-trace-sanitize.test.ts.Tests and validation
New
outbound-tool-trace-sanitize.test.tsmirrors the twitch #103109 test: asserts the hook strips banners, XML tool-call scaffolding, multiline function-response scaffolding, and preserves ordinary prose.Risk checklist
One concern, one PR — only the Nextcloud Talk outbound sanitizeText hook.
No config/env/default surface change.
No SDK/protocol/auth/provider behavior change (reuses an already-exported SDK helper).
Backward compatible — only internal scaffolding is removed; user-visible prose is unchanged.
No new deps (helper already in the SDK barrel).
No CHANGELOG edit (per release policy).
Tests added.
Allow edits by maintainers