fix(active-memory): clarify modelFallbackPolicy deprecation warning text · openclaw/openclaw@c894dbf
jeffrey701
·
2026-04-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1384,6 +1384,22 @@ describe("active-memory plugin", () => {
|
1384 | 1384 | expect(api.logger.warn).toHaveBeenCalledWith( |
1385 | 1385 | expect.stringContaining("config.modelFallbackPolicy is deprecated"), |
1386 | 1386 | ); |
| 1387 | +// #74587: deprecation warning must spell out the chain-resolution |
| 1388 | +// semantics so operators don't read it as a promise of runtime failover. |
| 1389 | +// The previous wording ("set config.modelFallback if you want a fallback |
| 1390 | +// model") cost real users hours of debug time before they hit the source |
| 1391 | +// and saw `getModelRef` only walks candidates once. |
| 1392 | +const warnCalls = (api.logger.warn as ReturnType<typeof vi.fn>).mock.calls; |
| 1393 | +const deprecationMessage = warnCalls |
| 1394 | +.map(([first]) => (typeof first === "string" ? first : "")) |
| 1395 | +.find((message) => message.includes("config.modelFallbackPolicy is deprecated")); |
| 1396 | +expect(deprecationMessage).toBeDefined(); |
| 1397 | +// Positive: the warning describes chain-resolution last-resort behavior. |
| 1398 | +expect(deprecationMessage).toContain("chain-resolution"); |
| 1399 | +expect(deprecationMessage).toContain("last-resort"); |
| 1400 | +// Negative: the warning explicitly disclaims runtime failover, since |
| 1401 | +// that's the wrong mental model the previous wording invited. |
| 1402 | +expect(deprecationMessage).toMatch(/NOT a runtime failover/i); |
1387 | 1403 | }); |
1388 | 1404 | |
1389 | 1405 | it("does not use a built-in fallback model even when default-remote is configured", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2431,8 +2431,19 @@ export default definePluginEntry({
|
2431 | 2431 | let config = normalizePluginConfig(api.pluginConfig); |
2432 | 2432 | const warnDeprecatedModelFallbackPolicy = (pluginConfig: unknown) => { |
2433 | 2433 | if (hasDeprecatedModelFallbackPolicy(pluginConfig)) { |
| 2434 | +// Wording matters here: the previous text ("set config.modelFallback |
| 2435 | +// explicitly if you want a fallback model") read naturally as runtime |
| 2436 | +// failover (model A errors → switch to model B), but `getModelRef` |
| 2437 | +// only consults `modelFallback` as the *last candidate* in the |
| 2438 | +// resolution chain after `config.model`, the current run's model, |
| 2439 | +// and the agent's configured default have all resolved to nothing. |
| 2440 | +// Surface the chain-resolution semantics directly so operators |
| 2441 | +// don't waste debug cycles assuming runtime failover (#74587). |
2434 | 2442 | api.logger.warn?.( |
2435 | | -"active-memory: config.modelFallbackPolicy is deprecated and no longer changes runtime behavior; set config.modelFallback explicitly if you want a fallback model", |
| 2443 | +"active-memory: config.modelFallbackPolicy is deprecated and no longer changes runtime behavior. " + |
| 2444 | +"config.modelFallback is a chain-resolution last-resort (consulted only when config.model, " + |
| 2445 | +"the current run's model, and the agent's configured default all resolve to nothing) — " + |
| 2446 | +"it is NOT a runtime failover that substitutes a different model when the resolved model errors out.", |
2436 | 2447 | ); |
2437 | 2448 | } |
2438 | 2449 | }; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。