You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
classifyTopic fails when summarizer uses Anthropic endpoint (Kimi Code) #1611
Bug Report: classifyTopic fails when summarizer is configured with Anthropic endpoint
Environment
OpenClaw version: 2026.4.29
MemOS plugin: memos-local-openclaw-plugin v1.0.8
Model: anthropic/kimi-for-coding
Endpoint: https://api.kimi.com/coding/v1/messages
Problem
TaskProcessor.classifyTopic always fails with 404 when the MemOS summarizer is configured to use an Anthropic-compatible endpoint (e.g., Kimi Code's /messages endpoint).
Error Log
classifyTopic failed (anthropic/kimi-for-coding), trying next:
Error: OpenAI topic-classifier failed (404):
{"error":{"message":"The requested resource was not found","type":"resource_not_found_error"}}
Root Cause
classifyTopic in src/ingest/providers/index.ts always calls classifyTopicOpenAI(), which sends requests in OpenAI format (/chat/completions), regardless of the summarizer's configured provider.
Component
Format Used
Endpoint
summarizer (configured)
Anthropic Messages
/coding/v1/messages ✅
classifyTopic (hardcoded)
OpenAI Chat Completions
/coding/v1 ❌
When the endpoint only supports Anthropic format, the OpenAI-style classifyTopic request returns 404.
Why This Didn't Happen Before
DeepSeek supports both OpenAI and Anthropic formats simultaneously, so OpenAI-style classifyTopic works even when summarizer uses Anthropic config.
Kimi Code's Anthropic endpoint (/coding/v1/messages) only accepts Anthropic format, rejecting OpenAI-style requests.
Impact
Every incoming message triggers a classifyTopic call that fails and falls back.
Wastes tokens (small per-call, but adds up).
Pollutes logs with repeated 404 errors.
Increases event-loop latency (related to observed Gateway slowdowns).
Proposed Fix
Option A: Make classifyTopic respect the summarizer's configured provider and call the appropriate implementation (OpenAI vs Anthropic).
Option B: Add a separate topicClassifier configuration key so users can explicitly set a different provider/model for topic classification.
Additional context: This was discovered while investigating why QQ Bot responses became slow. The repeated classifyTopic failures contribute to event-loop blocking in the OpenClaw Gateway.
Summary: Fixed issue #1611: Summarizer.classifyTopic and Summarizer.arbitrateTopicSplit in the memos-local-openclaw plugin used to unconditionally dispatch to the OpenAI implementation, so any summarizer configured against an Anthropic-only endpoint (e.g. Kimi Code's /coding/v1/messages) had every classification call return 404 — the OpenAI helper appended /chat/completions to a URL that doesn't exist. The fix implements Option A from the issue: added six new native transport helpers (classifyTopic{Anthropic,Gemini,Bedrock} and arbitrateTopicSplit{Anthropic,Gemini,Bedrock}) mirroring the shape of the existing judgeNewTopic* helpers, and rewired both callTopicClassifier and callTopicArbitration switch statements so the anthropic / gemini / bedrock arms route to their native implementations instead of falling through to the OpenAI helpers.
To prevent prompt drift across providers, TOPIC_CLASSIFIER_PROMPT / TOPIC_ARBITRATION_PROMPT are exported from openai.ts and re-imported by the three provider files; parseTopicClassifyResult continues as the single JSON parser. The byte-similar duplicate at packages/memos-core/src/ingest/providers/ received identical edits so a future re-sync between the two trees cannot silently regress the bug. Bedrock helpers require cfg.endpoint, matching every other Bedrock helper in the file.
Tests: added apps/memos-local-openclaw/tests/topic-classifier-dispatch.test.ts with 8 cases that stub globalThis.fetch and assert each provider hits the correct URL + body shape. TDD baseline was 7/8 failing against the buggy code — the anthropic case surfaces the exact OpenAI topic-classifier failed (404) string from the issue. Post-fix: 8/8 pass. Existing topic-judge-minimax-1315.test.ts (5/5) continues to pass, and task-processor.test.ts regressions match baseline exactly. tsc --noEmit on the modified provider files is clean.
Files: 5 modified + 1 new in apps/memos-local-openclaw/, 5 mirrored in packages/memos-core/. Total 11 files, 876 insertions, 14 deletions. Branch pushed to origin/feature/autodev-1611-20260721033002951; scheduler will create the PR and add reviewers.
Base branch:main Branch:feature/autodev-1611-20260721033002951 Commit:1f7ffe1 PR:#2133 Assigned to:@bittergreen Reviewers:@whipser030, @hijzy
Activity
fix(ingest): dispatch classifyTopic/arbitrateTopicSplit per provider
10 remaining items
Memtensor-AI commentedon Jul 21, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
75ef940b99925b96Working branch:
feature/autodev-1611-20260721033002951Target branch:
latest dev* branchWorkflow: opsp (analysis → coding → testing → PR)
I will post the PR link here once done. If I need more information, I will ask in the comments.
fix(openclaw): route classifyTopic + arbitrateTopicSplit per provider (…
Memtensor-AI commentedon Jul 21, 2026
✅ AutoDev task
75ef940b99925b96completed.Summary: Fixed issue #1611:
Summarizer.classifyTopicandSummarizer.arbitrateTopicSplitin the memos-local-openclaw plugin used to unconditionally dispatch to the OpenAI implementation, so any summarizer configured against an Anthropic-only endpoint (e.g. Kimi Code's/coding/v1/messages) had every classification call return 404 — the OpenAI helper appended/chat/completionsto a URL that doesn't exist. The fix implements Option A from the issue: added six new native transport helpers (classifyTopic{Anthropic,Gemini,Bedrock}andarbitrateTopicSplit{Anthropic,Gemini,Bedrock}) mirroring the shape of the existingjudgeNewTopic*helpers, and rewired bothcallTopicClassifierandcallTopicArbitrationswitch statements so theanthropic/gemini/bedrockarms route to their native implementations instead of falling through to the OpenAI helpers.To prevent prompt drift across providers,
TOPIC_CLASSIFIER_PROMPT/TOPIC_ARBITRATION_PROMPTare exported fromopenai.tsand re-imported by the three provider files;parseTopicClassifyResultcontinues as the single JSON parser. The byte-similar duplicate atpackages/memos-core/src/ingest/providers/received identical edits so a future re-sync between the two trees cannot silently regress the bug. Bedrock helpers requirecfg.endpoint, matching every other Bedrock helper in the file.Tests: added
apps/memos-local-openclaw/tests/topic-classifier-dispatch.test.tswith 8 cases that stubglobalThis.fetchand assert each provider hits the correct URL + body shape. TDD baseline was 7/8 failing against the buggy code — the anthropic case surfaces the exactOpenAI topic-classifier failed (404)string from the issue. Post-fix: 8/8 pass. Existingtopic-judge-minimax-1315.test.ts(5/5) continues to pass, andtask-processor.test.tsregressions match baseline exactly.tsc --noEmiton the modified provider files is clean.Files: 5 modified + 1 new in
apps/memos-local-openclaw/, 5 mirrored inpackages/memos-core/. Total 11 files, 876 insertions, 14 deletions. Branch pushed toorigin/feature/autodev-1611-20260721033002951; scheduler will create the PR and add reviewers.Base branch:
mainBranch:
feature/autodev-1611-20260721033002951Commit:
1f7ffe1PR: #2133
Assigned to: @bittergreen
Reviewers: @whipser030, @hijzy
fix(openclaw): harden topic-classifier/arbitrator providers per OCR r…
Fix #1611: classifyTopic fails when summarizer uses Anthropic endpoin…
release: merge dev-v2.0.25 into main (MemTensor#2156)
release: merge dev-v2.0.25 into main (MemTensor#2156)