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

推荐订阅源

IT之家
IT之家
Microsoft Azure Blog
Microsoft Azure Blog
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
小众软件
小众软件
F
Fortinet All Blogs
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
宝玉的分享
宝玉的分享
有赞技术团队
有赞技术团队
J
Java Code Geeks
WordPress大学
WordPress大学
The Cloudflare 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): clear unflushed cli bindings · openclaw/open...
obviyus · 2026-05-30 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -621,6 +621,7 @@ export async function runPreparedCliAgent(

621621

},

622622

}

623623

: {}),

624+

...(unflushedCliSessionId ? { clearCliSessionBinding: true } : {}),

624625

},

625626

},

626627

};

Original file line numberDiff line numberDiff line change

@@ -478,6 +478,82 @@ describe("updateSessionStoreAfterAgentRun", () => {

478478

});

479479

});

480480
481+

it("clears stale CLI bindings when a successful run reports an unflushed replacement", async () => {

482+

await withTempSessionStore(async ({ storePath }) => {

483+

const cfg = {

484+

agents: {

485+

defaults: {

486+

cliBackends: {

487+

"claude-cli": {

488+

command: "claude",

489+

},

490+

},

491+

},

492+

},

493+

} as OpenClawConfig;

494+

const sessionKey = "agent:main:explicit:test-clear-unflushed-cli";

495+

const sessionId = "test-openclaw-session";

496+

const sessionStore: Record<string, SessionEntry> = {

497+

[sessionKey]: {

498+

sessionId,

499+

updatedAt: 1,

500+

cliSessionBindings: {

501+

"claude-cli": {

502+

sessionId: "stale-cli-session",

503+

authEpoch: "old-epoch",

504+

},

505+

"codex-cli": {

506+

sessionId: "codex-session",

507+

},

508+

},

509+

cliSessionIds: {

510+

"claude-cli": "stale-cli-session",

511+

"codex-cli": "codex-session",

512+

},

513+

claudeCliSessionId: "stale-cli-session",

514+

},

515+

};

516+

await fs.writeFile(storePath, JSON.stringify(sessionStore, null, 2));

517+
518+

const result: EmbeddedAgentRunResult = {

519+

meta: {

520+

durationMs: 1,

521+

agentMeta: {

522+

sessionId: "",

523+

provider: "claude-cli",

524+

model: "claude-sonnet-4-6",

525+

clearCliSessionBinding: true,

526+

},

527+

},

528+

};

529+
530+

await updateSessionStoreAfterAgentRun({

531+

cfg,

532+

sessionId,

533+

sessionKey,

534+

storePath,

535+

sessionStore,

536+

contextTokensOverride: 200_000,

537+

defaultProvider: "claude-cli",

538+

defaultModel: "claude-sonnet-4-6",

539+

result,

540+

});

541+
542+

expect(sessionStore[sessionKey]?.cliSessionBindings?.["claude-cli"]).toBeUndefined();

543+

expect(sessionStore[sessionKey]?.cliSessionBindings?.["codex-cli"]).toEqual({

544+

sessionId: "codex-session",

545+

});

546+

expect(sessionStore[sessionKey]?.cliSessionIds?.["claude-cli"]).toBeUndefined();

547+

expect(sessionStore[sessionKey]?.cliSessionIds?.["codex-cli"]).toBe("codex-session");

548+

expect(sessionStore[sessionKey]?.claudeCliSessionId).toBeUndefined();

549+
550+

const persisted = loadSessionStore(storePath, { skipCache: true });

551+

expect(persisted[sessionKey]?.cliSessionBindings?.["claude-cli"]).toBeUndefined();

552+

expect(persisted[sessionKey]?.cliSessionIds?.["claude-cli"]).toBeUndefined();

553+

expect(persisted[sessionKey]?.claudeCliSessionId).toBeUndefined();

554+

});

555+

});

556+
481557

it("preserves ACP metadata when caller has a stale session snapshot", async () => {

482558

await withTempSessionStore(async ({ storePath }) => {

483559

const sessionKey = "agent:codex:acp:test-acp-preserve";

Original file line numberDiff line numberDiff line change

@@ -189,7 +189,9 @@ export async function updateSessionStoreAfterAgentRun(params: {

189189

}

190190

if (isCliProvider(providerUsed, cfg)) {

191191

const cliSessionBinding = result.meta.agentMeta?.cliSessionBinding;

192-

if (cliSessionBinding?.sessionId?.trim()) {

192+

if (result.meta.agentMeta?.clearCliSessionBinding === true) {

193+

clearCliSession(next, providerUsed);

194+

} else if (cliSessionBinding?.sessionId?.trim()) {

193195

setCliSessionBinding(next, providerUsed, cliSessionBinding);

194196

} else {

195197

const cliSessionId = result.meta.agentMeta?.sessionId?.trim();

Original file line numberDiff line numberDiff line change

@@ -22,6 +22,7 @@ export type EmbeddedAgentMeta = {

2222

agentHarnessId?: string;

2323

fallbackAttempts?: FallbackAttempt[];

2424

cliSessionBinding?: CliSessionBinding;

25+

clearCliSessionBinding?: boolean;

2526

compactionCount?: number;

2627

/**

2728

* Token count estimate after the most recent successful auto-compaction.