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

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
The Cloudflare Blog
IT之家
IT之家
雷峰网
雷峰网
小众软件
小众软件
博客园 - 叶小钗
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 【当耐特】
V
V2EX
博客园_首页
T
Tailwind CSS 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(agents/cli-runner): invalidate sessions whose transcr...
adele-with-a · 2026-05-30 · via Recent Commits to openclaw:main

@@ -147,6 +147,27 @@ function createCliBackendConfig(

147147

} satisfies OpenClawConfig;

148148

}

149149150+

function setClaudeCliBackendForPrepareTest() {

151+

cliBackendsTesting.setDepsForTest({

152+

resolvePluginSetupCliBackend: () => undefined,

153+

resolveRuntimeCliBackends: () => [

154+

{

155+

id: "claude-cli",

156+

pluginId: "anthropic",

157+

bundleMcp: false,

158+

config: {

159+

command: "claude",

160+

args: ["--print"],

161+

resumeArgs: ["--resume", "{sessionId}"],

162+

output: "jsonl",

163+

input: "stdin",

164+

sessionMode: "existing",

165+

},

166+

},

167+

],

168+

});

169+

}

170+150171

function createSessionFile() {

151172

const dir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-prepare-"));

152173

vi.stubEnv("OPENCLAW_STATE_DIR", dir);

@@ -1407,27 +1428,12 @@ describe("shouldSkipLocalCliCredentialEpoch", () => {

14071428

it("drops the claude-cli sessionId when the on-disk transcript is missing (#77011)", async () => {

14081429

const { dir, sessionFile } = createSessionFile();

14091430

try {

1410-

cliBackendsTesting.setDepsForTest({

1411-

resolvePluginSetupCliBackend: () => undefined,

1412-

resolveRuntimeCliBackends: () => [

1413-

{

1414-

id: "claude-cli",

1415-

pluginId: "anthropic",

1416-

bundleMcp: false,

1417-

config: {

1418-

command: "claude",

1419-

args: ["--print"],

1420-

resumeArgs: ["--resume", "{sessionId}"],

1421-

output: "jsonl",

1422-

input: "stdin",

1423-

sessionMode: "existing",

1424-

},

1425-

},

1426-

],

1427-

});

1431+

setClaudeCliBackendForPrepareTest();

14281432

const transcriptCheck = vi.fn(async () => false);

1433+

const orphanCheck = vi.fn(async () => true);

14291434

setCliRunnerPrepareTestDeps({

14301435

claudeCliSessionTranscriptHasContent: transcriptCheck,

1436+

claudeCliSessionTranscriptHasOrphanedToolUse: orphanCheck,

14311437

});

1432143814331439

const context = await prepareCliRunContext({

@@ -1449,36 +1455,78 @@ describe("shouldSkipLocalCliCredentialEpoch", () => {

14491455

sessionId: "stale-claude-sid",

14501456

workspaceDir: dir,

14511457

});

1458+

expect(orphanCheck).not.toHaveBeenCalled();

14521459

expect(context.reusableCliSession).toEqual({ invalidatedReason: "missing-transcript" });

14531460

} finally {

14541461

fs.rmSync(dir, { recursive: true, force: true });

14551462

}

14561463

});

145714641458-

it("keeps the claude-cli sessionId when the on-disk transcript is present", async () => {

1465+

it("invalidates orphaned claude-cli transcripts and reseeds OpenClaw history", async () => {

14591466

const { dir, sessionFile } = createSessionFile();

1467+

appendTranscriptEntry(sessionFile, {

1468+

id: "msg-1",

1469+

parentId: null,

1470+

timestamp: new Date(1).toISOString(),

1471+

message: {

1472+

role: "user",

1473+

content: "prior orphan-safe ask",

1474+

timestamp: 1,

1475+

},

1476+

});

1477+14601478

try {

1461-

cliBackendsTesting.setDepsForTest({

1462-

resolvePluginSetupCliBackend: () => undefined,

1463-

resolveRuntimeCliBackends: () => [

1464-

{

1465-

id: "claude-cli",

1466-

pluginId: "anthropic",

1467-

bundleMcp: false,

1468-

config: {

1469-

command: "claude",

1470-

args: ["--print"],

1471-

resumeArgs: ["--resume", "{sessionId}"],

1472-

output: "jsonl",

1473-

input: "stdin",

1474-

sessionMode: "existing",

1475-

},

1476-

},

1477-

],

1479+

setClaudeCliBackendForPrepareTest();

1480+

const transcriptCheck = vi.fn(async () => true);

1481+

const orphanCheck = vi.fn(async () => true);

1482+

setCliRunnerPrepareTestDeps({

1483+

claudeCliSessionTranscriptHasContent: transcriptCheck,

1484+

claudeCliSessionTranscriptHasOrphanedToolUse: orphanCheck,

14781485

});

1486+1487+

const context = await prepareCliRunContext({

1488+

sessionId: "session-test",

1489+

sessionKey: "agent:main:telegram:direct:peer",

1490+

sessionFile,

1491+

workspaceDir: dir,

1492+

prompt: "follow-up",

1493+

provider: "claude-cli",

1494+

model: "opus",

1495+

timeoutMs: 1_000,

1496+

runId: "run-orphan-tool-use",

1497+

cliSessionBinding: {

1498+

sessionId: "orphaned-claude-sid",

1499+

cwdHash: hashCliSessionText(dir),

1500+

},

1501+

cliSessionId: "orphaned-claude-sid",

1502+

config: createCliBackendConfig(),

1503+

});

1504+1505+

expect(transcriptCheck).toHaveBeenCalledWith({

1506+

sessionId: "orphaned-claude-sid",

1507+

workspaceDir: dir,

1508+

});

1509+

expect(orphanCheck).toHaveBeenCalledWith({

1510+

sessionId: "orphaned-claude-sid",

1511+

workspaceDir: dir,

1512+

});

1513+

expect(context.reusableCliSession).toEqual({ invalidatedReason: "orphaned-tool-use" });

1514+

expect(context.openClawHistoryPrompt).toContain("prior orphan-safe ask");

1515+

expect(context.openClawHistoryPrompt).toContain("follow-up");

1516+

} finally {

1517+

fs.rmSync(dir, { recursive: true, force: true });

1518+

}

1519+

});

1520+1521+

it("keeps the claude-cli sessionId when the on-disk transcript is present", async () => {

1522+

const { dir, sessionFile } = createSessionFile();

1523+

try {

1524+

setClaudeCliBackendForPrepareTest();

14791525

const transcriptCheck = vi.fn(async () => true);

1526+

const orphanCheck = vi.fn(async () => false);

14801527

setCliRunnerPrepareTestDeps({

14811528

claudeCliSessionTranscriptHasContent: transcriptCheck,

1529+

claudeCliSessionTranscriptHasOrphanedToolUse: orphanCheck,

14821530

});

1483153114841532

const context = await prepareCliRunContext({

@@ -1500,6 +1548,10 @@ describe("shouldSkipLocalCliCredentialEpoch", () => {

15001548

sessionId: "live-claude-sid",

15011549

workspaceDir: dir,

15021550

});

1551+

expect(orphanCheck).toHaveBeenCalledWith({

1552+

sessionId: "live-claude-sid",

1553+

workspaceDir: dir,

1554+

});

15031555

expect(context.reusableCliSession).toEqual({ sessionId: "live-claude-sid" });

15041556

} finally {

15051557

fs.rmSync(dir, { recursive: true, force: true });