fix(agents): persist embedded session JSONL transcripts (#77823)#77839
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. by source inspection: current main gates post-turn transcript persistence to Real behavior proof Next step before merge Security Review detailsBest possible solution: Merge this PR after normal maintainer review and required checks confirm the embedded gap-fill appends assistant text exactly once while preserving Pi-owned user/tool transcript rows. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main gates post-turn transcript persistence to Is this the best way to solve the issue? Yes: the PR uses the existing transcript append path, limits embedded handling to assistant gap-fill, and dedupes only when the physical transcript tail already contains equivalent assistant text. That is narrower than adding a new transcript format or changing Pi's ownership model. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 77ae06bfaa01. |
Follow-up on AI review (ClawSweeper / Codex)What changed since the prior revision The concern was correct: blindly widening This revision narrows embedded handling:
Tests
Still outstanding
Security / controls No change to auth, tool policy, channel routing, or session ACLs — persistence-only logic behind existing locks. Commits: latest Re-review progress:
|
87b3abc to
f001d5c
Compare
f001d5c to
29cba27
Compare
29cba27 to
54ae30a
Compare
54ae30a to
0e1170f
Compare
0e1170f to
0c34123
Compare
) Run persistCliTurnTranscript and post-turn compaction for executionTrace.runner embedded, matching CLI turns so assistant text reaches session JSONL for webchat/Feishu-style runs. Co-authored-by: Cursor <[email protected]>
…penclaw#77823) Embedded runs pass embeddedAssistantGapFill so persistCliTurnTranscript skips re-appending the user prompt Pi owns and only appends assistant text when the transcript tail lacks equivalent visible assistant content. Adds CLI transcript regression coverage for gap-fill dedupe. Co-authored-by: Cursor <[email protected]>
0c34123 to
3f7d994
Compare
obviyus
left a comment
There was a problem hiding this comment.
Verified the embedded-runner transcript persistence path and the assistant-only gap-fill, including the repeated-reply case where a newer user tail must not suppress the assistant append.
Maintainer follow-up: tightened dedupe to the transcript tail, preserved the existing latest-assistant helper for /tts latest, fixed the active changelog entry, and applied the real-behavior-proof override for this maintainer-verified path.
Local gate: pnpm test src/agents/command/attempt-execution.cli.test.ts src/commands/agent.test.ts -- --reporter=verbose; OPENCLAW_LOCAL_CHECK=1 OPENCLAW_LOCAL_CHECK_MODE=throttled pnpm check:changed.
|
Landed on main. Thanks @neeravmakwana. |
Live verification (2026-05-06)Local patch applied and tested on v2026.5.2. Confirmed:
Patch script: ~/Documents/Workspace-naicha/脚本/patch-v2026.5.2-embedded-transcript.js Waiting for v2026.5.5 release for official distribution. |
…eeravmakwana) * fix(agents): persist embedded runner session transcripts (openclaw#77823) Run persistCliTurnTranscript and post-turn compaction for executionTrace.runner embedded, matching CLI turns so assistant text reaches session JSONL for webchat/Feishu-style runs. Co-authored-by: Cursor <[email protected]> * fix(agents): narrow embedded transcript mirror with assistant dedupe (openclaw#77823) Embedded runs pass embeddedAssistantGapFill so persistCliTurnTranscript skips re-appending the user prompt Pi owns and only appends assistant text when the transcript tail lacks equivalent visible assistant content. Adds CLI transcript regression coverage for gap-fill dedupe. Co-authored-by: Cursor <[email protected]> * fix(agents): dedupe embedded transcript gap fill by tail * fix: persist embedded session transcripts (openclaw#77839) (thanks @neeravmakwana) --------- Co-authored-by: Cursor <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…eeravmakwana) * fix(agents): persist embedded runner session transcripts (openclaw#77823) Run persistCliTurnTranscript and post-turn compaction for executionTrace.runner embedded, matching CLI turns so assistant text reaches session JSONL for webchat/Feishu-style runs. Co-authored-by: Cursor <[email protected]> * fix(agents): narrow embedded transcript mirror with assistant dedupe (openclaw#77823) Embedded runs pass embeddedAssistantGapFill so persistCliTurnTranscript skips re-appending the user prompt Pi owns and only appends assistant text when the transcript tail lacks equivalent visible assistant content. Adds CLI transcript regression coverage for gap-fill dedupe. Co-authored-by: Cursor <[email protected]> * fix(agents): dedupe embedded transcript gap fill by tail * fix: persist embedded session transcripts (openclaw#77839) (thanks @neeravmakwana) --------- Co-authored-by: Cursor <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…eeravmakwana) * fix(agents): persist embedded runner session transcripts (openclaw#77823) Run persistCliTurnTranscript and post-turn compaction for executionTrace.runner embedded, matching CLI turns so assistant text reaches session JSONL for webchat/Feishu-style runs. * fix(agents): narrow embedded transcript mirror with assistant dedupe (openclaw#77823) Embedded runs pass embeddedAssistantGapFill so persistCliTurnTranscript skips re-appending the user prompt Pi owns and only appends assistant text when the transcript tail lacks equivalent visible assistant content. Adds CLI transcript regression coverage for gap-fill dedupe. * fix(agents): dedupe embedded transcript gap fill by tail * fix: persist embedded session transcripts (openclaw#77839) (thanks @neeravmakwana) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
…eeravmakwana) * fix(agents): persist embedded runner session transcripts (openclaw#77823) Run persistCliTurnTranscript and post-turn compaction for executionTrace.runner embedded, matching CLI turns so assistant text reaches session JSONL for webchat/Feishu-style runs. Co-authored-by: Cursor <[email protected]> * fix(agents): narrow embedded transcript mirror with assistant dedupe (openclaw#77823) Embedded runs pass embeddedAssistantGapFill so persistCliTurnTranscript skips re-appending the user prompt Pi owns and only appends assistant text when the transcript tail lacks equivalent visible assistant content. Adds CLI transcript regression coverage for gap-fill dedupe. Co-authored-by: Cursor <[email protected]> * fix(agents): dedupe embedded transcript gap fill by tail * fix: persist embedded session transcripts (openclaw#77839) (thanks @neeravmakwana) --------- Co-authored-by: Cursor <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Summary
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-commandonly calledpersistCliTurnTranscriptwhenrunner === "cli". The PI embedded path tags runs withrunner: "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
persistCliTurnTranscript+persistTextTurnTranscriptpath already used for CLI; no new persistence format or trust boundary.persistAcpTurnTranscript); this change does not alter ACP behavior.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
agentCommandpath and assertspersistCliTurnTranscriptis invoked once withexecutionTrace.runner === "embedded"and the user body passed through.Tests run
git diff --checkpnpm vitest run src/commands/agent.test.tspnpm check:changed— typecheck core failed onmainas well (Cannot find module 'web-tree-sitter') in this checkout; unrelated to this diff.Out of scope
persistCliTurnTranscript/runCliTurnCompactionLifecycle(behavior is already shared with embedded Pi).EmbeddedPiRunResult.Fixes #77823.
Made with Cursor