openclaw - 💡(How to fix) Fix direct.<chatId>.threadReplies: "inbound" does not create per-topic sessions in Telegram DMs [1 comments, 2 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#80220Fetched 2026-05-11 03:17:25
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
closed ×1commented ×1

When channels.telegram.direct.<chatId>.threadReplies is set to "inbound", Telegram DM messages with different message_thread_id values should create separate per-topic sessions (e.g. agent:main:telegram:direct:5775112073:topic:404376). Instead, all threads collapse into a single flat session (agent:main:telegram:direct:5775112073), causing context to mix across unrelated DM threads.

Root Cause

Suspected root cause

Code Example

{
  channels: {
    telegram: {
      direct: {
        "5775112073": {
          threadReplies: "inbound"
        }
      }
    }
  }
}

---

agent:main:telegram:direct:5775112073

---

agent:main:telegram:direct:5775112073:topic:404376
agent:main:telegram:direct:5775112073:topic:406599
RAW_BUFFERClick to expand / collapse

Summary

When channels.telegram.direct.<chatId>.threadReplies is set to "inbound", Telegram DM messages with different message_thread_id values should create separate per-topic sessions (e.g. agent:main:telegram:direct:5775112073:topic:404376). Instead, all threads collapse into a single flat session (agent:main:telegram:direct:5775112073), causing context to mix across unrelated DM threads.

Context

  • #75975 fixed the opposite problem: DM messages with message_thread_id were fragmenting into separate sessions, breaking conversation continuity. The fix made DM sessions flat by default — correct for normal 1:1 DMs.
  • The changelog entry for #75975 explicitly says: "while preserving opt-in DM topic isolation for configured topics, dm.threadReplies, and direct.<chatId>.threadReplies"
  • But the opt-in mechanism (threadReplies: "inbound") does not work.

Configuration

{
  channels: {
    telegram: {
      direct: {
        "5775112073": {
          threadReplies: "inbound"
        }
      }
    }
  }
}

Actual behaviour

All inbound messages from chat 5775112073 — regardless of message_thread_id — route to a single session key:

agent:main:telegram:direct:5775112073

Sessions list confirms no topic-scoped keys exist for this direct chat.

Expected behaviour

With threadReplies: "inbound", messages with different message_thread_id values should create separate topic-scoped session keys:

agent:main:telegram:direct:5775112073:topic:404376
agent:main:telegram:direct:5775112073:topic:406599

(Group chats already do this correctly: agent:main:telegram:group:-1003713600742:topic:494.)

Suspected root cause

The session key assembly for direct chats ignores threadReplies config and always uses a flat key. The resolveTelegramSessionConversation function correctly extracts both chatId and topicId from messages, but the downstream session key builder for direct chats does not include the topic even when threadReplies is set.

Environment

  • OpenClaw: 2026.5.7 (eeef486)
  • Channel: Telegram (long-polling)
  • OS: Linux 6.6.114.1-microsoft-standard-WSL2 (x64)
  • Node: v22.22.0

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

openclaw - 💡(How to fix) Fix direct.<chatId>.threadReplies: "inbound" does not create per-topic sessions in Telegram DMs [1 comments, 2 participants]