Skip to content

Commit 4d6bffb

Browse files
fix(anthropic): add rolling and dotted Haiku aliases to model normalization
ClawSweeper P2 review: the PR added haiku-4.5 and haiku short aliases, but claude-haiku-4-5 (rolling ref) and claude-haiku-4.5 (dotted ref) were not mapped to the dated catalog row. Static catalog lookup does exact match after normalization, so these refs would fail to resolve. Add both rolling and dotted full-form aliases to the anthropic normalization table so all user-facing Haiku refs resolve correctly. Fixes #90088
1 parent 2d23732 commit 4d6bffb

2 files changed

Lines changed: 75 additions & 1 deletion

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Test: verify Haiku 4.5 alias resolution through the real provider model normalization path.
2+
// This exercises the manifest normalization policies (not a custom simulator).
3+
4+
import { describe, expect, it } from "vitest";
5+
import { normalizeStaticProviderModelIdWithPolicies } from "@openclaw/model-catalog-core/provider-model-id-normalization";
6+
7+
// Load the actual manifest from the anthropic extension
8+
import anthropicManifest from "./openclaw.plugin.json" assert { type: "json" };
9+
10+
describe("anthropic haiku 4.5 manifest alias normalization", () => {
11+
const policies = new Map([
12+
[
13+
"anthropic",
14+
anthropicManifest.modelIdNormalization?.providers?.anthropic ?? {},
15+
],
16+
]);
17+
18+
it("normalizes claude-haiku-4-5 rolling ref to dated id", () => {
19+
const result = normalizeStaticProviderModelIdWithPolicies(
20+
"anthropic",
21+
"claude-haiku-4-5",
22+
policies,
23+
);
24+
expect(result).toBe("claude-haiku-4-5-20251001");
25+
});
26+
27+
it("normalizes claude-haiku-4.5 dotted ref to dated id", () => {
28+
const result = normalizeStaticProviderModelIdWithPolicies(
29+
"anthropic",
30+
"claude-haiku-4.5",
31+
policies,
32+
);
33+
expect(result).toBe("claude-haiku-4-5-20251001");
34+
});
35+
36+
it("normalizes haiku-4.5 short alias to dated id", () => {
37+
const result = normalizeStaticProviderModelIdWithPolicies(
38+
"anthropic",
39+
"haiku-4.5",
40+
policies,
41+
);
42+
expect(result).toBe("claude-haiku-4-5-20251001");
43+
});
44+
45+
it("normalizes haiku shortest alias to dated id", () => {
46+
const result = normalizeStaticProviderModelIdWithPolicies(
47+
"anthropic",
48+
"haiku",
49+
policies,
50+
);
51+
expect(result).toBe("claude-haiku-4-5-20251001");
52+
});
53+
54+
it("returns prefixed form unchanged when alias is for bare id (existing behavior)", () => {
55+
const result = normalizeStaticProviderModelIdWithPolicies(
56+
"anthropic",
57+
"anthropic/claude-haiku-4-5",
58+
policies,
59+
);
60+
// The alias lookup uses the bare id; prefixed input falls through to built-in normalization.
61+
expect(result).toBe("claude-haiku-4-5");
62+
});
63+
64+
it("preserves already-dated id unchanged", () => {
65+
const result = normalizeStaticProviderModelIdWithPolicies(
66+
"anthropic",
67+
"claude-haiku-4-5-20251001",
68+
policies,
69+
);
70+
expect(result).toBe("claude-haiku-4-5-20251001");
71+
});
72+
});

extensions/anthropic/openclaw.plugin.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@
147147
"opus-4.6": "claude-opus-4-6",
148148
"sonnet-4.6": "claude-sonnet-4-6",
149149
"haiku-4.5": "claude-haiku-4-5-20251001",
150-
"haiku": "claude-haiku-4-5-20251001"
150+
"haiku": "claude-haiku-4-5-20251001",
151+
"claude-haiku-4-5": "claude-haiku-4-5-20251001",
152+
"claude-haiku-4.5": "claude-haiku-4-5-20251001"
151153
}
152154
}
153155
}

0 commit comments

Comments
 (0)