openclaw - 💡(How to fix) Fix [Bug]: Telegram final assistant replies after tool calls are sometimes delivered but not persisted to session JSONL [3 comments, 3 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#77814Fetched 2026-05-06 06:20:58
View on GitHub
Comments
3
Participants
3
Timeline
3
Reactions
2
Timeline (top)
commented ×3

Telegram-delivered final assistant replies after tool-calling turns are sometimes absent from the active session JSONL, so the next model turn cannot see the assistant's previous answer.

Root Cause

Consequence: The model may ask the user to restate information that it had just provided, or may be unable to act on shorthand follow-ups such as "add these" because its own previous answer is missing from the transcript.

Code Example

user
assistant toolCall
toolResult
assistant final text reply
user follow-up

---

user
assistant toolCall
toolResult
user follow-up

---

L160 assistant toolCall
L161 toolResult
L162 assistant toolCall
L163 toolResult
# assistant final text was delivered to Telegram here, but no assistant text entry appears in JSONL
L164 user follow-up

---

toolResult -> user
toolResult -> user
toolResult -> user

---

Affected session A: 6 toolResult -> user gaps
Affected session B: 5 toolResult -> user gaps
Control session C: 0 gaps
Control session D: 0 gaps
RAW_BUFFERClick to expand / collapse

Bug type

Regression / intermittent runtime bug

Beta release blocker

No

Summary

Telegram-delivered final assistant replies after tool-calling turns are sometimes absent from the active session JSONL, so the next model turn cannot see the assistant's previous answer.

Steps to reproduce

  1. Use a Telegram direct-message agent session.
  2. Send a request that causes the agent to run one or more tools before answering.
  3. Wait for the final assistant answer to be delivered in Telegram.
  4. Inspect the active session transcript at ~/.openclaw/agents/<agentId>/sessions/<sessionId>.jsonl.
  5. In affected sessions, observe a toolResult -> user sequence where the final assistant text that was visible in Telegram is missing from the JSONL transcript.

Expected behavior

If a final assistant reply is delivered to Telegram, that same assistant reply should be present in the session transcript used for future context.

Expected transcript shape:

user
assistant toolCall
toolResult
assistant final text reply
user follow-up

Actual behavior

In affected sessions, the user receives the assistant reply in Telegram, but the session JSONL has this shape:

user
assistant toolCall
toolResult
user follow-up

The assistant final text is missing from the transcript, so the next model turn cannot see its own previous answer. This breaks natural follow-ups like "add these", "do it", "use the previous answer", or "apply option 2".

OpenClaw version

NOT_ENOUGH_INFO

Operating system

Docker/Coolify deployment on Linux VPS. Exact host OS version not captured.

Install method

docker / Coolify

Model

Observed with more than one model path, including GPT-5.5 via OpenAI Codex Responses and Claude Sonnet 4.6 via OpenRouter.

Provider / routing chain

Telegram channel -> OpenClaw gateway -> agent runtime -> model provider. Observed on both openai-codex-responses and openai-completions style model paths.

Additional provider/model setup details

No provider-specific API keys, tokens, or account identifiers included. The issue appears tied to Telegram session transcript persistence after tool-call turns, not one specific model.

Logs, screenshots, and evidence

Observed by comparing session JSONL files for multiple agents/sessions.

Affected transcript examples had gaps like:

L160 assistant toolCall
L161 toolResult
L162 assistant toolCall
L163 toolResult
# assistant final text was delivered to Telegram here, but no assistant text entry appears in JSONL
L164 user follow-up

Another affected session showed multiple toolResult -> user gaps:

toolResult -> user
toolResult -> user
toolResult -> user

Control sessions did persist assistant text normally, which suggests the issue is intermittent rather than universal.

Observed sample:

Affected session A: 6 toolResult -> user gaps
Affected session B: 5 toolResult -> user gaps
Control session C: 0 gaps
Control session D: 0 gaps

The issue is not explained only by large tool output size. Gaps were observed after both small and large tool results, including very small tool results.

Impact and severity

Affected systems/channels: Telegram agent sessions.

Severity: Medium to High. The assistant reply is visible to the user, but absent from model history on the next turn. This causes context loss and failed follow-up instructions when the user refers to the previous assistant answer.

Frequency: Intermittent. It occurred in some sampled Telegram sessions and not in others.

Consequence: The model may ask the user to restate information that it had just provided, or may be unable to act on shorthand follow-ups such as "add these" because its own previous answer is missing from the transcript.

Additional information

No personal identifiers or private message content are included here. The report is based on transcript structure only: observed session JSONL event sequences and whether assistant text entries were present between tool results and subsequent user turns.

extent analysis

TL;DR

The issue can be addressed by ensuring that the final assistant reply is properly logged in the session JSONL after tool-call turns, potentially by modifying the logging mechanism or the Telegram integration.

Guidance

  • Review the logging mechanism for Telegram-delivered final assistant replies to ensure it correctly captures and logs these events in the session JSONL.
  • Verify that the issue is not related to the tool output size by checking if the gaps occur after both small and large tool results.
  • Investigate the possibility of a race condition or timing issue between the tool-call turns and the logging of the final assistant reply.
  • Check the Telegram integration to ensure it properly handles and logs the final assistant replies.

Example

No code snippet is provided as the issue description does not include specific code details.

Notes

The issue appears to be intermittent and specific to Telegram agent sessions, which may indicate a problem with the integration or the logging mechanism. Further investigation is needed to determine the root cause.

Recommendation

Apply a workaround to ensure that the final assistant reply is logged in the session JSONL, such as modifying the logging mechanism or adding a temporary fix to the Telegram integration, until a permanent solution can be implemented.

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

If a final assistant reply is delivered to Telegram, that same assistant reply should be present in the session transcript used for future context.

Expected transcript shape:

user
assistant toolCall
toolResult
assistant final text reply
user follow-up

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]: Telegram final assistant replies after tool calls are sometimes delivered but not persisted to session JSONL [3 comments, 3 participants]