Repository navigation
Description
Summary
A specific Telegram forum topic (thread_id=905 in our case) becomes a permanent inbound black hole: Telegram pushes updates to the bot, OpenClaw acks them off the long-poll queue, but no Inbound message ... log line ever appears for that thread and the agent never sees the message. Other topics in the same chat continue to work normally. Outbound to the same thread keeps working.
This is reproducible across multiple gateway restarts and survives session-store deletion. We have not found a way to recover the affected thread without abandoning it.
Environment
- OpenClaw
2026.6.1(commit2e08f0f) - macOS 26.4 (arm64), Node 26.0.0
- Telegram provider:
pollingmode, isolated polling ingress - Forum group
is_forum: true, bot isstatus: member - Affected thread:
message_thread_id=905 - Other threads in the same group (
topic:17,topic:13, direct chat): unaffected
What works
- Outbound to topic 905:
openclaw message send --thread-id 905 ...succeeds, message arrives in the Telegram client. - Inbound to other topics in the same chat (e.g. topic 17): works end-to-end, agent replies normally.
- Inbound to direct chat: works.
- Bot membership / permissions:
getChatMemberreturnsstatus: memberfor the group. - Telegram side:
getUpdates?offset=-Nreturns[]after the user posts → confirms OpenClaw acked the update off Telegram's queue.
What is broken
For thread 905 specifically:
- User sends a message in topic 905.
- Telegram queues the update for the bot.
- OpenClaw polling acks it (Telegram side queue drains to
[]). - No
Inbound message telegram:group:...:topic:905 ...log line is written. - Agent never receives the message; user never gets a reply.
This persists through:
- 5+
openclaw gateway restartcycles - Clearing
claudeCliSessionId/cliSessionIds/cliSessionBindingsfor topic 905 insessions.json - Resetting
status: "failed"→ unset on the session row - Deleting the entire topic 905 entry from
sessions.jsonand the underlying transcript JSONL - Sending an explicit bot mention in topic 905
Suspicious log evidence
(All chat ids / user ids / bot username redacted as -100XXXXXXXXXX, 5XXXXXXX62, REDACTED_BOT.)
1. Stale lane guard (around the time the black hole started)
2026-06-09T08:49:04 [telegram] [diag] timed out spooled update 939635924 had no active reply fence on lane telegram:-100XXXXXXXXXX:topic:905; keeping the lane guarded until the handler stops.
2026-06-09T08:49:09 [telegram] [diag] timed out spooled update 939635924 did not stop within 5s after reply abort; keeping lane telegram:-100XXXXXXXXXX:topic:905 guarded.
After this line, no further inbound for topic:905 is ever logged. The guard is supposed to be in-process state (activeSpooledUpdateHandlersByLane Map in monitor-polling.runtime-*.js), so it should clear on restart — but the black hole survives every restart.
2. Mismatched session key format
2026-06-09T00:11:24 [ws] ⇄ res ✗ sessions.resolve 8ms errorCode=INVALID_REQUEST errorMessage=No session found: telegram:-100XXXXXXXXXX:905
The key telegram:-100XXXXXXXXXX:905 is missing the topic: segment that real session keys use (agent:main:telegram:group:-100XXXXXXXXXX:topic:905). Some caller is constructing the wrong key and silently failing the resolve. Possibly related to the inbound dispatcher dropping the update before logging it.
3. Repeated topic:905 session resets prior to today
The agent transcript directory shows topic:905 has been auto-reset 3 times in 24 hours:
c0ffbf21-...-topic-905.jsonl.reset.2026-06-08T13-05-18.913Zd8243339-...-topic-905.jsonl.reset.2026-06-08T23-56-15.247Z- And again today (manual delete). Suggests this thread has chronic instability.
4. Stuck-session recovery right before the black hole started
2026-06-09T08:02:26 [diagnostic] stalled session: sessionId=d8243339-... sessionKey=agent:main:telegram:group:-100XXXXXXXXXX:topic:905 state=processing age=371s queueDepth=1 reason=active_work_without_progress classification=stalled_agent_run activeWorkKind=embedded_run
2026-06-09T08:02:26 [diagnostic] stuck session recovery: sessionId=d8243339-... sessionKey=agent:main:telegram:group:-100XXXXXXXXXX:topic:905 age=371s action=abort_embedded_run aborted=true drained=true
2026-06-09T08:02:26 [diagnostic] stuck session recovery outcome: status=aborted action=abort_embedded_run sessionId=d8243339-... sessionKey=agent:main:telegram:group:-100XXXXXXXXXX:topic:905
A stuck session recovery aborted the embedded run for topic:905 shortly before the black hole began. Hypothesis: the recovery path leaves residual state somewhere persistent (not the in-process Map) that causes future inbound updates for this exact (chatId, thread_id) to be dropped.
Repro shape
- Have a Telegram forum group where one topic accumulates a stuck session that gets recovered via
abort_embedded_run+ the timed-out-spooled-handler path. - After recovery, send any user message to that topic.
- Observe: Telegram acks the update, no
Inbound message ...log line, agent never receives. Other topics in the same chat continue to work.
Workaround
Users have to abandon the affected thread and create a new one in the same forum group. Even fully removing the session entry + transcript + multiple gateway restarts does not restore inbound to the original thread.
Asks for the maintainer
- Where is the persistent state that survives
sessions.jsondeletion + restart and keys off(chatId, thread_id)to drop inbound updates for one specific topic? That's the mystery. - The
sessions.resolvecall usingtelegram:<chatId>:905(withouttopic:) — what's the caller? It's a hint that some component constructs session keys without the thread segment. - Should
abort_embedded_runrecovery clear all persisted lane state for that thread, including any dedup / claim / message-cache entries that might key off thread_id alone?
Happy to provide more raw log slices, sqlite plugin-state dumps, or attempt patches if guided.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 9, 2026
Thanks for the context here. I did a careful shell check against current
main, and this is already implemented.Current main now makes polling acknowledgement depend on durable ingress admission, preserves forum-topic lanes, and replays durable work across restart; the reported permanent silent-loss behavior is therefore implemented against on main.
So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review details
Best possible solution:
Keep the current durable-before-ack and restart-replay design, and report any recurrence from a current release with the ingress diagnostic and durable-queue state.
Do we have a high-confidence way to reproduce the issue?
Yes, source coverage now exercises the decisive boundary: the worker cannot advance its offset until the parent commits the durable spool entry, including topic-lane handling and restart replay.
Is this the best way to solve the issue?
Yes: durable admission before acknowledgement plus lane-aware restart replay repairs the owning ingress boundary rather than attempting to repair deleted session state downstream.
Security review:
Security review: This issue does not propose a patch or identify a security boundary concern.
AGENTS.md: found and applied where relevant.
What I checked:
ingressMonitor.admitsucceeds; offset persistence follows that durable admission, so a failed enqueue is not consumed from Telegram. (extensions/telegram/src/polling-session.ts:530, ce06e7924e88)extensions/telegram/src/telegram-ingress-drain.ts:407, ce06e7924e88)extensions/telegram/src/telegram-ingress-worker.runtime.test.ts:184, ce06e7924e88)extensions/telegram/src/polling-session.ts:530, c02e39345bf6)Likely related people:
extensions/telegram/src/polling-session.ts,extensions/telegram/src/telegram-ingress-drain.ts,extensions/telegram/src/telegram-ingress-spool.ts)Codex review notes: model internal, reasoning high; reviewed against ce06e7924e88; fix evidence: commit c02e39345bf6, main fix timestamp 2026-08-05T14:42:51+05:30.
kesslerio commentedon Jun 11, 2026
Corroborating report — same black hole on 2026.6.1, slightly different trigger, also survives manual session repair
Environment: OpenClaw
2026.6.1(2e08f0f) in Docker (Node 22.21.1, Linux), Telegrampollingmode with isolated polling ingress, forum supergroup, botstatus: member, privacy mode off (can_read_all_group_messages: true).One forum topic (redacted,
topic:A) became an inbound black hole with the exact signature described in the OP:getWebhookInfoshowspending_update_count: 0right after the user posts → updates are being acked off the queueInbound message ...:topic:Alog line is ever written; the agent never sees the messageopenclaw message send --target ...:topic:A→ delivered,outbound send ok ... threadId=Alogged)openclaw agent --session-key agent:<id>:telegram:group:<chat>:topic:A --deliver) works fine — the breakage is isolated to inbound dispatch for that(chatId, threadId)laneTrigger timeline in our case: a long (~2.5h) agent run on that topic's session was interrupted by a gateway restart; on boot we saw
removed stale session lock ... (recycled-pid)followed byresumed interrupted main session: ...topic:A (with pending payload). A few hours later a manual stuck-session repair was performed (cleared a session model override insessions.json, another gateway restart, killed a leftover codex app-server process). After that restart the topic never delivered inbound again. It survives subsequent restarts; thesessions.jsonentry is intact and healthy (status=done, no overrides, correctdeliveryContext).New datapoints beyond the OP:
/idcommand, which the user most likely sent as a reply to one of the bot's own messages in that topic. It produced a normalInbound message ...topic:Aline and was answered in-topic. Fresh non-reply messages — including explicit@botnamemention text — continue to be silently dropped. So replies-to-bot (and/or slash commands) appear to bypass whatever is guarding the lane; that asymmetry may help locate the guarded code path (reply fence vs. fresh-message ingestion?).db/(auth.db,doctor.db,usage.db,watchdog.db,webhooks.db) contain no per-thread guard/dedup rows; the ingress spool dir is empty (no stuck.processingclaims); thethread-bindings-<account>.jsonstore is empty; the update-offset file only carrieslastUpdateId. The "what persists across restarts" mystery stands.Workaround confirmed on our side as well: abandoning the thread and moving the topic config to a freshly created forum topic. Happy to provide redacted log slices if useful.
vortexopenclaw commentedon Jun 14, 2026
Problem summary: this looks related to #93040, but I would not close this issue as a duplicate yet.
#93040 covers the in-process guarded-lane part of this failure family: after a spooled Telegram update times out and the old handler ignores abort, the timed-out update is marked failed, the lane guard is released after the abort grace window, and isolated ingress restarts so a later same-lane update can drain.
The extra evidence here points at a second question that #93040 may not fully answer:
topic:segment still looks worth checking against topic binding/routing stateSuggested next step: keep #91564 open after #93040 unless maintainers can confirm the PR also fixes the persistent post-restart topic black-hole case. The clean split is: #93040 for the timeout/release/restart recovery path, this issue for any persistent topic routing or binding state that remains after process restart.
vortexopenclaw commentedon Jun 14, 2026
@clawsweeper re-review
13 remaining items
vincentkoc commentedon Aug 6, 2026
Closing this as already fixed on current
main. Correction to the earlier automated review: the fix is a current-main ingress/recovery chain, not solely commitc02e39345bf6.Current Telegram polling now acknowledges an update only after the parent has committed it through
ingressMonitor.admit; a failed durable admission returns a failed acknowledgement instead of advancing consumption. Forum messages retain canonicaltelegram:<chat>:topic:<thread>lane identity, and persisted claims are recovered and replayed across polling, isolated-ingress, and account restarts. The final owner-boundary update is included inc02e39345bf6, #95830; the durable-before-offset and topic-lane regressions were introduced earlier in1126ffba7ffeand remain green.Focused verification on current main:
This repairs the reported persistent post-restart topic black hole at the ingress owner. #91456 remains open because its in-process DM timeout/guard behavior is a distinct failure mode. The fix is current-main-only; no version release tag contains
c02e39345bf6yet.