Skip to content

fix: stop using retired claude-3-haiku-20240307 for Anthropic key checks and defaults - #2609

Open
syzsunshine219 wants to merge 1 commit into
MemTensor:dev-v2.0.37from
kamal0808:fix/retired-claude-3-haiku
Open

syzsunshine219 wants to merge 1 commit into
MemTensor:dev-v2.0.37from
kamal0808:fix/retired-claude-3-haiku

Conversation

@syzsunshine219

Copy link
Copy Markdown
Collaborator

Restores the proposal from #2555 as an open PR against main; its former base branch, dev-v2.0.36, is no longer available. This proposal still needs its implementation revised before merging.

Source head: a89dcca42f75ab36e237cbe69164e5ccb0d2d0a2. No new source-code changes are introduced by restoring this proposal. Earlier discussion and evidence remain in #2555; validation claims in the original description refer to the earlier snapshot.

Outstanding review scope

主干Anthropic模型调用与key验证仍硬编码旧型号,相关问题仍值得处理;但旧PR改运行fallback却没有同步两份viewer的Anthropic预填默认值,保存设置后仍会把旧型号显式写回并覆盖新fallback。应补齐UI默认并单独验证/models鉴权后再恢复原补丁。


Original proposal

Description

Anthropic retired claude-3-haiku-20240307 on April 20, 2026 (model deprecations), so requests to it now fail. A few places in MemOS still hardcode it:

  • Openwork desktop, API key check (api-key:validate and api-key:validate-provider in handlers.ts): the check sends a message to claude-3-haiku-20240307 and treats any non-OK reply as a bad key. Since the model is gone, every valid Anthropic key is rejected and users can't get past setup.
  • Summarizer default (shared/llm-call.ts and ingest/providers/anthropic.ts, in both packages/memos-core and apps/memos-local-openclaw): with provider: anthropic and no model set, every summarize/topic/dedup call fails.
  • Viewer "test connection" (viewer/server.ts, both copies): with no model entered, the test always fails.

What changed:

  • The desktop key check now calls GET https://api.anthropic.com/v1/models instead of sending a message, the same way the OpenAI check already works. It still returns 401 for a bad key, costs no tokens, and won't break again when the next model retires.
  • The fallback model is now claude-haiku-4-5-20251001, Anthropic's listed replacement for Haiku 3. It still accepts the temperature these calls send.
  • The README / SKILL.md summarizer example uses the same model.
  • Updated the api-key:validate unit test to check the new endpoint and added one for api-key:validate-provider with anthropic.

Bedrock defaults (anthropic.claude-3-haiku-20240307-v1:0) are untouched: Bedrock has its own retirement schedule.

There's no issue for this one; I found it while reading the code.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I haven't run the test suite or the app locally. The changes are a model ID swap and an endpoint swap for the key check, plus the unit tests above. CI should cover them.

🤖 Generated with Claude Code

…cks and defaults

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Memtensor-AI Memtensor-AI added area:plugin OpenClaw & Hermes status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Nov 9, 2026
@Memtensor-AI

Copy link
Copy Markdown
Collaborator

🤖 Open Code Review

Target: PR #2609
Task: 46b5f2fd1ec204a3
Base: main
Head: fix/retired-claude-3-haiku
Head SHA: a89dcca42f75ab36e237cbe69164e5ccb0d2d0a2

🔍 OpenCodeReview found 8 issue(s) in this PR.

⚠️ Review warnings (1)

  • Filtered 1 low-confidence OCR finding(s) before posting/fix-loop.

1. packages/memos-core/src/viewer/server.ts (L3932)

The Anthropic default model ID is hardcoded here and duplicated across src/viewer/html.ts (_providerDefaults.anthropic.chatModel still claude-3-haiku-20240307), src/shared/llm-call.ts and all seven call sites in src/ingest/providers/anthropic.ts. Because this fallback only fires when model is empty, and the viewer UI prefills the old claude-3-haiku-20240307 on provider selection, the connection test will normally still exercise the old model. Suggest extracting a single exported constant (e.g. DEFAULT_ANTHROPIC_MODEL) and reusing it here and in the UI defaults so future model bumps are a one-line change and cannot drift.

💡 Suggested Change

Before:

        body: JSON.stringify({ model: model || "claude-haiku-4-5-20251001", max_tokens: 5, messages: [{ role: "user", content: "hi" }] }),

After:

        body: JSON.stringify({ model: model || DEFAULT_ANTHROPIC_MODEL, max_tokens: 5, messages: [{ role: "user", content: "hi" }] }),

2. apps/memos-local-openclaw/src/viewer/server.ts (L4009)

Same hardcoded Anthropic default model literal is now repeated in this file, src/viewer/html.ts (UI default still claude-3-haiku-20240307), src/shared/llm-call.ts and the seven src/ingest/providers/anthropic.ts call sites, and this file is also a near-copy of packages/memos-core/src/viewer/server.ts. Consider a shared constant (e.g. DEFAULT_ANTHROPIC_MODEL) sourced from one place and syncing the viewer UI defaults, so the model ID cannot diverge between the two packages.


3. apps/memos-local-openclaw/src/shared/llm-call.ts (L172)

The default model bump is only applied in the runtime callers; the settings UI default (_providerDefaults.anthropic.chatModel) in src/viewer/html.ts still prefills claude-3-haiku-20240307. When a user picks the Anthropic provider in the UI and saves, config.model is populated with the stale value, which then overrides this new default (cfg.model ?? ...), so the upgrade never takes effect for UI-configured users and the two places drift. Please update the UI default (and the mirrored copy in packages/memos-core/src/viewer/html.ts) or reference a shared constant.


