Skip to content

fix(channels): keep message and voice content out of diagnostics - #172944

Merged
steipete merged 2 commits into
mainfrom
deslop/y14-ext-channels-a-20261015
Oct 15, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/y14-ext-channels-a-20261015

Conversation

@steipete

@steipete steipete commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes message and voice content appearing in channel diagnostics when verbose logging is enabled.

User Impact

Discord, Telegram, and Matrix keep message, reply, reaction, and voice content available to agents without copying it into routine diagnostics. Routing metadata and character counts remain. Telegram raw-update diagnostics redact all string values, including newly introduced API fields; their bounded numeric/boolean structure and permitted identifiers remain available. No configuration, SDK, persisted-data, delivery, or authorization contract changes.

Why This Change Was Made

The channel handlers still formatted inbound previews and interaction/system-event text for logs. Discord voice also formatted transcript, delegated-question, and answer excerpts. Those are content disclosures regardless of truncation. Telegram's raw-update field-name blacklist additionally missed string fields such as forwarded sender names and sticker emoji. Removing previews and defaulting unknown strings to redacted keeps diagnostic metadata without depending on an exhaustive content-field list.

This is the coherent bug-fix exception to the wave-5 cleanup size threshold, not a quota cleanup PR. Separate media, CLI, and pinned-dependency consolidations are excluded.

Best-effort tradeoffs accepted

None of the campaign's speculative concurrency guards are removed. The obsolete voice-preview formatter and its formatter-only tests disappear because logging message excerpts is the defect. Telegram no longer logs arbitrary unknown string fields; use the update shape and existing numeric/boolean metadata for diagnosis rather than content excerpts.

Evidence

Independent review found no actionable defect in this privacy packet. One finding concerned a separate, excluded Matrix cleanup; source inspection showed its load path already parses fresh JSON bytes, so that finding was declined. The privacy changes are unchanged from the reviewed snapshot.

Formatting, diff whitespace checks, and the required lint-suppression tests passed (3/3 tests; 201.06 seconds overall on the loaded host). Regression fixtures assert actual agent/system-event payloads still contain synthetic probes while logs do not. No live channel or live state was accessed. Pre-fix runnable regression proof is not yet available; the original content-bearing log statements are visible in the diff.

Runtime-value and madge cycle checks both passed with zero cycles. The original local focused runner spent 693.6 seconds preparing its compiled-worker prerequisite, then made no test progress for ten minutes; it was cancelled with no test verdict. Combined local changed checks were also cancelled after 34 minutes during the SQLite worker ratchet, with no verdict on that ratchet. Local changed checks passed conflict markers, line-cap growth, and the max-lines ratchet. The separate environment-variable subcheck fails at 455 names versus budget 454 on both the untouched branch base and pinned main a065e6a28257fc4ec6735a11f177ab0def2b9cb8, using the existing counting owner against committed trees. This PR adds no environment-variable names and does not widen the budget. An assertion-baseline shrink requested by the separate, excluded cleanup is applied only to that uncommitted cleanup.

Initial exact-head CI run 38705810716 completed with two PR-caused test failures: checks-node-changed-1 retained an obsolete test that required the removed transcript preview; checks-node-changed-extensions-bundle-1-1 found the new batch privacy fixture never reached agent dispatch because it omitted speaker authorization. The aggregate openclaw/ci-gate failed downstream. Neither failure is attributed to main. The obsolete preview-only test is removed. An independently reviewed fixture repair authorized the synthetic speaker, but its focused local replay produced no executed case in ten minutes. Per the campaign's inconclusive-replay rule, the entire new voice-logging.test.ts addition is dropped instead of waiting for capacity. The remaining 27 voice runtime cases, including agent payload and playback behavior, stay unchanged and passed on the initial privacy production head. There is no claim of new voice-logging regression proof. Production privacy code and authorization are unchanged by this test-only follow-up.

