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

推荐订阅源

J
Java Code Geeks
腾讯CDC
Jina AI
Jina AI
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
WordPress大学
WordPress大学
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
小众软件
小众软件
M
MIT News - Artificial intelligence
MyScale Blog
MyScale Blog
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
月光博客
月光博客
L
LangChain Blog
F
Fortinet All Blogs
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - Franky
C
Check Point Blog
U
Unit 42
人人都是产品经理
人人都是产品经理

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(codex): rotate incompatible context-engine threads (#...
jalehman · 2026-05-14 · via Recent Commits to openclaw:main

@@ -4470,6 +4470,180 @@ describe("runCodexAppServerAttempt", () => {

44704470

expect(request.mock.calls.map(([method]) => method)).toEqual(["thread/start", "thread/resume"]);

44714471

});

447244724473+

it("starts a fresh Codex thread for legacy context-engine sidecars without metadata", async () => {

4474+

const sessionFile = path.join(tempDir, "session.jsonl");

4475+

const workspaceDir = path.join(tempDir, "workspace");

4476+

await writeExistingBinding(sessionFile, workspaceDir, { dynamicToolsFingerprint: "[]" });

4477+

const params = createParams(sessionFile, workspaceDir);

4478+

params.contextEngine = {

4479+

info: { id: "lossless-claw", name: "Lossless Claw", ownsCompaction: true },

4480+

assemble: vi.fn(),

4481+

compact: vi.fn(),

4482+

} as never;

4483+

params.contextTokenBudget = 400_000;

4484+

const appServer = createThreadLifecycleAppServerOptions();

4485+

const request = vi.fn(async (method: string) => {

4486+

if (method === "thread/start") {

4487+

return threadStartResult("thread-fresh");

4488+

}

4489+

throw new Error(`unexpected method: ${method}`);

4490+

});

4491+4492+

const binding = await startOrResumeThread({

4493+

client: { request } as never,

4494+

params,

4495+

cwd: workspaceDir,

4496+

dynamicTools: [],

4497+

appServer,

4498+

});

4499+4500+

expect(binding.threadId).toBe("thread-fresh");

4501+

expect(binding.lifecycle).toEqual({

4502+

action: "started",

4503+

rotatedContextEngineBinding: true,

4504+

});

4505+

expect(request.mock.calls.map(([method]) => method)).toEqual(["thread/start"]);

4506+

const savedBinding = await readCodexAppServerBinding(sessionFile);

4507+

expect(savedBinding?.contextEngine?.engineId).toBe("lossless-claw");

4508+

expect(savedBinding?.contextEngine?.policyFingerprint).toContain('"contextTokenBudget":400000');

4509+

});

4510+4511+

it("resumes a Codex thread when context-engine sidecar metadata is compatible", async () => {

4512+

const sessionFile = path.join(tempDir, "session.jsonl");

4513+

const workspaceDir = path.join(tempDir, "workspace");

4514+

const contextEngine = {

4515+

schemaVersion: 1 as const,

4516+

engineId: "lossless-claw",

4517+

policyFingerprint:

4518+

'{"schemaVersion":1,"engineId":"lossless-claw","ownsCompaction":true,"contextTokenBudget":400000,"projectionMaxChars":1000000}',

4519+

};

4520+

await writeExistingBinding(sessionFile, workspaceDir, {

4521+

dynamicToolsFingerprint: "[]",

4522+

contextEngine,

4523+

});

4524+

const params = createParams(sessionFile, workspaceDir);

4525+

params.contextEngine = {

4526+

info: { id: "lossless-claw", name: "Lossless Claw", ownsCompaction: true },

4527+

assemble: vi.fn(),

4528+

compact: vi.fn(),

4529+

} as never;

4530+

params.contextTokenBudget = 400_000;

4531+

const appServer = createThreadLifecycleAppServerOptions();

4532+

const request = vi.fn(async (method: string) => {

4533+

if (method === "thread/resume") {

4534+

return threadStartResult("thread-existing");

4535+

}

4536+

throw new Error(`unexpected method: ${method}`);

4537+

});

4538+4539+

const binding = await startOrResumeThread({

4540+

client: { request } as never,

4541+

params,

4542+

cwd: workspaceDir,

4543+

dynamicTools: [],

4544+

appServer,

4545+

});

4546+4547+

expect(binding.threadId).toBe("thread-existing");

4548+

expect(binding.lifecycle).toEqual({ action: "resumed" });

4549+

expect(request.mock.calls.map(([method]) => method)).toEqual(["thread/resume"]);

4550+

});

4551+4552+

it("starts a fresh Codex thread when context-engine sidecar metadata is no longer active", async () => {

4553+

const sessionFile = path.join(tempDir, "session.jsonl");

4554+

const workspaceDir = path.join(tempDir, "workspace");

4555+

await writeExistingBinding(sessionFile, workspaceDir, {

4556+

dynamicToolsFingerprint: "[]",

4557+

contextEngine: {

4558+

schemaVersion: 1,

4559+

engineId: "lossless-claw",

4560+

policyFingerprint:

4561+

'{"schemaVersion":1,"engineId":"lossless-claw","ownsCompaction":true,"contextTokenBudget":400000,"projectionMaxChars":1000000}',

4562+

},

4563+

});

4564+

const params = createParams(sessionFile, workspaceDir);

4565+

const appServer = createThreadLifecycleAppServerOptions();

4566+

const request = vi.fn(async (method: string) => {

4567+

if (method === "thread/start") {

4568+

return threadStartResult("thread-fresh");

4569+

}

4570+

throw new Error(`unexpected method: ${method}`);

4571+

});

4572+4573+

const binding = await startOrResumeThread({

4574+

client: { request } as never,

4575+

params,

4576+

cwd: workspaceDir,

4577+

dynamicTools: [],

4578+

appServer,

4579+

});

4580+4581+

expect(binding.threadId).toBe("thread-fresh");

4582+

expect(binding.lifecycle).toEqual({

4583+

action: "started",

4584+

rotatedContextEngineBinding: true,

4585+

});

4586+

expect(request.mock.calls.map(([method]) => method)).toEqual(["thread/start"]);

4587+

const savedBinding = await readCodexAppServerBinding(sessionFile);

4588+

expect(savedBinding?.contextEngine).toBeUndefined();

4589+

});

4590+4591+

it("starts a fresh Codex thread when context-engine policy metadata changes", async () => {

4592+

const sessionFile = path.join(tempDir, "session.jsonl");

4593+

const workspaceDir = path.join(tempDir, "workspace");

4594+

await writeExistingBinding(sessionFile, workspaceDir, {

4595+

dynamicToolsFingerprint: "[]",

4596+

contextEngine: {

4597+

schemaVersion: 1,

4598+

engineId: "lossless-claw",

4599+

policyFingerprint:

4600+

'{"schemaVersion":1,"engineId":"lossless-claw","engineVersion":"1.0.0","ownsCompaction":true,"turnMaintenanceMode":"foreground","citationsMode":"inline","contextTokenBudget":400000,"projectionMaxChars":1000000}',

4601+

},

4602+

});

4603+

const params = createParams(sessionFile, workspaceDir);

4604+

params.contextEngine = {

4605+

info: {

4606+

id: "lossless-claw",

4607+

name: "Lossless Claw",

4608+

version: "1.0.1",

4609+

ownsCompaction: true,

4610+

turnMaintenanceMode: "foreground",

4611+

},

4612+

assemble: vi.fn(),

4613+

compact: vi.fn(),

4614+

} as never;

4615+

params.config = { memory: { citations: "inline" } } as never;

4616+

params.contextTokenBudget = 400_000;

4617+

const appServer = createThreadLifecycleAppServerOptions();

4618+

const request = vi.fn(async (method: string) => {

4619+

if (method === "thread/start") {

4620+

return threadStartResult("thread-fresh");

4621+

}

4622+

throw new Error(`unexpected method: ${method}`);

4623+

});

4624+4625+

const binding = await startOrResumeThread({

4626+

client: { request } as never,

4627+

params,

4628+

cwd: workspaceDir,

4629+

dynamicTools: [],

4630+

appServer,

4631+

});

4632+4633+

expect(binding.threadId).toBe("thread-fresh");

4634+

expect(binding.lifecycle).toEqual({

4635+

action: "started",

4636+

rotatedContextEngineBinding: true,

4637+

});

4638+

expect(request.mock.calls.map(([method]) => method)).toEqual(["thread/start"]);

4639+

const savedBinding = await readCodexAppServerBinding(sessionFile);

4640+

expect(savedBinding?.contextEngine?.policyFingerprint).toContain('"engineVersion":"1.0.1"');

4641+

expect(savedBinding?.contextEngine?.policyFingerprint).toContain(

4642+

'"turnMaintenanceMode":"foreground"',

4643+

);

4644+

expect(savedBinding?.contextEngine?.policyFingerprint).toContain('"citationsMode":"inline"');

4645+

});

4646+44734647

it("keeps the previous dynamic tool fingerprint for transient no-tool maintenance turns", async () => {

44744648

const sessionFile = path.join(tempDir, "session.jsonl");

44754649

const workspaceDir = path.join(tempDir, "workspace");