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

推荐订阅源

IT之家
IT之家
博客园 - 聂微东
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 司徒正美
爱范儿
爱范儿
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
博客园 - 【当耐特】
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
人人都是产品经理
人人都是产品经理
V
V2EX

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): preserve compatible CLI session runtime pins...
yu-xin-c · 2026-06-14 · via Recent Commits to openclaw:main

@@ -4,6 +4,7 @@ import fs from "node:fs/promises";

44

import os from "node:os";

55

import path from "node:path";

66

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

7+

import { testing as cliBackendsTesting } from "../../agents/cli-backends.js";

78

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

89

import {

910

clearMemoryPluginState,

@@ -226,6 +227,7 @@ describe("runMemoryFlushIfNeeded", () => {

226227227228

afterEach(async () => {

228229

setAgentRunnerMemoryTestDeps();

230+

cliBackendsTesting.resetDepsForTest();

229231

clearMemoryPluginState();

230232

await fs.rm(rootDir, { recursive: true, force: true });

231233

});

@@ -912,6 +914,46 @@ describe("runMemoryFlushIfNeeded", () => {

912914

expect(runEmbeddedAgentMock).not.toHaveBeenCalled();

913915

});

914916917+

it("skips memory flush for compatible CLI session runtime pins", async () => {

918+

cliBackendsTesting.setDepsForTest({

919+

resolveRuntimeCliBackends: () => [

920+

{

921+

id: "claude-cli",

922+

modelProvider: "anthropic",

923+

pluginId: "anthropic",

924+

config: { command: "claude" },

925+

},

926+

],

927+

});

928+

const sessionEntry: SessionEntry = {

929+

sessionId: "session",

930+

updatedAt: Date.now(),

931+

totalTokens: 80_000,

932+

compactionCount: 1,

933+

agentRuntimeOverride: "claude-cli",

934+

};

935+936+

const entry = await runMemoryFlushIfNeeded({

937+

cfg: { agents: { defaults: { compaction: { memoryFlush: {} } } } },

938+

followupRun: createTestFollowupRun({

939+

provider: "anthropic",

940+

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

941+

}),

942+

sessionCtx: { Provider: "whatsapp" } as unknown as TemplateContext,

943+

defaultModel: "anthropic/claude-opus-4-6",

944+

agentCfgContextTokens: 100_000,

945+

resolvedVerboseLevel: "off",

946+

sessionEntry,

947+

sessionStore: { main: sessionEntry },

948+

sessionKey: "main",

949+

isHeartbeat: false,

950+

replyOperation: createReplyOperation(),

951+

});

952+953+

expect(entry).toBe(sessionEntry);

954+

expect(runEmbeddedAgentMock).not.toHaveBeenCalled();

955+

});

956+915957

it("uses runtime policy session key when checking memory-flush sandbox writability", async () => {

916958

const sessionEntry: SessionEntry = {

917959

sessionId: "session",

@@ -1619,6 +1661,61 @@ describe("runMemoryFlushIfNeeded", () => {

16191661

expect(compactEmbeddedAgentSessionMock).not.toHaveBeenCalled();

16201662

});

162116631664+

it("skips preflight compaction for compatible CLI session runtime pins", async () => {

1665+

cliBackendsTesting.setDepsForTest({

1666+

resolveRuntimeCliBackends: () => [

1667+

{

1668+

id: "claude-cli",

1669+

modelProvider: "anthropic",

1670+

pluginId: "anthropic",

1671+

config: { command: "claude" },

1672+

},

1673+

],

1674+

});

1675+

registerMemoryFlushPlanResolverForTest(() => ({

1676+

softThresholdTokens: 4_000,

1677+

forceFlushTranscriptBytes: 1_000_000_000,

1678+

reserveTokensFloor: 0,

1679+

prompt: "Pre-compaction memory flush.\nNO_REPLY",

1680+

systemPrompt: "Write memory to memory/YYYY-MM-DD.md.",

1681+

relativePath: "memory/2023-11-14.md",

1682+

}));

1683+

const sessionEntry: SessionEntry = {

1684+

sessionId: "session",

1685+

updatedAt: Date.now(),

1686+

totalTokens: 347_000,

1687+

totalTokensFresh: true,

1688+

agentRuntimeOverride: "claude-cli",

1689+

};

1690+1691+

const entry = await runPreflightCompactionIfNeeded({

1692+

cfg: {

1693+

models: {

1694+

providers: {

1695+

anthropic: { models: [{ id: "claude-opus-4-6", contextWindow: 350_000 }] },

1696+

},

1697+

},

1698+

agents: { defaults: { compaction: { memoryFlush: {} } } },

1699+

} as never,

1700+

followupRun: createTestFollowupRun({

1701+

provider: "anthropic",

1702+

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

1703+

sessionId: "session",

1704+

sessionKey: "main",

1705+

}),

1706+

defaultModel: "anthropic/claude-opus-4-6",

1707+

sessionEntry,

1708+

sessionStore: { main: sessionEntry },

1709+

sessionKey: "main",

1710+

storePath: path.join(rootDir, "sessions.json"),

1711+

isHeartbeat: false,

1712+

replyOperation: createReplyOperation(),

1713+

});

1714+1715+

expect(entry).toBe(sessionEntry);

1716+

expect(compactEmbeddedAgentSessionMock).not.toHaveBeenCalled();

1717+

});

1718+16221719

it("keeps the OpenAI API context window for persisted OpenClaw runtime overrides", async () => {

16231720

registerMemoryFlushPlanResolverForTest(() => ({

16241721

softThresholdTokens: 4_000,