openclaw - ✅(Solved) Fix [Bug]: Telegram DM remained pinned to stale ACP session via telegram/thread-bindings-default.json [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#60102Fetched 2026-04-08 02:36:16
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

A Telegram DM continued routing to a stale Claude ACP session instead of the main agent, even though normal Telegram config pointed to the main agent and multiple session/runtime cleanup steps had already been performed.

The actual live cause was an explicit persisted binding in:

~/.openclaw/telegram/thread-bindings-default.json

Root Cause

A Telegram DM continued routing to a stale Claude ACP session instead of the main agent, even though normal Telegram config pointed to the main agent and multiple session/runtime cleanup steps had already been performed.

The actual live cause was an explicit persisted binding in:

~/.openclaw/telegram/thread-bindings-default.json

PR fix notes

PR #67822: fix(telegram): clean up thread bindings to stale/failed ACP sessions on startup

Description (problem / solution / changelog)

Summary

When a Telegram DM is bound to an ACP session and that session becomes stale/failed, the binding persisted across OpenClaw restarts, causing DMs to continue routing to the dead session instead of the main agent.

Root Cause

Bindings are persisted to ~/.openclaw/telegram/thread-bindings-{accountId}.json and loaded on manager startup. No validation was performed to check whether the target ACP session still existed or was valid.

Fix

When createTelegramThreadBindingManager initializes, it now validates each ACP binding against the session store and removes bindings where:

  • Session entry doesn't exist (deleted externally)
  • Session status is failed/killed/timeout
  • ACP runtime state is error

Changes

  • extensions/telegram/src/thread-bindings.ts: Added stale session cleanup logic on manager creation
  • Uses readAcpSessionEntry() from openclaw/plugin-sdk/acp-runtime to check session validity

Testing

  1. Bind Telegram DM to ACP session
  2. Kill/fail the ACP session externally
  3. Restart OpenClaw
  4. Send new DM. This should route to main agent, not stale session

Related Issue

Fixes #60102

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/telegram/src/thread-bindings.test.ts (modified, +147/-0)
  • extensions/telegram/src/thread-bindings.ts (modified, +54/-1)
  • src/plugin-sdk/routing.ts (modified, +1/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

A Telegram DM continued routing to a stale Claude ACP session instead of the main agent, even though normal Telegram config pointed to the main agent and multiple session/runtime cleanup steps had already been performed.

The actual live cause was an explicit persisted binding in:

~/.openclaw/telegram/thread-bindings-default.json

Steps to reproduce

  1. Bind a Telegram DM conversation to a persistent ACP session.
  2. Let that ACP session become stale, failed, or otherwise no longer desired.
  3. Restart OpenClaw and/or clean ordinary session/runtime state.
  4. Send a new Telegram DM message.
  5. Observe that the DM is still routed to the stale ACP session.
  6. Inspect ~/.openclaw/telegram/thread-bindings-default.json.
  7. Find a binding for the Telegram conversation pointing to the stale ACP session.

Expected behavior

The Telegram DM should route back to the normal main-agent DM session once the stale ACP session is no longer desired. A hidden Telegram binding file should not keep silently overriding expected routing without a clear unbind/reset workflow.

Actual behavior

Telegram conversation kept routing to:

agent:claude:acp:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx

instead of:

agent:main:telegram:direct:xxxxxxxxx

This persisted across:

  • restart
  • parent session transcript cleanup
  • command log cleanup
  • related SQLite runtime cleanup

OpenClaw version

2026.4.2

Operating system

Ubuntu 24.04

Install method

ansible

Model

ChatGPT 5.4

Provider / routing chain

openclaw -> OpenAI

Additional provider/model setup details

Environment

Telegram DM ACP backend: acpx ACP agent: claude Host: Linux VPS

Relevant config Normal Telegram/main-agent config appeared correct in openclaw.json. The authoritative routing override was not in top-level config; it was in:

~/.openclaw/telegram/thread-bindings-default.json

The binding entry looked like:

{ "accountId": "default", "conversationId": "xxxxxxxxxx", "targetSessionKey": "agent:claude:acp:xxxxxxxxxx", "targetKind": "acp", "boundAt": 1775159597143, "lastActivityAt": 1775194400810, "agentId": "claude", "boundBy": "system" }

Logs / output / additional context We initially found related persisted state in other places, including:

~/.openclaw/logs/commands.log ~/.openclaw/tasks/runs.sqlite But clearing those alone was not sufficient to fix the issue.

The actual restoring step was:

  1. remove the binding entry from ~/.openclaw/telegram/thread-bindings-default.json
  2. restart OpenClaw

After that, Telegram immediately routed correctly back to the main agent.

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Removing the persisted binding entry from ~/.openclaw/telegram/thread-bindings-default.json and restarting OpenClaw should resolve the issue.

Guidance

  • Verify that the ~/.openclaw/telegram/thread-bindings-default.json file contains a binding entry for the Telegram conversation that is pointing to the stale ACP session.
  • Remove the binding entry from ~/.openclaw/telegram/thread-bindings-default.json to prevent it from overriding the expected routing.
  • Restart OpenClaw after removing the binding entry to ensure the changes take effect.
  • Test the Telegram DM routing again to confirm it is now routing to the main agent as expected.
  • Consider implementing a clear unbind/reset workflow to prevent similar issues in the future.

Example

No code snippet is necessary for this issue, as it involves modifying a configuration file.

Notes

This solution assumes that the issue is caused by the persisted binding entry in ~/.openclaw/telegram/thread-bindings-default.json. If the issue persists after removing the binding entry and restarting OpenClaw, further investigation may be necessary.

Recommendation

Apply the workaround by removing the binding entry and restarting OpenClaw, as this has been confirmed to resolve the issue in the given scenario.

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

The Telegram DM should route back to the normal main-agent DM session once the stale ACP session is no longer desired. A hidden Telegram binding file should not keep silently overriding expected routing without a clear unbind/reset workflow.

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 [Bug]: Telegram DM remained pinned to stale ACP session via telegram/thread-bindings-default.json [1 pull requests, 1 participants]