docs: clarify Pi transcript ownership · openclaw/openclaw@66267b5
steipete
·
2026-05-04
·
via Recent Commits to openclaw:main
File tree
agents/pi-embedded-runner
| Original file line number | Diff line number | Diff line change |
|---|
@@ -806,6 +806,8 @@ export async function runEmbeddedPiAgent(
|
806 | 806 | let activeSessionId = params.sessionId; |
807 | 807 | let activeSessionFile = params.sessionFile; |
808 | 808 | let suppressNextUserMessagePersistence = params.suppressNextUserMessagePersistence ?? false; |
| 809 | +// Pi owns JSONL persistence; this marker only lets the outer retry avoid |
| 810 | +// replaying the same inbound channel message after overflow compaction. |
809 | 811 | let lastPersistedCurrentMessageId: string | number | undefined; |
810 | 812 | const onUserMessagePersisted: RunEmbeddedPiAgentParams["onUserMessagePersisted"] = ( |
811 | 813 | message, |
@@ -1648,6 +1650,9 @@ export async function runEmbeddedPiAgent(
|
1648 | 1650 | params.currentMessageId !== undefined && |
1649 | 1651 | params.currentMessageId === lastPersistedCurrentMessageId |
1650 | 1652 | ) { |
| 1653 | +// The first attempt reached Pi far enough to persist this user turn. |
| 1654 | +// Retrying the original prompt would replay it, so resume from the |
| 1655 | +// compacted transcript and suppress the next user append. |
1651 | 1656 | nextAttemptPromptOverride = MID_TURN_PRECHECK_CONTINUATION_PROMPT; |
1652 | 1657 | suppressNextUserMessagePersistence = true; |
1653 | 1658 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -755,6 +755,8 @@ describe("chat directive tag stripping for non-streaming final payloads", () =>
|
755 | 755 | update.message !== null && |
756 | 756 | (update.message as { role?: unknown }).role === "assistant", |
757 | 757 | ); |
| 758 | +// Agent-run delivery is a live projection; Pi message_end owns persisted |
| 759 | +// assistant transcript entries, including stale media/text final payloads. |
758 | 760 | expect(assistantUpdates).toEqual([]); |
759 | 761 | const transcriptLines = fs |
760 | 762 | .readFileSync(mockState.transcriptPath, "utf-8") |
@@ -804,6 +806,8 @@ describe("chat directive tag stripping for non-streaming final payloads", () =>
|
804 | 806 | update.message !== null && |
805 | 807 | (update.message as { role?: unknown }).role === "assistant", |
806 | 808 | ); |
| 809 | +// Normal agent-run final text must not be mirrored into JSONL by WebChat; |
| 810 | +// Pi persists the model-visible assistant turn from message_end. |
807 | 811 | expect(assistantUpdates).toEqual([]); |
808 | 812 | const transcriptLines = fs |
809 | 813 | .readFileSync(mockState.transcriptPath, "utf-8") |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。