Skip to content

Commit 5dcee2e

Browse files
committed
Keep embedded delivery mirrors out of provider replay
Embedded assistant gap-fill transcript rows are display-only delivery state. Store them as OpenClaw delivery mirrors so provider replay filters do not mistake child provider text for provider conversation state. Constraint: Embedded gap-fill transcript rows are display-only state and must match existing transcript-only replay filters. Rejected: Preserve child runtime provider/model metadata for gap-fill rows | that makes display mirrors look like provider conversation state. Confidence: high Scope-risk: narrow Directive: Do not tag embedded assistant gap-fill mirrors with child provider/model metadata unless replay filters are updated with an equivalent transcript-only contract. Tested: git diff --check origin/main...HEAD; oxlint changed files; targeted Vitest attempt-execution/replay-history suites (3 files, 95 passed); tsgo core-test project; codex review --base origin/main. Not-tested: No live provider-managed thinking/signature conversation was replayed end to end; external raw transcript consumers may observe the intentional gap-fill metadata change.
1 parent f789081 commit 5dcee2e

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

src/agents/command/attempt-execution.cli.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ async function readSessionMessages(sessionFile: string) {
9393
.filter((entry) => entry.type === "message")
9494
.map(
9595
(entry) =>
96-
entry.message as { role?: string; content?: unknown; provider?: string; model?: string },
96+
entry.message as {
97+
role?: string;
98+
content?: unknown;
99+
api?: string;
100+
provider?: string;
101+
model?: string;
102+
},
97103
);
98104
}
99105

@@ -770,6 +776,9 @@ describe("CLI attempt execution", () => {
770776
expect(messages).toHaveLength(1);
771777
expectRecordFields(requireRecord(messages[0], "assistant message"), {
772778
role: "assistant",
779+
api: "openai-responses",
780+
provider: "openclaw",
781+
model: "delivery-mirror",
773782
content: [{ type: "text", text: "already mirrored" }],
774783
});
775784

src/agents/command/attempt-execution.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,18 @@ export async function persistCliTurnTranscript(params: {
365365
const provider = params.result.meta.agentMeta?.provider?.trim() ?? "cli";
366366
const model = params.result.meta.agentMeta?.model?.trim() ?? "default";
367367
const gapFill = params.embeddedAssistantGapFill ?? false;
368+
const assistant = gapFill
369+
? {
370+
api: "openai-responses",
371+
provider: "openclaw",
372+
model: "delivery-mirror",
373+
}
374+
: {
375+
api: "cli",
376+
provider,
377+
model,
378+
usage: params.result.meta.agentMeta?.usage,
379+
};
368380

369381
return await persistTextTurnTranscript({
370382
body: gapFill ? "" : params.body,
@@ -381,12 +393,7 @@ export async function persistCliTurnTranscript(params: {
381393
sessionCwd: params.sessionCwd,
382394
config: params.config,
383395
embeddedAssistantGapFill: gapFill,
384-
assistant: {
385-
api: "cli",
386-
provider,
387-
model,
388-
usage: params.result.meta.agentMeta?.usage,
389-
},
396+
assistant,
390397
});
391398
}
392399

0 commit comments

Comments
 (0)