openclaw - 💡(How to fix) Fix [Bug]: Active Memory silently skips Telegram DM sessions due to unrecognized thread session key format [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#70061Fetched 2026-04-23 07:29:46
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Error Message

Gateway log: Zero active-memory runtime execution. No "blocking memory sub-agent", no "active-memory returned NONE", no timeout, no error. Complete silence on every turn.

Root Cause

The resolveChatType() function in extensions/active-memory/index.js cannot classify Telegram thread-format session keys.

Telegram DMs with topic threading produce session keys like:

agent:main:main:thread:{chatId}:{topicId}

The function checks for these patterns (lines ~462-478):

  1. :group: — no match
  2. :channel: — no match
  3. :direct: or :dm: — no match
  4. 3-part agent session (agent:{name}:{key}) — fails because the key has 6 parts
  5. webchat provider — no match (we're telegram)

When no pattern matches, resolveChatType() returns undefined. This causes:

  • isAllowedChatType() → returns false (line ~484)
  • Active memory silently skips (line ~1195), with zero log output

The Telegram thread session key format was intentionally introduced in PR #1597 (tracked in #7352) for topic-aware Telegram DMs, but the active-memory plugin was never updated to recognize it.

Code Example

agent:main:main:thread:{chatId}:{topicId}

---

ready (5 plugins: acpx, active-memory, memory-core, memory-wiki, telegram; 15.1s)
active-memory: loaded (stock:active-memory/index.js)

---

"active-memory": {
  "enabled": true,
  "config": {
    "agents": ["main"],
    "allowedChatTypes": ["direct", "group"],
    "queryMode": "full",
    "promptStyle": "contextual",
    "timeoutMs": 25000,
    "maxSummaryChars": 600,
    "logging": true,
    "persistTranscripts": true,
    "transcriptDir": "active-memory"
  }
}

---

// After existing :group: / :channel: / :direct: / :dm: checks
if (sessionKey.includes(":thread:")) return "direct";
RAW_BUFFERClick to expand / collapse

[Bug]: Active Memory silently skips Telegram DM sessions due to unrecognized thread session key format

Bug Description

The Active Memory plugin silently skips all Telegram DM sessions when topic-based threading is enabled. No memory is ever injected, no transcripts are persisted, and no errors or warnings appear in the gateway log. The plugin loads successfully and shows as loaded in the plugin table, but never actually executes the blocking memory sub-agent for Telegram sessions.

Root Cause

The resolveChatType() function in extensions/active-memory/index.js cannot classify Telegram thread-format session keys.

Telegram DMs with topic threading produce session keys like:

agent:main:main:thread:{chatId}:{topicId}

The function checks for these patterns (lines ~462-478):

  1. :group: — no match
  2. :channel: — no match
  3. :direct: or :dm: — no match
  4. 3-part agent session (agent:{name}:{key}) — fails because the key has 6 parts
  5. webchat provider — no match (we're telegram)

When no pattern matches, resolveChatType() returns undefined. This causes:

  • isAllowedChatType() → returns false (line ~484)
  • Active memory silently skips (line ~1195), with zero log output

The Telegram thread session key format was intentionally introduced in PR #1597 (tracked in #7352) for topic-aware Telegram DMs, but the active-memory plugin was never updated to recognize it.

Evidence

Session key: agent:main:main:thread:488228716:531403

Gateway log: Plugin loads successfully:

ready (5 plugins: acpx, active-memory, memory-core, memory-wiki, telegram; 15.1s)
active-memory: loaded (stock:active-memory/index.js)

Gateway log: Zero active-memory runtime execution. No "blocking memory sub-agent", no "active-memory returned NONE", no timeout, no error. Complete silence on every turn.

Source code trace:

  • resolveChatType("agent:main:main:thread:488228716:531403")undefined
  • isAllowedChatType()false (line ~484: if (!chatType) return false)
  • Guard at line ~1195 skips the session immediately

Config (validated with openclaw config validate):

"active-memory": {
  "enabled": true,
  "config": {
    "agents": ["main"],
    "allowedChatTypes": ["direct", "group"],
    "queryMode": "full",
    "promptStyle": "contextual",
    "timeoutMs": 25000,
    "maxSummaryChars": 600,
    "logging": true,
    "persistTranscripts": true,
    "transcriptDir": "active-memory"
  }
}

Reproduction Steps

  1. Configure OpenClaw with Telegram channel and allowedChatTypes: ["direct"]
  2. Send a DM to the Telegram bot (with topics enabled, which creates thread-format session keys)
  3. Observe the session key format: agent:main:main:thread:{chatId}:{topicId}
  4. Send messages that should trigger memory recall
  5. Check gateway logs — zero active-memory activity
  6. Check transcript directory — empty

Related Issues

  • #65159 — Same symptom (configured and loaded but not triggering), reported for Discord DM. Reporter suspects "chat type mismatch" but hasn't identified root cause.
  • #65775allowedChatTypes silently strips "explicit" sessions. Same pattern of resolveChatType dropping unrecognized types.
  • #65517 — Active-memory blocks event loop and starves Telegram polling (separate but related Telegram interaction).
  • #7352 — Documents the thread-format session key as intentional behavior for Telegram DM topics.

Proposed Fix

Add :thread: pattern recognition to resolveChatType(). Telegram thread sessions should resolve to "direct" since they are direct messages with topic threading enabled.

Suggested addition to the session key pattern checks:

// After existing :group: / :channel: / :direct: / :dm: checks
if (sessionKey.includes(":thread:")) return "direct";

Alternatively, for a more robust fix that handles future session key formats: if the provider is known and the channel is non-empty, but no specific pattern matched, fall back to "direct" rather than returning undefined. This ensures new session key formats don't silently break active memory.

Environment

  • OpenClaw: 2026.4.21
  • Channel: Telegram (bot: @LovingKyprisBot)
  • Active Memory: enabled, queryMode: full, promptStyle: contextual
  • OS: Linux 6.17.12-300.fc43.x86_64 (Fedora)

extent analysis

TL;DR

The Active Memory plugin can be fixed by adding a :thread: pattern recognition to the resolveChatType() function to correctly classify Telegram thread-format session keys.

Guidance

  • Update the resolveChatType() function in extensions/active-memory/index.js to include a check for the :thread: pattern and return "direct" when matched.
  • Consider implementing a more robust fix that falls back to "direct" when the provider is known and the channel is non-empty, but no specific pattern matches.
  • Verify the fix by checking the gateway logs for active-memory activity and the transcript directory for persisted transcripts after sending messages that should trigger memory recall.
  • Test the fix with different session key formats to ensure it handles various scenarios correctly.

Example

// After existing :group: / :channel: / :direct: / :dm: checks
if (sessionKey.includes(":thread:")) return "direct";

Notes

The proposed fix assumes that the :thread: pattern is the only missing recognition in the resolveChatType() function. Additional testing may be necessary to ensure that other session key formats are correctly handled.

Recommendation

Apply the workaround by adding the :thread: pattern recognition to the resolveChatType() function, as it is a straightforward fix that addresses the identified root cause. This will allow the Active Memory plugin to correctly classify Telegram thread-format session keys and trigger memory recall as expected.

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 [Bug]: Active Memory silently skips Telegram DM sessions due to unrecognized thread session key format [1 participants]