openclaw - ✅(Solved) Fix [Bug]: embedded-runtime assistant replies missing from session JSONL — regression in 5.3 and 5.4 [1 pull requests, 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#77823Fetched 2026-05-06 06:20:47
View on GitHub
Comments
3
Participants
3
Timeline
19
Reactions
2
Author
Timeline (top)
referenced ×14commented ×3closed ×1cross-referenced ×1

Root Cause

Root cause: agent-command.ts runner gate only calls persistCliTurnTranscript for cli runner, skipping embedded (webchat/feishu) sessions entirely.

Fix Action

Fixed

PR fix notes

PR #77839: fix(agents): persist embedded session JSONL transcripts (#77823)

Description (problem / solution / changelog)

Summary

  • Treat executionTrace.runner: "embedded" like CLI for post-turn session transcript persistence and the existing CLI-named embedded-aware compaction lifecycle so assistant-visible text is written to session JSONL (regression in 2026.5.3+ for webchat/Feishu-style embedded runs).

Root cause

agent-command only called persistCliTurnTranscript when runner === "cli". The PI embedded path tags runs with runner: "embedded", so user turns could be recorded elsewhere while the assistant summary line for the turn never hit the transcript writer.

Why this is safe

  • Reuses the existing persistCliTurnTranscript + persistTextTurnTranscript path already used for CLI; no new persistence format or trust boundary.
  • ACP turns still take the dedicated early-return path (persistAcpTurnTranscript); this change does not alter ACP behavior.
  • Compaction hook was already implemented for embedded session files (createPreparedEmbeddedPiSettingsManager, etc.); we only widen when it runs to match transcript persistence.

Security / runtime controls

Unchanged: auth, model allowlists, tool policy, channel delivery, and session store access controls. This only runs the existing transcript-append and compaction helpers after a successful embedded run completes, keyed to the same session as before.

Real behavior proof

Not run in this environment (no live gateway/webchat stack here). Validation: focused unit test exercises the agentCommand path and asserts persistCliTurnTranscript is invoked once with executionTrace.runner === "embedded" and the user body passed through.

Tests run

  • git diff --check
  • pnpm vitest run src/commands/agent.test.ts
  • pnpm check:changedtypecheck core failed on main as well (Cannot find module 'web-tree-sitter') in this checkout; unrelated to this diff.

Out of scope

  • Renaming persistCliTurnTranscript / runCliTurnCompactionLifecycle (behavior is already shared with embedded Pi).
  • Broader transcript model for subagents or non-embedded runners without a structured EmbeddedPiRunResult.

Fixes #77823.

  • AI-assisted implementation; human review recommended.

Made with Cursor

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/agents/agent-command.ts (modified, +4/-2)
  • src/agents/command/attempt-execution.cli.test.ts (modified, +125/-0)
  • src/agents/command/attempt-execution.ts (modified, +41/-19)
  • src/commands/agent.test.ts (modified, +25/-0)
  • src/config/sessions/transcript.ts (modified, +57/-22)
RAW_BUFFERClick to expand / collapse

Bug type: Regression

Summary: Assistant visible text responses are not persisted to session transcript JSONL for embedded-runtime (webchat/feishu) sessions. User messages are written correctly but assistant responses appear empty after tool calls, causing model to re-answer old prompts.

Affected: 2026.5.3, 2026.5.4

Root cause: agent-command.ts runner gate only calls persistCliTurnTranscript for cli runner, skipping embedded (webchat/feishu) sessions entirely.

Related: #77518, #76729, #76990, #77665 (fix PR still open)

extent analysis

TL;DR

Modify the agent-command.ts runner gate to call persistCliTurnTranscript for embedded sessions, not just the CLI runner.

Guidance

  • Review the agent-command.ts file to understand the current implementation of the runner gate and how it handles different session types.
  • Update the agent-command.ts file to include a condition that checks for embedded sessions (webchat/feishu) and calls persistCliTurnTranscript accordingly.
  • Verify that the fix works by testing the persistence of assistant responses in session transcript JSONL for embedded-runtime sessions.
  • Check related issues (#77518, #76729, #76990, #77665) for additional context and potential solutions.

Example

// Example of updated code in agent-command.ts
if (sessionType === 'cli' || sessionType === 'embedded') {
  persistCliTurnTranscript(session);
}

Notes

The fix may require additional changes to handle the specifics of embedded sessions, and the example code snippet is a simplified illustration of the potential solution.

Recommendation

Apply workaround: Modify the agent-command.ts file to include embedded sessions in the persistCliTurnTranscript call, as this is a targeted fix for the identified root cause.

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 - ✅(Solved) Fix [Bug]: embedded-runtime assistant replies missing from session JSONL — regression in 5.3 and 5.4 [1 pull requests, 3 comments, 3 participants]