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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
Blog — PlanetScale
Blog — PlanetScale
V
Visual Studio Blog
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
博客园 - Franky
IT之家
IT之家
博客园 - 叶小钗
Engineering at Meta
Engineering at Meta
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
腾讯CDC
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
人人都是产品经理
人人都是产品经理
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
博客园_首页
G
Google Developers 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(status): ignore stale context after model switch (#93...
hxy91819 · 2026-06-16 · via Recent Commits to openclaw:main
11

// Status message tests cover status message formatting and persistence.

2-

import { describe, expect, it } from "vitest";

2+

import { afterEach, describe, expect, it } from "vitest";

3+

import { testing as cliBackendsTesting } from "../agents/cli-backends.js";

4+

import type { ModelDefinitionConfig } from "../config/types.models.js";

35

import { formatFastModeLabel } from "./status-labels.js";

6+

import { buildStatusMessage } from "./status-message.js";

7+8+

function statusTestModel(id: string, name: string, contextWindow: number): ModelDefinitionConfig {

9+

return {

10+

id,

11+

name,

12+

reasoning: false,

13+

input: ["text"],

14+

cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },

15+

contextWindow,

16+

maxTokens: 8_192,

17+

};

18+

}

19+20+

afterEach(() => {

21+

cliBackendsTesting.resetDepsForTest();

22+

});

423524

describe("formatFastModeLabel", () => {

625

it("shows fast mode when enabled", () => {

@@ -11,3 +30,112 @@ describe("formatFastModeLabel", () => {

1130

expect(formatFastModeLabel(false)).toBe("Fast: off");

1231

});

1332

});

33+34+

describe("buildStatusMessage context window", () => {

35+

it("ignores stale runtime context after a manual session model switch", () => {

36+

const text = buildStatusMessage({

37+

config: {

38+

models: {

39+

providers: {

40+

"ollama-cloud": {

41+

baseUrl: "https://ollama.com",

42+

models: [

43+

statusTestModel("deepseek-v4-pro", "DeepSeek V4 Pro", 1_000_000),

44+

statusTestModel("glm-5.1", "GLM 5.1", 200_000),

45+

],

46+

},

47+

},

48+

},

49+

},

50+

agent: {

51+

model: "ollama-cloud/deepseek-v4-pro",

52+

contextTokens: 1_000_000,

53+

},

54+

configuredDefaultModelLabel: "ollama-cloud/deepseek-v4-pro",

55+

explicitConfiguredContextTokens: 1_000_000,

56+

runtimeContextTokens: 1_000_000,

57+

sessionEntry: {

58+

sessionId: "manual-switch-stale-runtime",

59+

updatedAt: 0,

60+

providerOverride: "ollama-cloud",

61+

modelOverride: "glm-5.1",

62+

modelOverrideSource: "user",

63+

modelProvider: "ollama-cloud",

64+

model: "deepseek-v4-pro",

65+

totalTokens: 128_393,

66+

totalTokensFresh: true,

67+

},

68+

sessionKey: "agent:main:telegram:direct:584667058",

69+

sessionScope: "per-sender",

70+

queue: { mode: "steer", depth: 0 },

71+

modelAuth: "api-key",

72+

});

73+74+

expect(text).toContain("Session selected: ollama-cloud/glm-5.1");

75+

expect(text).toContain("Context: 128k/200k");

76+

expect(text).not.toContain("Context: 128k/1.0m");

77+

});

78+79+

it("keeps trusted runtime context for config-backed runtime aliases", () => {

80+

cliBackendsTesting.setDepsForTest({

81+

resolvePluginSetupCliBackend: ({ backend }) =>

82+

backend === "claude-cli"

83+

? {

84+

pluginId: "anthropic",

85+

backend: {

86+

id: "claude-cli",

87+

modelProvider: "anthropic",

88+

config: { command: "claude" },

89+

bundleMcp: false,

90+

},

91+

}

92+

: undefined,

93+

resolvePluginSetupRegistry: () => {

94+

throw new Error("setup registry should not load for a targeted runtime alias");

95+

},

96+

resolveRuntimeCliBackends: () => [],

97+

});

98+99+

const text = buildStatusMessage({

100+

config: {

101+

agents: {

102+

defaults: {

103+

cliBackends: {

104+

"claude-cli": { command: "claude" },

105+

},

106+

},

107+

},

108+

models: {

109+

providers: {

110+

anthropic: {

111+

baseUrl: "https://api.anthropic.com",

112+

models: [statusTestModel("claude-haiku-4-5", "Claude Haiku 4.5", 200_000)],

113+

},

114+

},

115+

},

116+

},

117+

agent: {

118+

model: "anthropic/claude-haiku-4-5",

119+

contextTokens: 200_000,

120+

},

121+

runtimeContextTokens: 1_000_000,

122+

sessionEntry: {

123+

sessionId: "runtime-alias-context",

124+

updatedAt: 0,

125+

modelProvider: "claude-cli",

126+

model: "claude-haiku-4-5",

127+

totalTokens: 36_000,

128+

totalTokensFresh: true,

129+

},

130+

sessionKey: "agent:main:main",

131+

sessionScope: "per-sender",

132+

queue: { mode: "collect", depth: 0 },

133+

modelAuth: "oauth",

134+

activeModelAuth: "oauth",

135+

});

136+137+

expect(text).toContain("Model: anthropic/claude-haiku-4-5");

138+

expect(text).toContain("Context: 36k/1.0m");

139+

expect(text).not.toContain("Context: 36k/200k");

140+

});

141+

});