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

推荐订阅源

博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
美团技术团队
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
有赞技术团队
有赞技术团队
GbyAI
GbyAI
宝玉的分享
宝玉的分享
腾讯CDC
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
月光博客
月光博客
MyScale Blog
MyScale Blog
Last Week in AI
Last Week in AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | 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(acp): refresh runtime handles on config changes (#822...
giodl73-repo · 2026-05-17 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,4 +1,5 @@

11

import { resolveAgentTimeoutMs } from "../../agents/timeout.js";

2+

import { resolveRuntimeConfigCacheKey } from "../../config/runtime-snapshot.js";

23

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

34

import { logVerbose } from "../../globals.js";

45

import { formatErrorMessage } from "../../infra/errors.js";

@@ -424,6 +425,7 @@ export class AcpSessionManager {

424425

agent,

425426

mode: input.mode,

426427

cwd: effectiveCwd,

428+

configSignature: resolveRuntimeConfigCacheKey(input.cfg),

427429

});

428430

return {

429431

runtime,

@@ -1469,12 +1471,14 @@ export class AcpSessionManager {

14691471

const model = normalizeText(runtimeOptions.model);

14701472

const thinking = normalizeText(runtimeOptions.thinking);

14711473

const configuredBackend = (params.meta.backend || params.cfg.acp?.backend || "").trim();

1474+

const configSignature = resolveRuntimeConfigCacheKey(params.cfg);

14721475

const cached = this.getCachedRuntimeState(params.sessionKey);

14731476

if (cached) {

14741477

const backendMatches = !configuredBackend || cached.backend === configuredBackend;

14751478

const agentMatches = cached.agent === agent;

14761479

const modeMatches = cached.mode === mode;

14771480

const cwdMatches = (cached.cwd ?? "") === (cwd ?? "");

1481+

const configMatches = cached.configSignature === configSignature;

14781482

const handleMatchesMeta = this.runtimeHandleMatchesMeta({

14791483

handle: cached.handle,

14801484

meta: params.meta,

@@ -1484,6 +1488,7 @@ export class AcpSessionManager {

14841488

agentMatches &&

14851489

modeMatches &&

14861490

cwdMatches &&

1491+

configMatches &&

14871492

handleMatchesMeta &&

14881493

(await this.isCachedRuntimeHandleReusable({

14891494

sessionKey: params.sessionKey,

@@ -1638,6 +1643,7 @@ export class AcpSessionManager {

16381643

agent,

16391644

mode,

16401645

cwd: effectiveCwd,

1646+

configSignature,

16411647

appliedControlSignature: undefined,

16421648

});

16431649

return {

Original file line numberDiff line numberDiff line change

@@ -945,6 +945,59 @@ describe("AcpSessionManager", () => {

945945

expect(runtimeState.runTurn).toHaveBeenCalledTimes(2);

946946

});

947947
948+

it("re-ensures cached runtime handles when the runtime config changes", async () => {

949+

const runtimeState = createRuntime();

950+

hoisted.requireAcpRuntimeBackendMock.mockReturnValue({

951+

id: "acpx",

952+

runtime: runtimeState.runtime,

953+

});

954+

hoisted.readAcpSessionEntryMock.mockReturnValue({

955+

sessionKey: "agent:codex:acp:session-1",

956+

storeSessionKey: "agent:codex:acp:session-1",

957+

acp: readySessionMeta(),

958+

});

959+

const allowlistCfg = {

960+

...baseCfg,

961+

tools: {

962+

exec: {

963+

security: "allowlist",

964+

safeBins: ["git"],

965+

},

966+

},

967+

} satisfies OpenClawConfig;

968+

const denyCfg = {

969+

...baseCfg,

970+

tools: {

971+

exec: {

972+

security: "deny",

973+

safeBins: ["node"],

974+

},

975+

},

976+

} satisfies OpenClawConfig;

977+
978+

const manager = new AcpSessionManager();

979+

await manager.runTurn({

980+

cfg: allowlistCfg,

981+

sessionKey: "agent:codex:acp:session-1",

982+

text: "first",

983+

mode: "prompt",

984+

requestId: "r1",

985+

});

986+

await manager.runTurn({

987+

cfg: denyCfg,

988+

sessionKey: "agent:codex:acp:session-1",

989+

text: "second",

990+

mode: "prompt",

991+

requestId: "r2",

992+

});

993+
994+

expect(runtimeState.ensureSession).toHaveBeenCalledTimes(2);

995+

expect(runtimeState.runTurn).toHaveBeenCalledTimes(2);

996+

expectRecordFields(mockCallArg(runtimeState.close), {

997+

reason: "runtime-handle-replaced",

998+

});

999+

});

1000+
9481001

it("re-ensures cached runtime handles when the backend reports the session is dead", async () => {

9491002

const runtimeState = createRuntime();

9501003

runtimeState.getStatus

Original file line numberDiff line numberDiff line change

@@ -29,6 +29,7 @@ function mockState(sessionKey: string): CachedRuntimeState {

2929

backend: "acpx",

3030

agent: "codex",

3131

mode: "persistent",

32+

configSignature: "config:test",

3233

};

3334

}

3435
Original file line numberDiff line numberDiff line change

@@ -7,6 +7,7 @@ export type CachedRuntimeState = {

77

agent: string;

88

mode: AcpRuntimeSessionMode;

99

cwd?: string;

10+

configSignature: string;

1011

appliedControlSignature?: string;

1112

};

1213