惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
Jina AI
Jina AI
雷峰网
雷峰网
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
博客园 - 司徒正美
罗磊的独立博客
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Vercel News
Vercel News
A
About on SuperTechFans
I
InfoQ
D
DataBreaches.Net
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: persist embedded session transcripts (#77839) (thank...
neeravmakwan · 2026-05-06 · via Recent Commits to openclaw:main

@@ -3,6 +3,7 @@ import os from "node:os";

33

import path from "node:path";

44

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

55

import type { SessionEntry } from "../../config/sessions.js";

6+

import { appendSessionTranscriptMessage } from "../../config/sessions/transcript-append.js";

67

import type { OpenClawConfig } from "../../config/types.openclaw.js";

78

import { FailoverError } from "../failover-error.js";

89

import { runEmbeddedPiAgent, type EmbeddedPiRunResult } from "../pi-embedded.js";

@@ -418,6 +419,130 @@ describe("CLI attempt execution", () => {

418419

});

419420

});

420421422+

it("embedded assistant gap-fill skips user mirror and dedupes identical assistant tails", async () => {

423+

const sessionKey = "agent:main:subagent:embedded-gap-fill";

424+

const sessionEntry: SessionEntry = {

425+

sessionId: "session-embedded-gap-fill",

426+

updatedAt: Date.now(),

427+

};

428+

const sessionStore: Record<string, SessionEntry> = { [sessionKey]: sessionEntry };

429+

await fs.writeFile(storePath, JSON.stringify(sessionStore, null, 2), "utf-8");

430+431+

const result = makeCliResult("already mirrored");

432+

result.meta.executionTrace = {

433+

winnerProvider: "anthropic",

434+

winnerModel: "claude-opus-4-6",

435+

fallbackUsed: false,

436+

runner: "embedded",

437+

};

438+439+

const updatedFirst = await persistCliTurnTranscript({

440+

body: "ignored for gap fill",

441+

transcriptBody: "also ignored",

442+

result,

443+

sessionId: sessionEntry.sessionId,

444+

sessionKey,

445+

sessionEntry,

446+

sessionStore,

447+

storePath,

448+

sessionAgentId: "main",

449+

sessionCwd: tmpDir,

450+

config: {},

451+

embeddedAssistantGapFill: true,

452+

});

453+454+

let messages = await readSessionMessages(updatedFirst?.sessionFile ?? "");

455+

expect(messages).toHaveLength(1);

456+

expect(messages[0]).toMatchObject({

457+

role: "assistant",

458+

content: [{ type: "text", text: "already mirrored" }],

459+

});

460+461+

await persistCliTurnTranscript({

462+

body: "still ignored",

463+

result,

464+

sessionId: sessionEntry.sessionId,

465+

sessionKey,

466+

sessionEntry: updatedFirst,

467+

sessionStore,

468+

storePath,

469+

sessionAgentId: "main",

470+

sessionCwd: tmpDir,

471+

config: {},

472+

embeddedAssistantGapFill: true,

473+

});

474+475+

messages = await readSessionMessages(updatedFirst?.sessionFile ?? "");

476+

expect(messages).toHaveLength(1);

477+

});

478+479+

it("embedded assistant gap-fill appends repeated replies after a user tail", async () => {

480+

const sessionKey = "agent:main:subagent:embedded-repeated-reply";

481+

const sessionEntry: SessionEntry = {

482+

sessionId: "session-embedded-repeated-reply",

483+

updatedAt: Date.now(),

484+

};

485+

const sessionStore: Record<string, SessionEntry> = { [sessionKey]: sessionEntry };

486+

await fs.writeFile(storePath, JSON.stringify(sessionStore, null, 2), "utf-8");

487+488+

const result = makeCliResult("same answer");

489+

result.meta.executionTrace = {

490+

winnerProvider: "anthropic",

491+

winnerModel: "claude-opus-4-6",

492+

fallbackUsed: false,

493+

runner: "embedded",

494+

};

495+496+

const updatedFirst = await persistCliTurnTranscript({

497+

body: "ignored for gap fill",

498+

result,

499+

sessionId: sessionEntry.sessionId,

500+

sessionKey,

501+

sessionEntry,

502+

sessionStore,

503+

storePath,

504+

sessionAgentId: "main",

505+

sessionCwd: tmpDir,

506+

config: {},

507+

embeddedAssistantGapFill: true,

508+

});

509+

const sessionFile = updatedFirst?.sessionFile;

510+

expect(sessionFile).toBeTruthy();

511+512+

await appendSessionTranscriptMessage({

513+

transcriptPath: sessionFile!,

514+

sessionId: sessionEntry.sessionId,

515+

cwd: tmpDir,

516+

config: {},

517+

message: {

518+

role: "user",

519+

content: "next prompt",

520+

timestamp: Date.now(),

521+

},

522+

});

523+524+

await persistCliTurnTranscript({

525+

body: "still ignored",

526+

result,

527+

sessionId: sessionEntry.sessionId,

528+

sessionKey,

529+

sessionEntry: updatedFirst,

530+

sessionStore,

531+

storePath,

532+

sessionAgentId: "main",

533+

sessionCwd: tmpDir,

534+

config: {},

535+

embeddedAssistantGapFill: true,

536+

});

537+538+

const messages = await readSessionMessages(sessionFile!);

539+

expect(messages).toHaveLength(3);

540+

expect(messages.map((message) => message.role)).toEqual(["assistant", "user", "assistant"]);

541+

expect(messages[2]).toMatchObject({

542+

content: [{ type: "text", text: "same answer" }],

543+

});

544+

});

545+421546

it("persists the transcript body instead of runtime-only CLI prompt context", async () => {

422547

const sessionKey = "agent:main:subagent:cli-transcript-clean";

423548

const sessionEntry: SessionEntry = {