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

推荐订阅源

S
SegmentFault 最新的问题
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
博客园 - 叶小钗
小众软件
小众软件
WordPress大学
WordPress大学
I
InfoQ
Last Week in AI
Last Week in AI
Vercel News
Vercel News
博客园 - Franky
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta
腾讯CDC
D
DataBreaches.Net
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
Jina AI
Jina AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
G
Google Developers Blog
V
Visual Studio Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

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(ollama): strip inline kimi cloud reasoning leak (#865...
clawsweeper · 2026-05-25 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

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

7575

- Codex harness: make subscription usage-limit errors without reset times explain that OpenClaw cannot determine the reset and point users to wait until Codex is available, use another Codex account, or switch to another configured model/provider. Thanks @amknight.

7676

- Google Vertex: support production ADC modes such as Workload Identity Federation, service-account credentials, and metadata-server ADC for the native Vertex transport. (#83971) Thanks @damianFelixPago.

7777

- Telegram: route normal `[telegram][diag]` polling diagnostics through `runtime.log` while keeping non-diag warnings and persistence failures on `runtime.error`, so healthy polling startup no longer looks like an error. Fixes #82957. (#82958) Thanks @galiniliev.

78+

- Providers/Ollama: strip inline Kimi cloud reasoning prefixes from streamed and final visible replies while keeping ordinary Kimi answers append-only. (#86286) Thanks @jason-allen-oneal.

7879
7980

- Gateway: require Talk secret authority before setup-code handoff can include Talk secrets. (#85690) Thanks @ngutman.

8081

- Agents: keep fallback error reporting scoped to the active model candidate so stale prior-provider quota/auth text is not reported for later fallback attempts. (#86134) thanks @zhangguiping-xydt.

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,5 @@

1+

import { isOllamaCloudKimiModelRef } from "./sanitizers/kimi-inline-reasoning.js";

2+
3+

export function shouldWrapOllamaCompatMoonshotThinking(modelId: string): boolean {

4+

return isOllamaCloudKimiModelRef(modelId);

5+

}

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,74 @@

1+

import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";

2+

import type {

3+

OllamaVisibleContentSanitizer,

4+

OllamaVisibleContentStreamResolution,

5+

} from "./visible-content-contract.js";

6+
7+

const INLINE_REASONING_MIN_PREFIX_CHARS = 80;

8+

const INLINE_REASONING_MAX_PENDING_CHARS = 512;

9+

const INLINE_REASONING_BOUNDARY_RE = /(^|\s)\uFE0F\s*/u;

10+
11+

type InlineReasoningVisibleTextResolution =

12+

| { kind: "visible"; text: string; bypassInlineReasoning?: boolean }

13+

| { kind: "pending" };

14+
15+

export function isOllamaCloudKimiModelRef(modelId: string): boolean {

16+

const normalizedModelId = normalizeLowercaseStringOrEmpty(modelId);

17+

const slashIndex = normalizedModelId.indexOf("/");

18+

const normalizedWireModelId =

19+

slashIndex === -1 ? normalizedModelId : normalizedModelId.slice(slashIndex + 1);

20+

return normalizedWireModelId.startsWith("kimi-k") && normalizedWireModelId.includes(":cloud");

21+

}

22+
23+

function resolveInlineReasoningVisibleText(params: {

24+

text: string;

25+

final: boolean;

26+

}): InlineReasoningVisibleTextResolution {

27+

const match = INLINE_REASONING_BOUNDARY_RE.exec(params.text);

28+

if (!match) {

29+

if (!params.final && params.text.length <= INLINE_REASONING_MAX_PENDING_CHARS) {

30+

return { kind: "pending" };

31+

}

32+

return {

33+

kind: "visible",

34+

text: params.text,

35+

bypassInlineReasoning:

36+

!params.final && params.text.length > INLINE_REASONING_MAX_PENDING_CHARS,

37+

};

38+

}

39+
40+

const boundaryStartIndex = match.index + match[1].length;

41+

const boundaryEndIndex = match.index + match[0].length;

42+

const prefix = params.text.slice(0, boundaryStartIndex).trim();

43+

const answer = params.text.slice(boundaryEndIndex).trim();

44+

if (prefix.length >= INLINE_REASONING_MIN_PREFIX_CHARS) {

45+

return { kind: "visible", text: answer };

46+

}

47+
48+

return params.final ? { kind: "visible", text: params.text } : { kind: "pending" };

49+

}

50+
51+

export function createKimiInlineReasoningSanitizer(): OllamaVisibleContentSanitizer {

52+

let bypassInlineReasoning = false;

53+
54+

return {

55+

resolveStreamText(params): OllamaVisibleContentStreamResolution {

56+

if (bypassInlineReasoning) {

57+

return { kind: "visible", text: params.text };

58+

}

59+
60+

const resolution = resolveInlineReasoningVisibleText(params);

61+

if (resolution.kind === "pending") {

62+

return resolution;

63+

}

64+

if (resolution.bypassInlineReasoning) {

65+

bypassInlineReasoning = true;

66+

}

67+

return { kind: "visible", text: resolution.text };

68+

},

69+

sanitizeFinalText(text) {

70+

const resolution = resolveInlineReasoningVisibleText({ text, final: true });

71+

return resolution.kind === "visible" ? resolution.text : text;

72+

},

73+

};

74+

}

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,8 @@

1+

export type OllamaVisibleContentStreamResolution =

2+

| { kind: "visible"; text: string }

3+

| { kind: "pending" };

4+
5+

export type OllamaVisibleContentSanitizer = {

6+

resolveStreamText(params: { text: string; final: boolean }): OllamaVisibleContentStreamResolution;

7+

sanitizeFinalText(text: string): string;

8+

};

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,30 @@

1+

import {

2+

createKimiInlineReasoningSanitizer,

3+

isOllamaCloudKimiModelRef,

4+

} from "./kimi-inline-reasoning.js";

5+

import type { OllamaVisibleContentSanitizer } from "./visible-content-contract.js";

6+
7+

const noopVisibleContentSanitizer: OllamaVisibleContentSanitizer = {

8+

resolveStreamText(params) {

9+

return { kind: "visible", text: params.text };

10+

},

11+

sanitizeFinalText(text) {

12+

return text;

13+

},

14+

};

15+
16+

export function createOllamaVisibleContentSanitizer(

17+

modelId: string,

18+

): OllamaVisibleContentSanitizer {

19+

if (isOllamaCloudKimiModelRef(modelId)) {

20+

return createKimiInlineReasoningSanitizer();

21+

}

22+

return noopVisibleContentSanitizer;

23+

}

24+
25+

export function sanitizeOllamaFinalVisibleContent(params: {

26+

modelId: string;

27+

text: string;

28+

}): string {

29+

return createOllamaVisibleContentSanitizer(params.modelId).sanitizeFinalText(params.text);

30+

}