openclaw - 💡(How to fix) Fix CLI backend responses sometimes not delivered to Telegram delivery context [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#75991Fetched 2026-05-03 04:43:33
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Timeline (top)
commented ×1mentioned ×1subscribed ×1unsubscribed ×1

When a session has a deliveryContext pointing to a Telegram chat/topic, responses generated by the claude-cli backend are sometimes written to the session transcript (.jsonl) but never delivered to Telegram via the delivery-mirror pathway.

Error Message

  • Session processes user message, generates assistant response via CLI backend
  • Response appears in session transcript with provider: "claude-cli"
  • No corresponding delivery-mirror message is created
  • User never receives the response in Telegram
  • Pattern is intermittent — some responses in the same session deliver fine

Root Cause

When a session has a deliveryContext pointing to a Telegram chat/topic, responses generated by the claude-cli backend are sometimes written to the session transcript (.jsonl) but never delivered to Telegram via the delivery-mirror pathway.

Fix Action

Workaround

We've deployed a launchd watchdog that removes stale sessions.json.lock files older than 30 seconds. This prevents the lock contention cascade but doesn't address the silent delivery failure itself.

Code Example

[telegram] dispatch failed: SessionWriteLockTimeoutError: session file locked (timeout 10000ms)
[agent/embedded] agent cleanup timed out: step=pi-trajectory-flush timeoutMs=10000
RAW_BUFFERClick to expand / collapse

Summary

When a session has a deliveryContext pointing to a Telegram chat/topic, responses generated by the claude-cli backend are sometimes written to the session transcript (.jsonl) but never delivered to Telegram via the delivery-mirror pathway.

Observed behavior

  • Session processes user message, generates assistant response via CLI backend
  • Response appears in session transcript with provider: "claude-cli"
  • No corresponding delivery-mirror message is created
  • User never receives the response in Telegram
  • Pattern is intermittent — some responses in the same session deliver fine

Conditions that seem to trigger it

  • Sessions with long tool-call chains (multiple reads, searches, bash commands)
  • Concurrent sessions competing for sessions.json.lock
  • Sessions that hit pi-trajectory-flush cleanup timeouts
  • After a SessionWriteLockTimeoutError event, subsequent sessions may silently fail delivery

Evidence from logs

[telegram] dispatch failed: SessionWriteLockTimeoutError: session file locked (timeout 10000ms)
[agent/embedded] agent cleanup timed out: step=pi-trajectory-flush timeoutMs=10000

After these errors, multiple sessions continued generating responses that were never delivered.

Expected behavior

The gateway should verify that each assistant response in a session with a deliveryContext is actually delivered. If delivery fails or doesn't fire, it should retry.

Workaround

We've deployed a launchd watchdog that removes stale sessions.json.lock files older than 30 seconds. This prevents the lock contention cascade but doesn't address the silent delivery failure itself.

Environment

  • macOS (Darwin 25.4.0)
  • OpenClaw installed via npm (global)
  • Telegram channel plugin
  • CLI backend with claude-opus models

extent analysis

TL;DR

Implement a retry mechanism for failed deliveries in the delivery-mirror pathway to ensure assistant responses are delivered to Telegram.

Guidance

  • Investigate the SessionWriteLockTimeoutError and pi-trajectory-flush timeout errors to understand the root cause of the lock contention and cleanup timeouts.
  • Verify that the delivery-mirror pathway is correctly configured and enabled for sessions with a deliveryContext pointing to a Telegram chat/topic.
  • Consider increasing the timeout values for SessionWriteLockTimeoutError and pi-trajectory-flush to reduce the likelihood of timeouts and subsequent silent delivery failures.
  • Review the launchd watchdog workaround and consider integrating a similar mechanism to remove stale locks and prevent lock contention cascades.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The provided workaround only addresses the lock contention issue and does not solve the underlying problem of silent delivery failures. A more comprehensive solution is needed to ensure reliable delivery of assistant responses.

Recommendation

Apply a workaround by implementing a retry mechanism for failed deliveries in the delivery-mirror pathway, as the root cause of the issue is not fully understood and a comprehensive solution may require further investigation.

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 gateway should verify that each assistant response in a session with a deliveryContext is actually delivered. If delivery fails or doesn't fire, it should retry.

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 CLI backend responses sometimes not delivered to Telegram delivery context [1 comments, 2 participants]