fix(nostr): strip internal tool-trace banners from outbound text#103361
fix(nostr): strip internal tool-trace banners from outbound text#103361miorbnli wants to merge 4 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 19, 2026, 7:24 AM ET / 11:24 UTC. Summary PR surface: Source +10, Tests +106. Total +116 across 3 files. Reproducibility: yes. at source level: the standard adapter and direct inbound-DM callback are separate Nostr delivery paths, and the branch’s focused regressions exercise both with mixed and trace-only text. The supplied PR evidence also reports a successful exact-head runtime verification. 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. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Select this mergeable, proof-backed branch as the canonical Nostr fix, preserve its shared-adapter and direct-reply coverage, then close the overlapping dirty PR rather than landing both variants. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the standard adapter and direct inbound-DM callback are separate Nostr delivery paths, and the branch’s focused regressions exercise both with mixed and trace-only text. The supplied PR evidence also reports a successful exact-head runtime verification. Is this the best way to solve the issue? Unclear pending canonicalization: this is a narrow, maintainable fix that uses the existing shared sanitizer, but maintainers should select it or the overlapping implementation rather than merge both. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c95a8e3df1e6. Label changesLabel justifications:
Evidence reviewedPR surface: Source +10, Tests +106. Total +116 across 3 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
Review history (8 earlier review cycles)
|
a28fffb to
e143dd3
Compare
|
@clawsweeper re-review PR body Evidence updated with exact-head terminal output from the patched adapter/function hook (real runtime verification, not a shared helper). Branch rebased onto current main. Requesting fresh review. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
43283b4 to
1b7189e
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
1b7189e to
d73cfd0
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
d73cfd0 to
08cbd5b
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4b278f0 to
4947413
Compare
|
@clawsweeper re-review Rebased exact head: The rebase preserves current Nostr ingress lifecycle/dispatcher contracts and the exact-head CI is green: https://github.com/openclaw/openclaw/actions/runs/29684297405 |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
The Nostr 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 Nostr DMs. The same one-line sanitizeText hook was already shipped to 13 sibling channels (twitch openclaw#103109, mattermost openclaw#98693, feishu openclaw#98705, 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 to the NostrOutboundAdapter type and adapter, matching those precedents. Co-Authored-By: Claude <[email protected]>
The gateway inbound reply path (the deliver callback in startNostrGatewayAccount) calls reply() directly with the assistant text, bypassing nostrOutboundAdapter's sanitizeText hook. Internal tool-trace scaffolding therefore still leaked into Nostr DMs via replies even with the adapter hook in place. Apply sanitizeAssistantVisibleText in the deliver callback too, matching the adapter hook, so both the outbound adapter path and the gateway reply path strip internal scaffolding before delivery. Co-Authored-By: Claude <[email protected]>
4947413 to
fd575c0
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(nostr): strip internal tool-trace banners from outbound text This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
What Problem This Solves
Nostr direct messages could expose internal assistant tool-failure banners and tool-call XML instead of sending only user-visible reply text.
Related: #90684
Why This Change Was Made
Nostr opts into the shared assistant-visible-text sanitizer through its standard outbound adapter hook. Its inbound DM reply callback also applies the same sanitizer because it delivers directly through the Nostr bus and bypasses the core outbound adapter pipeline.
The narrowed Nostr adapter type requires the sanitizer hook, preventing a later adapter refactor from silently dropping this delivery invariant while still type-checking. The direct callback suppresses trace-only output before Markdown conversion and relay delivery.
This rebase preserves current main's Nostr ingress architecture:
runPassiveAccountLifecycle,dispatchInboundDirectDm, and its ingress lifecycle handoff remain intact. It does not restore the retired runtime dispatcher path.User Impact
Nostr recipients see intended assistant prose without internal tool traces or XML scaffolding. Ordinary prose remains unchanged, and a reply containing only internal trace content does not produce an empty DM.
Evidence
4947413d6f0e713700156323ec57948e4d0d563e.Risk checklist