Skip to content

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

Open
syzsunshine219 wants to merge 1 commit into
dev-v2.0.37from
codex/maintainer-edit-pr-2609-20261119
Open

syzsunshine219 wants to merge 1 commit into
dev-v2.0.37from
codex/maintainer-edit-pr-2609-20261119

Conversation

@syzsunshine219

Copy link
Copy Markdown
Collaborator

The source branch for the change proposed in #2609 now lives in MemTensor/MemOS, so repository writers can contribute fixes through the normal upstream branch permissions.

The code and commit authors are unchanged. This PR retains target branch dev-v2.0.37 and exact source head a89dcca42f75ab36e237cbe69164e5ccb0d2d0a2 from #2609.

Previous discussion and review remain in #2609. Review and checks must be re-evaluated for this replacement PR; no previous approval or new test result is asserted by this migration.

Previous PR description and implementation details

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>
@syzsunshine219 syzsunshine219 added the area:plugin OpenClaw & Hermes label Nov 19, 2026
@Memtensor-AI Memtensor-AI added the status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 label Nov 19, 2026
@Memtensor-AI

Copy link
Copy Markdown
Collaborator

🤖 Open Code Review

Target: PR #2645
Task: 29009bf716a40f56
Base: dev-v2.0.37
Head: codex/maintainer-edit-pr-2609-20261119
Head SHA: a89dcca42f75ab36e237cbe69164e5ccb0d2d0a2

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

⚠️ Review warnings (1)

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

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

The default Anthropic model is updated here, but the matching UI default in the same app (src/viewer/html.ts _providerDefaults.anthropic.chatModel) still points to claude-3-haiku-20240307. Since onProviderChange auto-fills the model field with that old value, users configuring Anthropic through the viewer UI will still save/use the outdated model, making this fallback effectively unreachable and leaving the update incomplete. Please align the UI default as well.

💡 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 || "claude-haiku-4-5-20251001", max_tokens: 5, messages: [{ role: "user", content: "hi" }] }),

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

The code default was bumped to claude-haiku-4-5-20251001 (same in the packages/memos-core mirror), but the viewer settings UI still pre-fills the old model: _providerDefaults.anthropic.chatModel is 'claude-3-haiku-20240307' in src/viewer/html.ts:7248 (packages/memos-core/src/viewer/html.ts:7233). Since the UI writes that value into cfg.model, cfg.model ?? ... never falls back to the new default for configs created via the settings page — the new model will only apply to configs with no model set. Consider updating the viewer provider defaults (and bedrock.ts defaults if the same bump is intended for Bedrock) in the same change so the behavior is consistent.


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

Same inconsistency as in the openclaw package: packages/memos-core/src/viewer/html.ts _providerDefaults.anthropic.chatModel (around line 7233) still defaults to claude-3-haiku-20240307, and onProviderChange auto-fills that value into the model input. Users configuring Anthropic via the viewer UI will therefore keep using the outdated model and this new fallback will rarely take effect. Please update the UI default in the same change.

💡 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 || "claude-haiku-4-5-20251001", max_tokens: 5, messages: [{ role: "user", content: "hi" }] }),

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

The default model ID is now duplicated 7 times in this file, so every future model bump has to touch all of them (and the same list again in packages/memos-core/src/ingest/providers/anthropic.ts). Consider hoisting it to a module-level const DEFAULT_ANTHROPIC_MODEL = "claude-haiku-4-5-20251001", mirroring DEFAULT_BEDROCK_TOPIC_MODEL in bedrock.ts.

Also note a missing update outside this file: the viewer UI's per-provider default (_providerDefaults.anthropic.chatModel in src/viewer/html.ts) still says claude-3-haiku-20240307, while src/shared/llm-call.ts and src/viewer/server.ts were bumped in this PR. As-is, users who select Anthropic in the settings dialog will still be pre-filled with the old model.


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

Same as the openclaw copy: the default ID is repeated 7 times, so consider a module-level DEFAULT_ANTHROPIC_MODEL constant to keep the provider helper-parity bump in one place.

Also, packages/memos-core/src/viewer/html.ts still has anthropic:{...,chatModel:'claude-3-haiku-20240307'} in _providerDefaults, while src/shared/llm-call.ts and src/viewer/server.ts now default to the new model. Please update that UI default too, otherwise the settings form keeps offering the retired model.


6. apps/openwork-memos-integration/apps/desktop/src/main/ipc/handlers.ts (L819-L820)

Both api-key:validate and the anthropic branch of api-key:validate-provider now contain an identical request definition. Extracting a small helper (e.g. requestAnthropicKeyValidation(key)) keeps the two validation paths from drifting apart when the endpoint/headers change again (this PR is itself an example of having to update the same URL twice).


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

Generated by cloud-assistant via Open Code Review.

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