Fresh scoped repair review completed with no accepted/actionable P1-or-higher findings; the new test was subsequently dropped under the explicit campaign rule. The pre-push suppression replay passed 3/3 (123.49 seconds shard wall time; 83.66 seconds Vitest duration). Telegram's new context/reaction/raw-update privacy assertions passed on the initial head, as did hosted type and lint jobs; those results remain prior-head evidence after the test-only follow-up. The two initial failing CI job steps took 499.53 and 519.25 seconds respectively; bundled execution does not expose independent wall times for every changed test file.

The exact-head census also found three cancelled ancillary checks: PR context and evidence completed its actual evidence step successfully before run cancellation; two auto-response jobs had zero steps and provide no proof. They are not called inherited failures or passing tests. No CI job was rerun.

Exact follow-up head ea07ba8b16ccb9b76540c201b0f3b173eabd31f3 passed hosted CI run 38709370229, including the repaired voice runtime suite, extension bundles, production/test types, lint, architecture, source contracts, QA smoke, and baseline ratchets. openclaw/ci-gate completed successfully. The complete exact-head census contained 112 checks with no failed checks. One ancillary ClawSweeper dispatch check was cancelled after both actual dispatch steps and all other executed steps completed successfully; it is not a test suite or additional passing test proof. No CI reruns were requested.

Net production LOC: 43 removed (+17/-60), excluding tests and fixtures. The unrelated cleanup remains outside this PR.

@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 15, 2026 08:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T09:00:03.919210Z ea07ba8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: matrix Channel integration: matrix channel: telegram Channel integration: telegram size: M labels Oct 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR replaces channel message and voice excerpts with diagnostic metadata and redacts all Telegram raw-update string values.

Example: Telegram receives a forwarded message whose sender_user_name is "private forward sender".

  • Before: Raw-update diagnostics retain that sender name because its field is absent from the redaction blacklist.
  • After: The diagnostic value becomes "[redacted]", while the agent retains the forwarded context.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The privacy direction is useful and focused, but an existing test contradicts the new output and changed-behavior execution has not been demonstrated.
Proof confidence 🦪 silver shellfish (2/6) The supplied maintainer classification exempts this PR from ordinary contributor proof requirements; its complete body reports synthetic regression fixtures and unrelated lint-test results, with changed-boundary execution still pending and no live-channel capture.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Private messages, forwarded names, reactions, and voice conversations can appear in channel diagnostics.
Reason: The maintainer-authored direction matches the existing no-content logging contract and explicitly accepts losing arbitrary Telegram string diagnostics.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: it addresses diagnostic-content leaks still present on main, but leaves an existing Matrix test requiring the removed preview.

Priority: P2
Reviewed head: 36465651b17981b5528853104ae30ab000d70fd4

Before merge

  • Update the existing Matrix preview regression for content-free logs (P2) - Changing this line leaves handler.test.ts's keeps inbound log previews UTF-16 well-formed at the limit test expecting the old preview="..." output. Its input of 199 x characters followed by 🚀tail now produces chars=205, so the exact toHaveBeenCalledWith assertion at line 405 cannot pass. Replace that obsolete preview assertion with the metadata-only privacy contract, consolidating it with the new Matrix privacy case where appropriate; retain the content removal.

Findings

  • [P2] Update the existing Matrix preview regression for content-free logs — extensions/matrix/src/matrix/monitor/handler-context.ts:288

Tests

  • Missing end-to-end proof: The supplied evidence contains no executed base-fail/head-pass privacy regression or shipped-entry-point diagnostic capture; the ordinary external-contributor proof gate does not apply to this maintainer-authored PR.
Agent review details

How this fits together

Discord, Telegram, and Matrix plugins prepare incoming content for agents and system events while emitting separate Gateway diagnostics.

flowchart LR
  A[Channel updates and voice] --> B[Plugin context owners]
  B --> C[Agent payloads and system events]
  B --> D[Metadata diagnostics]
  A --> E[Telegram raw update formatter]
  E --> D
  D --> F[Gateway logging]
Loading

Technical review

Best possible solution:

Preserve the metadata-only diagnostics and replace the obsolete Matrix preview assertion with the privacy contract.

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

