慣性聚合 高效追讀感興趣之博客、新聞、科技資訊
閱原文 以慣性聚合開啟

推薦訂閱源

博客园 - 司徒正美
V
V2EX
T
Tailwind CSS Blog
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
A
About on SuperTechFans
月光博客
月光博客
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
V
Visual Studio Blog
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI

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 test: trim doctor command hotspots · openclaw/openclaw@c66f16a test: isolate agent auth and spawn hotspots · openclaw/openclaw@9285935 test: stabilize MCP startup disposal race · openclaw/openclaw@dd9d2eb test: merge browser contract server suites · openclaw/openclaw@5817a76 test: narrow ollama provider discovery setup · openclaw/openclaw@a0d9598 build: declare qa-lab aimock runtime dependency · openclaw/openclaw@24431e5 test: speed up safe-bins exec harness · openclaw/openclaw@ee856ab test: preserve tool helpers in embedded runner mocks · openclaw/openclaw@acd86a0 refactor: move memory embeddings into provider plugins · openclaw/openclaw@77e6e4c test: reuse system-run temp fixtures · openclaw/openclaw@7e9ff0f test: trim hotspot wait overhead · openclaw/openclaw@12a59b0 Check: avoid duplicate boundary prep · openclaw/openclaw@baf11b8 test: reduce hotspot fixture overhead · openclaw/openclaw@3a59edd feat(ui): overhaul settings and slash command UX (#67819) thanks @Bun… · openclaw/openclaw@2cfb660 QA Matrix: exit cleanly on failure · openclaw/openclaw@42805d2 QA Matrix: isolate scenario coverage · openclaw/openclaw@7e659e1 Matrix: refresh crypto bootstrap state · openclaw/openclaw@94081d8 QA Lab: add provider registry · openclaw/openclaw@bb7e982 Matrix: add plugin changelog · openclaw/openclaw@4acab55 test: trim more hotspot overhead · openclaw/openclaw@f485311
修记忆:去伪存真,除签于思… · openclaw/openclaw@41329c0
NianJiuZst · 2026-05-24 · via Recent Commits to openclaw:main

@@ -2007,4 +2007,181 @@ describe("sanitizeSessionHistory", () => {

20072007

const types = getAssistantContentTypes(result);

20082008

expect(types).toContain("thinking");

20092009

});

2010+2011+

it("strips unsigned thinking blocks for anthropic api even when preserveSignatures is false", async () => {

2012+

setNonGoogleModelApi();

2013+2014+

const messages = castAgentMessages([

2015+

makeUserMessage("analyze"),

2016+

makeAssistantMessage([

2017+

{ type: "thinking", thinking: "no signature" },

2018+

{ type: "thinking", thinking: "empty sig", thinkingSignature: "" },

2019+

{ type: "thinking", thinking: "blank sig", thinkingSignature: " " },

2020+

{ type: "thinking", thinking: "valid", thinkingSignature: "sig_abc" },

2021+

{ type: "text", text: "result" },

2022+

]),

2023+

]);

2024+2025+

const result = await sanitizeAnthropicHistory({

2026+

messages,

2027+

modelApi: "anthropic-messages",

2028+

preserveLatestAssistantThinking: false,

2029+

policy: {

2030+

sanitizeMode: "full",

2031+

sanitizeToolCallIds: true,

2032+

toolCallIdMode: "strict",

2033+

preserveNativeAnthropicToolUseIds: false,

2034+

repairToolUseResultPairing: true,

2035+

preserveSignatures: false,

2036+

sanitizeThinkingSignatures: false,

2037+

dropThinkingBlocks: false,

2038+

applyGoogleTurnOrdering: false,

2039+

validateGeminiTurns: false,

2040+

validateAnthropicTurns: true,

2041+

allowSyntheticToolResults: false,

2042+

},

2043+

});

2044+2045+

const assistant = getAssistantMessage(result);

2046+

const content = assistant.content;

2047+

const thinkingBlocks = content.filter(

2048+

(b: { type: string }) => b.type === "thinking" || b.type === "redacted_thinking",

2049+

);

2050+

const textBlocks = content.filter((b: { type: string }) => b.type === "text");

2051+2052+

// Only the valid signed thinking block should survive

2053+

expect(thinkingBlocks).toHaveLength(1);

2054+

expect((thinkingBlocks[0] as { thinkingSignature?: string }).thinkingSignature).toBe("sig_abc");

2055+

expect(textBlocks).toHaveLength(1);

2056+

expect((textBlocks[0] as { text?: string }).text).toBe("result");

2057+

});

2058+2059+

it("preserves unsigned thinking blocks for kimi coding with anthropic-messages transport", async () => {

2060+

setNonGoogleModelApi();

2061+2062+

const messages = castAgentMessages([

2063+

makeUserMessage("analyze"),

2064+

makeAssistantMessage([

2065+

{ type: "thinking", thinking: "unsigned kimi reasoning" },

2066+

{ type: "text", text: "result" },

2067+

]),

2068+

]);

2069+2070+

// Kimi uses anthropic-messages transport but does not require signed thinking.

2071+

// Its provider-level preserveSignatures is false and should stay gated.

2072+

const result = await sanitizeSessionHistory({

2073+

messages,

2074+

modelApi: "anthropic-messages",

2075+

provider: "kimi",

2076+

modelId: "kimi-for-coding",

2077+

sessionManager: makeMockSessionManager(),

2078+

sessionId: TEST_SESSION_ID,

2079+

policy: {

2080+

sanitizeMode: "full",

2081+

sanitizeToolCallIds: true,

2082+

toolCallIdMode: "strict",

2083+

preserveNativeAnthropicToolUseIds: false,

2084+

repairToolUseResultPairing: true,

2085+

preserveSignatures: false,

2086+

sanitizeThinkingSignatures: false,

2087+

dropThinkingBlocks: false,

2088+

dropReasoningFromHistory: false,

2089+

applyGoogleTurnOrdering: false,

2090+

validateGeminiTurns: false,

2091+

validateAnthropicTurns: false,

2092+

allowSyntheticToolResults: false,

2093+

},

2094+

});

2095+2096+

const assistant = getAssistantMessage(result);

2097+

const thinkingBlocks = assistant.content.filter((b: { type: string }) => b.type === "thinking");

2098+

expect(thinkingBlocks).toHaveLength(1);

2099+

expect((thinkingBlocks[0] as { thinking?: string }).thinking).toBe("unsigned kimi reasoning");

2100+

});

2101+2102+

it("preserves unsigned thinking blocks for github copilot claude with anthropic-messages transport", async () => {

2103+

setNonGoogleModelApi();

2104+2105+

const messages = castAgentMessages([

2106+

makeUserMessage("analyze"),

2107+

makeAssistantMessage([

2108+

{ type: "thinking", thinking: "unsigned copilot reasoning" },

2109+

{ type: "text", text: "result" },

2110+

]),

2111+

]);

2112+2113+

// GitHub Copilot Claude uses anthropic-messages transport but does not

2114+

// require signed thinking. Its provider-level preserveSignatures is false.

2115+

const result = await sanitizeSessionHistory({

2116+

messages,

2117+

modelApi: "anthropic-messages",

2118+

provider: "github-copilot",

2119+

modelId: "claude-opus-4.6",

2120+

sessionManager: makeMockSessionManager(),

2121+

sessionId: TEST_SESSION_ID,

2122+

policy: {

2123+

sanitizeMode: "full",

2124+

sanitizeToolCallIds: true,

2125+

toolCallIdMode: "strict",

2126+

preserveNativeAnthropicToolUseIds: false,

2127+

repairToolUseResultPairing: true,

2128+

preserveSignatures: false,

2129+

sanitizeThinkingSignatures: false,

2130+

dropThinkingBlocks: false,

2131+

dropReasoningFromHistory: false,

2132+

applyGoogleTurnOrdering: false,

2133+

validateGeminiTurns: false,

2134+

validateAnthropicTurns: false,

2135+

allowSyntheticToolResults: false,

2136+

},

2137+

});

2138+2139+

const assistant = getAssistantMessage(result);

2140+

const thinkingBlocks = assistant.content.filter((b: { type: string }) => b.type === "thinking");

2141+

expect(thinkingBlocks).toHaveLength(1);

2142+

expect((thinkingBlocks[0] as { thinking?: string }).thinking).toBe(

2143+

"unsigned copilot reasoning",

2144+

);

2145+

});

2146+2147+

it("strips unsigned thinking for bedrock-converse-stream even when preserveSignatures is false", async () => {

2148+

setNonGoogleModelApi();

2149+2150+

const messages = castAgentMessages([

2151+

makeUserMessage("analyze"),

2152+

makeAssistantMessage([

2153+

{ type: "thinking", thinking: "no sig" },

2154+

{ type: "thinking", thinking: "signed", thinkingSignature: "sig_bedrock" },

2155+

{ type: "text", text: "done" },

2156+

]),

2157+

]);

2158+2159+

const result = await sanitizeAnthropicHistory({

2160+

messages,

2161+

provider: "amazon-bedrock",

2162+

modelApi: "bedrock-converse-stream",

2163+

preserveLatestAssistantThinking: false,

2164+

policy: {

2165+

sanitizeMode: "full",

2166+

sanitizeToolCallIds: true,

2167+

toolCallIdMode: "strict",

2168+

preserveNativeAnthropicToolUseIds: false,

2169+

repairToolUseResultPairing: true,

2170+

preserveSignatures: false,

2171+

sanitizeThinkingSignatures: false,

2172+

dropThinkingBlocks: false,

2173+

applyGoogleTurnOrdering: false,

2174+

validateGeminiTurns: false,

2175+

validateAnthropicTurns: true,

2176+

allowSyntheticToolResults: false,

2177+

},

2178+

});

2179+2180+

const assistant = getAssistantMessage(result);

2181+

const thinkingBlocks = assistant.content.filter((b: { type: string }) => b.type === "thinking");

2182+

expect(thinkingBlocks).toHaveLength(1);

2183+

expect((thinkingBlocks[0] as { thinkingSignature?: string }).thinkingSignature).toBe(

2184+

"sig_bedrock",

2185+

);

2186+

});

20102187

});