openclaw - ✅(Solved) Fix Telegram message tool rejects numeric group topic targets while group replies default to message_tool [2 pull requests, 3 comments, 4 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#77137Fetched 2026-05-05 05:51:47
View on GitHub
Comments
3
Participants
4
Timeline
7
Reactions
3
Timeline (top)
commented ×3cross-referenced ×2closed ×1subscribed ×1

In Telegram group/forum-topic sessions, the default messages.groupChat.visibleReplies = "message_tool" makes normal final replies private and requires the agent to use message(action=send) for visible room output. That is fine in principle, but the message tool currently rejects valid numeric Telegram group/topic targets that the CLI accepts, so an agent can produce a correct answer but fail to deliver it visibly.

Root Cause

A group topic turn completed successfully and the final assistant text existed in the transcript, but it was not posted to the Telegram topic because group visible replies defaulted to message_tool_only.

Fix Action

Fixed

PR fix notes

PR #77156: fix(infra): recognize channel-prefixed numeric targets in looksLikeTargetId fallback (#77137)

Description (problem / solution / changelog)

Summary

Telegram group and forum-topic targets like telegram:-1003577364307 and telegram:-1003577364307:topic:1189 were rejected as non-id-like in looksLikeTargetId when the Telegram channel plugin was not in the active runtime registry. This happens in subagents, cron contexts, and CLI runners where pinActivePluginChannelRegistry is not called.

Root cause: The generic fallback heuristics in looksLikeTargetId only matched well-known prefixes (channel:, group:, user:, conversation:) and patterns (@handle, #channel, phone numbers, @thread). The telegram:<numericId> pattern wasn't covered; only plugin-loaded normalizers handled it precisely.

Fix: Extended the generic fallback with a last-resort pattern: when params.raw starts with <channel>: (lowercased) and the remaining body matches -?\d+(:(topic:)?\d+)?, return true. This covers:

  • telegram:-1003577364307 (negative group chat ID)
  • telegram:-1003577364307:topic:1189 (forum-topic, full form)
  • telegram:-1003577364307:1189 (forum-topic, shorthand)
  • telegram:1234567890 (positive user/channel ID)

Non-numeric suffixes like telegram:someusername remain false, so the heuristic stays conservative.

Files changed:

  • src/infra/outbound/target-normalization.ts — added fallback pattern after existing generic checks
  • src/infra/outbound/target-normalization.test.ts — 5 new tests (4 positive cases + 1 negative guard)
  • CHANGELOG.md — entry under Fixes

Test results: 25/25 target-normalization tests pass. All acceptance test suites pass. oxlint clean. tsc clean.

Fixes #77137.


🤖 Generated with Claude Code

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/infra/outbound/target-normalization.test.ts (modified, +18/-0)
  • src/infra/outbound/target-normalization.ts (modified, +16/-1)

PR #77177: fix #77137: Telegram message tool rejects numeric group topic targets while group replies default to message_too

Description (problem / solution / changelog)

Summary

Fixes #77137

Issue

Telegram message tool rejects numeric group topic targets while group replies default to message_tool

Changes

  • fix: resolve issue #77137

Changed Files

CHANGELOG.md                               |  1 +
 extensions/telegram/src/targets.test.ts    | 38 ++++++++++++++
 src/infra/outbound/target-normalization.ts | 12 +++--
 src/infra/outbound/target-resolver.test.ts | 84 +++++++++++++++++++++++++++++-
 4 files changed, 130 insertions(+), 5 deletions(-)

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/telegram/src/targets.test.ts (modified, +38/-0)
  • src/infra/outbound/target-normalization.ts (modified, +8/-4)
  • src/infra/outbound/target-resolver.test.ts (modified, +83/-1)

Code Example

Unknown target "telegram:-1003577364307" for Telegram. Hint: <chatId>
Unknown target "-1003577364307:1189" for Telegram. Hint: <chatId>
Unknown target "-1003577364307" for Telegram. Hint: <chatId>
Unknown target "-1003577364307:topic:1189" for Telegram. Hint: <chatId>

---

Telegram send failed: chat not found (chat_id=1003577364307)
Call to 'sendMessage' failed! (400: Bad Request: chat not found)

---

openclaw message send --channel telegram --target='-1003577364307:topic:1189' --message 'dry-run route test' --dry-run --json

---

{
  "action": "send",
  "channel": "telegram",
  "dryRun": true,
  "handledBy": "core",
  "payload": {
    "channel": "telegram",
    "to": "telegram:-1003577364307:topic:1189",
    "via": "direct",
    "mediaUrl": null,
    "dryRun": true
  }
}

---

{
  "action": "send",
  "channel": "telegram",
  "accountId": "default",
  "target": "-1003577364307:topic:1189",
  "message": "dry-run route test",
  "dryRun": true
}

---

Unknown target "-1003577364307:topic:1189" for Telegram. Hint: <chatId>

---

{
  "action": "send",
  "channel": "telegram",
  "accountId": "default",
  "target": "-1003577364307",
  "threadId": "1189",
  "message": "dry-run route test",
  "dryRun": true
}
RAW_BUFFERClick to expand / collapse

Summary

In Telegram group/forum-topic sessions, the default messages.groupChat.visibleReplies = "message_tool" makes normal final replies private and requires the agent to use message(action=send) for visible room output. That is fine in principle, but the message tool currently rejects valid numeric Telegram group/topic targets that the CLI accepts, so an agent can produce a correct answer but fail to deliver it visibly.

Environment

  • OpenClaw: 2026.5.2 (8b2a6e5)
  • Channel: Telegram group forum topic
  • Source session key shape: agent:main:telegram:group:-1003577364307:topic:1189
  • Session delivery context stored:
    • channel: "telegram"
    • to: "telegram:-1003577364307"
    • threadId: 1189
    • accountId: "default"

What happened

A group topic turn completed successfully and the final assistant text existed in the transcript, but it was not posted to the Telegram topic because group visible replies defaulted to message_tool_only.

The agent then tried to use the message tool to send to the same topic. Repeated attempts failed with target parsing errors, for example:

Unknown target "telegram:-1003577364307" for Telegram. Hint: <chatId>
Unknown target "-1003577364307:1189" for Telegram. Hint: <chatId>
Unknown target "-1003577364307" for Telegram. Hint: <chatId>
Unknown target "-1003577364307:topic:1189" for Telegram. Hint: <chatId>

One later attempt accidentally used the absolute numeric value without Telegram's negative group prefix and hit Telegram API directly:

Telegram send failed: chat not found (chat_id=1003577364307)
Call to 'sendMessage' failed! (400: Bad Request: chat not found)

Reproduction / contrast

The CLI dry-run accepts the expected Telegram topic forms:

openclaw message send --channel telegram --target='-1003577364307:topic:1189' --message 'dry-run route test' --dry-run --json

Result:

{
  "action": "send",
  "channel": "telegram",
  "dryRun": true,
  "handledBy": "core",
  "payload": {
    "channel": "telegram",
    "to": "telegram:-1003577364307:topic:1189",
    "via": "direct",
    "mediaUrl": null,
    "dryRun": true
  }
}

But the agent message tool with equivalent args fails before delivery:

{
  "action": "send",
  "channel": "telegram",
  "accountId": "default",
  "target": "-1003577364307:topic:1189",
  "message": "dry-run route test",
  "dryRun": true
}

Result:

Unknown target "-1003577364307:topic:1189" for Telegram. Hint: <chatId>

Also fails with separate threadId:

{
  "action": "send",
  "channel": "telegram",
  "accountId": "default",
  "target": "-1003577364307",
  "threadId": "1189",
  "message": "dry-run route test",
  "dryRun": true
}

Why this is surprising

Docs say group/channel rooms default to messages.groupChat.visibleReplies: "message_tool", requiring message(action=send) for room output. That default only works safely if the message tool can address the current source room/topic reliably.

Right now there appears to be a mismatch between CLI target normalization and the agent message tool's target resolver for Telegram numeric group/topic ids.

Expected behavior

Either:

  1. The agent message tool should accept the same Telegram target forms as openclaw message send, including:
    • target: "-1001234567890" + threadId: "42"
    • target: "-1001234567890:topic:42"
    • possibly normalized telegram:-1001234567890 when it comes from session delivery context

or:

  1. When a source turn is already in a Telegram group topic and group visible replies are message_tool, the runtime should provide a robust current-room/current-topic send target abstraction so the model does not have to guess Telegram target syntax.

Impact

With the current default, a normal group-topic answer can be generated but not delivered. The model then tends to try multiple target spellings, causing noisy failures and increasing the risk of accidentally dropping the -100 group prefix and sending to a wrong/nonexistent chat id.

extent analysis

TL;DR

The agent message tool should be updated to accept the same Telegram target forms as the openclaw message send command to fix the target parsing errors.

Guidance

  • Verify that the message tool is correctly handling the target and threadId parameters for Telegram group/topic targets.
  • Check the documentation for the message tool to ensure it matches the expected behavior for Telegram targets.
  • Test the message tool with different target formats, such as "-1001234567890" + threadId: "42" and "-1001234567890:topic:42", to identify the correct format.
  • Consider updating the message tool to provide a robust current-room/current-topic send target abstraction to simplify target specification.

Example

No code snippet is provided as the issue is related to the message tool's target parsing and not a specific code implementation.

Notes

The issue appears to be a mismatch between the CLI target normalization and the agent message tool's target resolver for Telegram numeric group/topic ids. Resolving this mismatch should fix the target parsing errors.

Recommendation

Apply a workaround by updating the message tool to accept the same Telegram target forms as the openclaw message send command, until a more robust solution is implemented. This will allow the agent to deliver messages to Telegram group topics correctly.

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…

FAQ

Expected behavior

Either:

  1. The agent message tool should accept the same Telegram target forms as openclaw message send, including:
    • target: "-1001234567890" + threadId: "42"
    • target: "-1001234567890:topic:42"
    • possibly normalized telegram:-1001234567890 when it comes from session delivery context

or:

  1. When a source turn is already in a Telegram group topic and group visible replies are message_tool, the runtime should provide a robust current-room/current-topic send target abstraction so the model does not have to guess Telegram target syntax.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Telegram message tool rejects numeric group topic targets while group replies default to message_tool [2 pull requests, 3 comments, 4 participants]