4. packages/memos-core/src/shared/llm-call.ts (L170)

Same default-model drift as in the openclaw package: the settings UI default in src/viewer/html.ts (_providerDefaults.anthropic.chatModel) still uses claude-3-haiku-20240307, so UI-configured Anthropic summarizers will keep sending the old model and silently bypass this new default. Please update the viewer default alongside this change (or centralize the model id in one shared constant).


5. apps/memos-local-openclaw/src/ingest/providers/anthropic.ts (L63)

The default model was bumped here (and in the other functions / llm-call / viewer server), but the viewer settings preset is still stale: _providerDefaults.anthropic.chatModel in apps/memos-local-openclaw/src/viewer/html.ts (line 7248) remains claude-3-haiku-20240307 and is used by onProviderChange() to prefill the model field when a user picks the Anthropic provider. Users configuring Anthropic via the viewer therefore still end up with the old model. Please update that preset (and the mirrored packages/memos-core/src/viewer/html.ts) so the UI default matches the runtime default.


6. packages/memos-core/src/ingest/providers/anthropic.ts (L63)

The default Anthropic model string is now copy-pasted in 7 places in this file (and again in the mirrored apps/memos-local-openclaw/src/ingest/providers/anthropic.ts), which is exactly why this PR had to touch 14+ locations for a one-line model bump and still missed the viewer preset. bedrock.ts already has a precedent (DEFAULT_BEDROCK_TOPIC_MODEL) — consider extracting a module-level DEFAULT_ANTHROPIC_MODEL constant here and reusing it in every function so future model migrations stay a one-line change.

💡 Suggested Change

Before:

  const model = cfg.model ?? "claude-haiku-4-5-20251001";

After:

const DEFAULT_ANTHROPIC_MODEL = "claude-haiku-4-5-20251001";
...
  const model = cfg.model ?? DEFAULT_ANTHROPIC_MODEL;

7. apps/openwork-memos-integration/apps/desktop/src/main/ipc/handlers.ts (L818-L827)

After switching to the models endpoint, this block is now byte-for-byte identical to the anthropic branch of the api-key:validate-provider handler (same URL, headers, and later the same ok/error handling). Duplicating the endpoint string and headers in two places makes future changes (e.g. API version bump or a different validation endpoint) easy to apply inconsistently. Consider extracting the request definition (or a validateProviderKey(provider, key) helper) and reusing it from both handlers.


8. apps/openwork-memos-integration/apps/desktop/src/main/ipc/handlers.ts (L818)

Switching validation to the models endpoint only proves that the key authenticates; it no longer proves the key can actually run completions. An Anthropic key with an exhausted credit balance (or a key disabled for message generation) now returns 200 on /v1/models and will be reported as { valid: true }, only to fail later when the user sends a real request. This makes the “key is valid” signal weaker than before. Consider either (a) falling back to a 1-token POST /v1/messages with a currently listed/default model when /v1/models succeeds, or (b) documenting in the UI/handler comment that validation only checks authentication so users are not misled when requests subsequently fail with a billing error.


🧹 Filtered 1 low-confidence OCR finding(s) before posting/fix-loop (duplicate: 1).

Generated by cloud-assistant via Open Code Review.

@Memtensor-AI

Copy link
Copy Markdown
Collaborator

⚠️ Automated Test Results: ENV ISSUE

The test environment encountered an issue that requires manual attention.

Details: Executor error: Node dependency preparation failed for memos_local_plugin: Command failed with exit code 1: npm ci --include=dev --no-audit --no-fund
stdout:
stderr: npm warn deprecated boolean@3.2.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm error code 1
npm error path /data/test-workspaces/46b5f2fd1ec204a3/repo/apps/memos-local-plugin/node_modules/onnxruntime-node
npm error command failed
npm error command sh -c node ./script/install
npm error /data/test-workspaces/46b5f2fd1ec204a3/repo/apps/memos-local-plugin/node_modules/onnxruntime-node/script/install-utils.js:57
npm error reject(new Error(Failed to download build list. HTTP status code = ${statusCode}));
npm error ^
npm error
npm error Error: Failed to download build list. HTTP status code = 302
npm error at ClientRequest. (/data/test-workspaces/46b5f2fd1ec204a3/repo/apps/memos-local-plugin/node_modules/onnxruntime-node/script/install-utils.js:57:18)
npm error at Object.onceWrapper (node:events:634:26)
npm error at ClientRequest.emit (node:events:519:28)
npm error at ClientRequest.emit (node:domain:489:12)
npm error at HTTPParser.parserOnIncomingClient (node:_http_client:780:27)
npm error at HTTPParser.parserOnHeadersComplete (node:_http_common:125:17)
npm error at TLSSocket.socketOnData (node:_http_client:615:22)
npm error at TLSSocket.emit (node:events:519:28)
npm error at TLSSocket.emit (node:domain:489:12)
npm error at addChunk (node:internal/streams/readable:561:12)
npm error
npm error Node.js v22.22.2
npm error A complete log of this run can be found in: /data/test-workspaces/_shared/npm-downloads/_logs/2026-11-09T17_46_28_586Z-debug-0.log
Branch: fix/retired-claude-3-haiku

Tested source: a89dcca42f75ab36e237cbe69164e5ccb0d2d0a2
Tested base: 3a16e5fe3048a209f722806f4123fa2e533588fd
Tested commit: 9088b6c597f0d055b1f1d5f9f6a71d375c3f0337
These results apply only to this immutable source/base snapshot.

@endxxxx
endxxxx changed the base branch from main to dev-v2.0.37 November 17, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:plugin OpenClaw & Hermes status:in-progress Someone or AI is working on it | 人工或 AI 正在处理

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants