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

推荐订阅源

WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
B
Blog
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
Jina AI
Jina AI
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
L
LangChain Blog
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
酷 壳 – CoolShell
酷 壳 – CoolShell
Y
Y Combinator Blog
F
Fortinet All Blogs
H
Help Net Security
B
Blog RSS Feed
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题

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): strip stale gemini assistant prefill · openc...
steipete · 2026-04-27 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -20,6 +20,7 @@ Docs: https://docs.openclaw.ai

2020

- Gateway/models: skip external OpenRouter and LiteLLM pricing refreshes for local/self-hosted model endpoints so startup does not wait on remote pricing catalogs for local-only Ollama, vLLM, and compatible providers. Thanks @codex.

2121

- CLI/plugins: stop security-blocked plugin installs from retrying as hook packs, so normal plugin packages report the scanner failure without a misleading "not a valid hook pack" follow-up. Fixes #61175; supersedes #64102. Thanks @KonsultDigital and @ziyincody.

2222

- Agents/Anthropic: strip stale trailing assistant prefill turns from outbound replay so context-engine short circuits cannot send unsupported assistant-prefill payloads to provider APIs. Fixes #72556. Thanks @Veda-openclaw.

23+

- Agents/Google: strip stale trailing assistant/model prefill turns from Gemini outbound replay so Google Generative AI requests end with a user turn or function response. Follow-up to #72556. Thanks @Veda-openclaw.

2324

- Control UI/Dreaming: require explicit confirmation before applying restart-impacting Dreaming mode changes, with restart warning copy and loading feedback. Fixes #63804. (#63807) Thanks @bbddbb1.

2425

- CLI/update: keep the automatic post-update completion refresh on the core-command tree so it no longer stages bundled plugin runtime deps before the Gateway restart path, avoiding `.24` update hangs and 1006 disconnect cascades. Fixes #72665. Thanks @sakalaboator and @He-Pin.

2526

- Agents/Bedrock: stop heartbeat runs from persisting blank user transcript turns and repair existing blank user text messages before replay, preventing AWS Bedrock `ContentBlock` blank-text validation failures. Fixes #72640 and #72622. Thanks @goldzulu.

Original file line numberDiff line numberDiff line change

@@ -1671,6 +1671,44 @@ describe("wrapStreamFnSanitizeMalformedToolCalls", () => {

16711671

expect(seenContext.messages).not.toBe(messages);

16721672

});

16731673
1674+

it("strips trailing assistant prefill turns for Gemini outbound replay", async () => {

1675+

const messages = [

1676+

{

1677+

role: "user",

1678+

content: [{ type: "text", text: "earlier question" }],

1679+

},

1680+

{

1681+

role: "assistant",

1682+

content: [{ type: "text", text: "stale model answer" }],

1683+

},

1684+

];

1685+

const baseFn = vi.fn((_model, _context) =>

1686+

createFakeStream({ events: [], resultMessage: { role: "assistant", content: [] } }),

1687+

);

1688+
1689+

const wrapped = wrapStreamFnSanitizeMalformedToolCalls(baseFn as never, new Set(["read"]), {

1690+

validateGeminiTurns: true,

1691+

preserveSignatures: true,

1692+

dropThinkingBlocks: false,

1693+

} as never);

1694+

const stream = wrapped(

1695+

{ api: "google-generative-ai" } as never,

1696+

{ messages } as never,

1697+

{} as never,

1698+

) as FakeWrappedStream | Promise<FakeWrappedStream>;

1699+

await Promise.resolve(stream);

1700+
1701+

expect(baseFn).toHaveBeenCalledTimes(1);

1702+

const seenContext = baseFn.mock.calls[0]?.[1] as { messages: unknown[] };

1703+

expect(seenContext.messages).toEqual([

1704+

{

1705+

role: "user",

1706+

content: [{ type: "text", text: "earlier question" }],

1707+

},

1708+

]);

1709+

expect(seenContext.messages).not.toBe(messages);

1710+

});

1711+
16741712

it("drops signed thinking turns when sibling replay tool calls are not allowlisted", async () => {

16751713

const messages = [

16761714

{

Original file line numberDiff line numberDiff line change

@@ -895,16 +895,25 @@ export function wrapStreamFnSanitizeMalformedToolCalls(

895895

let nextMessages = replayInputsChanged

896896

? sanitizeToolUseResultPairing(sanitized.messages)

897897

: sanitized.messages;

898+

let strippedTrailingAssistantPrefill = false;

898899

if (transcriptPolicy?.validateAnthropicTurns) {

899900

nextMessages = sanitizeAnthropicReplayToolResults(nextMessages, {

900901

disallowEmbeddedUserToolResultsForSignedThinkingReplay: allowProviderOwnedThinkingReplay,

901902

});

903+

}

904+

if (transcriptPolicy?.validateAnthropicTurns || transcriptPolicy?.validateGeminiTurns) {

905+

const beforeStrip = nextMessages;

902906

nextMessages = stripTrailingAssistantPrefillTurns(nextMessages);

907+

strippedTrailingAssistantPrefill ||= nextMessages !== beforeStrip;

903908

}

904909

if (nextMessages === messages) {

905910

return baseFn(model, context, options);

906911

}

907-

if (sanitized.droppedAssistantMessages > 0 || transcriptPolicy?.validateAnthropicTurns) {

912+

if (

913+

sanitized.droppedAssistantMessages > 0 ||

914+

transcriptPolicy?.validateAnthropicTurns ||

915+

strippedTrailingAssistantPrefill

916+

) {

908917

if (transcriptPolicy?.validateGeminiTurns) {

909918

nextMessages = validateGeminiTurns(nextMessages);

910919

}