Current-main source directly logs message previews, voice excerpts, and unknown Telegram string values; inspection also establishes the incompatible Matrix test expectation without executing target code.

Is this the best way to solve the issue?

Removing content at the logging source follows the documented privacy contract, preserves processing owners, and avoids an exhaustive blacklist for future Telegram string fields.

Full review comments:

  • [P2] Update the existing Matrix preview regression for content-free logs — extensions/matrix/src/matrix/monitor/handler-context.ts:288
    Changing this line leaves handler.test.ts's keeps inbound log previews UTF-16 well-formed at the limit test expecting the old preview="..." output. Its input of 199 x characters followed by 🚀tail now produces chars=205, so the exact toHaveBeenCalledWith assertion at line 405 cannot pass. Replace that obsolete preview assertion with the metadata-only privacy contract, consolidating it with the new Matrix privacy case where appropriate; retain the content removal.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 774f7eda88ba.

Provenance checked

  • Inbound message previews changes intended behavior with a stated reason (fix(channels): keep inbound log previews UTF-16 safe #102407: Earlier work preserved preview limits while making truncation UTF-16 safe; subsequent channel refactors carried the logging forward, and the current body explains why content previews should now disappear.)
  • Telegram raw-update formatting changes intended behavior with a stated reason (74949ed: fix(telegram): redact raw update logs #82945 introduced field-based privacy redaction while retaining bounded diagnostic structure; this PR explains the uncovered string fields and intentionally broadens redaction.)
  • Discord voice excerpts and preview formatter changes intended behavior with a stated reason (3683559: The earlier commit added voice transcript logging; 5fbb5f7 shared preview formatting and later work made truncation safe. This PR explicitly identifies those excerpts as the privacy defect.)
  • Interaction and reaction event diagnostics changes intended behavior with a stated reason (refactor(telegram): consolidate bot handlers into named modules #122174: Telegram's coordinator refactor preserved event processing and diagnostics; refactor(discord): consolidate shared transport and lifecycle paths #166626 similarly consolidated Discord controls. This PR retains event payloads while intentionally omitting their text from logs; these refactors do not establish the original logging introduction.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit a0cd0b8 adds extensions/discord/src/voice/log-preview.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a0cd0b81391c; files: extensions/discord/src/voice/log-preview.ts)
  • Galin Iliev: Raw commit 74949ed adds extensions/telegram/src/raw-update-log.ts:4 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 74949eda2f72; files: extensions/telegram/src/raw-update-log.ts)

PR surface

Source -43, Tests +124. Total +81 across 19 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 11 17 60 -43
Tests 8 148 24 +124
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 19 165 84 +81

Review metrics

Metric Value Why it matters
Production versus test LOC Production +17/-60; tests +148/-24 Production shrinks by removing content previews; test growth covers retained agent content and omitted diagnostics across separate channel owners.

Labels

Label changes:

  • add P2: The change repairs concrete diagnostic privacy leaks, with no evidence of an urgent widespread incident.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The change repairs concrete diagnostic privacy leaks, with no evidence of an urgent widespread incident.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 15, 2026, 4:44 AM ET / 08:44 UTC.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea07ba8b16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


const preview = truncateUtf16Safe(bodyText, 200).replace(/\n/g, "\\n");
logVerboseMessage(`matrix inbound: room=${roomId} from=${senderId} preview="${preview}"`);
logVerboseMessage(`matrix inbound: room=${roomId} from=${senderId} chars=${bodyText.length}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the stale Matrix preview assertion

When the Matrix monitor test suite runs, the existing keeps inbound log previews UTF-16 well-formed at the limit case in handler.test.ts still requires the old exact preview="..." log message, so this new chars= output deterministically fails that test. Replace or remove the obsolete preview assertion while retaining coverage that inbound content stays out of diagnostics.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 912a3e0 into main Oct 15, 2026
123 of 124 checks passed
@steipete
steipete deleted the deslop/y14-ext-channels-a-20261015 branch October 15, 2026 09:56
@steipete

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

channel: discord Channel integration: discord channel: matrix Channel integration: matrix channel: telegram Channel integration: telegram P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant