openclaw - ✅(Solved) Fix Telegram surface leaks assistant pre-tool scratch/commentary into user-visible chat [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#66161Fetched 2026-04-14 05:38:58
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

On Telegram, assistant pre-tool scratch/commentary text is sometimes being delivered to the user as normal chat messages instead of remaining internal.

Root Cause

  • leaks low-value internal scratch text into the user conversation
  • degrades trust / polish
  • can expose implementation chatter that should stay hidden
  • repeated even after changing assistant behavior, which suggests a surface/runtime handling issue rather than only prompting style

Fix Action

Fix / Workaround

Notes

The safest behavioral workaround is to avoid emitting any pre-tool chatter at all, but that only masks the issue. The platform should not surface this class of internal assistant text to end users.

PR fix notes

PR #66188: fix(channels): prevent internal assistant scratch messages from leaking to Telegram

Description (problem / solution / changelog)

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: The Telegram integration was treating all assistant messages as user-facing, causing internal scratch/commentary text to leak into the user chat.
  • Why it matters: Leaking internal implementation chatter degrades user trust, clutters the conversation, and exposes details that should remain hidden.
  • What changed: Added a message filter in src/channels/telegram.ts to suppress messages tagged with internal types (e.g., 'scratch', 'thinking', 'commentary') before they are sent to the user.
  • What did NOT change (scope boundary): Core assistant logic, message generation pipeline, or other channel integrations remain untouched.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #66161

User-visible / Behavior Changes

Users on Telegram will no longer see short, internal-looking scratch notes or commentary (e.g., "Need add hasLoadedChildren maybe."). Only final, user-facing responses will be delivered to the chat.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: N/A (AI-generated)
  • Runtime/container: N/A
  • Model/provider: N/A
  • Integration/channel (if any): Telegram
  • Relevant config (redacted): N/A

Steps

  1. Initiate a Telegram chat session that triggers tool use.
  2. Observe the messages received by the user.
  3. Verify that messages marked as 'internal', 'scratch', or 'thinking' do not appear in the Telegram chat.
  4. Verify that standard user-facing messages continue to appear normally.

Expected

Internal scratch/commentary messages are suppressed; only final responses are visible.

Actual

Internal messages are filtered out via the INTERNAL_MESSAGE_TYPES check in sendMessage.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: Code logic review confirms the filter implementation matches the issue requirements.
  • Edge cases checked: The INTERNAL_MESSAGE_TYPES set covers the specific types mentioned in the issue (scratch, commentary).
  • What you did not verify: Runtime execution in a live Telegram environment or full integration test suite run.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps: N/A

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert the commit modifying src/channels/telegram.ts.
  • Files/config to restore: src/channels/telegram.ts
  • Known bad symptoms reviewers should watch for: If the filter is too broad, legitimate user messages might be suppressed. If the filter is too narrow, some internal messages might still leak.

Risks and Mitigations

Risk: The filter relies on the type property being correctly set by upstream systems. If upstream systems fail to tag internal messages, they may still leak. Conversely, if user-facing messages are accidentally tagged as 'internal', they will be hidden. Mitigation: Ensure the INTERNAL_MESSAGE_TYPES list is comprehensive and aligns with the actual types emitted by the assistant runtime.

--- END TEMPLATE

Changed files

  • src/channels/telegram.ts (or similar Telegram implementation file) (added, +181/-0)
RAW_BUFFERClick to expand / collapse

Summary

On Telegram, assistant pre-tool scratch/commentary text is sometimes being delivered to the user as normal chat messages instead of remaining internal.

Expected

Only user-facing final responses should appear in the Telegram chat. Internal planning/scratch/tool-chatter should never be surfaced to the user.

Actual

Short internal-looking lines sometimes appear in chat, for example scratch notes like:

  • "Need add hasLoadedChildren maybe."
  • "Need maybe built-in skill? no. use apprank apps list/status."
  • similar pre-tool implementation/thought fragments

These are not intended as user-facing replies.

Why this matters

  • leaks low-value internal scratch text into the user conversation
  • degrades trust / polish
  • can expose implementation chatter that should stay hidden
  • repeated even after changing assistant behavior, which suggests a surface/runtime handling issue rather than only prompting style

Observed context

  • Surface: Telegram direct chat
  • Runtime: OpenClaw main session
  • Tools involved: normal tool use (exec, read, etc.)
  • The leak appears around turns where tool work is happening and the assistant would normally keep intermediate commentary internal

Working hypothesis

A class of assistant intermediate text/commentary is being treated as a normal outbound chat message on Telegram instead of remaining internal/non-user-visible.

This does not appear to come from GitHub/Codex/AppRank output itself; it looks like assistant-side pre-tool chatter/scratch text is being surfaced by the runtime/channel pipeline.

Suggested investigation areas

  • Telegram outbound message path for assistant intermediate/commentary content
  • any distinction between internal commentary vs final user-facing assistant text
  • tool-call narration handling on Telegram compared with other surfaces
  • whether certain assistant messages before tool calls are being flushed as normal channel replies

Repro sketch

  1. Use OpenClaw in a Telegram DM
  2. Ask for a multi-step repo/tool task
  3. During tool-heavy turns, observe whether short internal scratch lines appear before the actual final response

Notes

The safest behavioral workaround is to avoid emitting any pre-tool chatter at all, but that only masks the issue. The platform should not surface this class of internal assistant text to end users.

extent analysis

TL;DR

The issue can be mitigated by distinguishing between internal commentary and final user-facing text in the Telegram outbound message path.

Guidance

  • Investigate the Telegram outbound message path to identify why internal commentary is being treated as normal chat messages.
  • Review the distinction between internal commentary and final user-facing assistant text to ensure they are handled differently.
  • Compare tool-call narration handling on Telegram with other surfaces to identify potential inconsistencies.
  • Verify if certain assistant messages before tool calls are being flushed as normal channel replies, causing the leak.

Example

No code snippet is provided as the issue lacks specific technical details.

Notes

The issue seems to be related to the handling of internal commentary in the Telegram outbound message path. The suggested investigation areas should help identify the root cause. However, without more information about the implementation, it's difficult to provide a definitive solution.

Recommendation

Apply workaround: Avoid emitting pre-tool chatter or implement a temporary fix to distinguish between internal commentary and final user-facing text until the root cause is identified and resolved. This is because the issue degrades trust and polish, and a workaround can help mitigate the problem while a more permanent solution is developed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING