mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
fix: align Z.AI endpoint detection with GLM-5.1 default (#61998) (thanks @serg0x)
This commit is contained in:
@@ -101,9 +101,9 @@ Docs: https://docs.openclaw.ai
|
||||
- Daemon/systemd: keep sudo systemctl calls scoped to the invoking user when machine-scoped systemctl fails, while still avoiding machine fallback for permission-denied user bus errors. (#62337) Thanks @Aftabbs.
|
||||
- Docs/i18n: relocalize final localized-page links after translation and remove the zh-CN homepage redirect override so localized Mintlify pages resolve to the correct language roots again. (#61796) Thanks @hxy91819.
|
||||
- Agents/exec: keep timed-out shell-backgrounded commands on the failed path and point long-running jobs to exec background/yield sessions so process polling is only suggested for registered sessions.
|
||||
|
||||
- Agents/model resolution: let explicit `openai-codex/gpt-5.4` selection prefer provider runtime metadata when it reports a larger context window, keeping configured Codex runs aligned with the live provider limits. (#62694) Thanks @ruclaw7.
|
||||
- Agents/model resolution: keep explicit-model runtime comparisons on the configured workspace plugin registry, so workspace-installed providers do not silently fall back to stale explicit metadata during runtime model lookup.
|
||||
- Providers/Z.AI: default onboarding and endpoint detection to GLM-5.1 instead of GLM-5. (#61998) Thanks @serg0x.
|
||||
|
||||
## 2026.4.5
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ vi.mock("./onboard-non-interactive/local/auth-choice.plugin-providers.js", async
|
||||
const ZAI_FALLBACKS = {
|
||||
"zai-api-key": {
|
||||
baseUrl: ZAI_GLOBAL_BASE_URL,
|
||||
modelId: "glm-5",
|
||||
modelId: "glm-5.1",
|
||||
},
|
||||
"zai-coding-cn": {
|
||||
baseUrl: ZAI_CODING_CN_BASE_URL,
|
||||
@@ -114,7 +114,7 @@ vi.mock("./onboard-non-interactive/local/auth-choice.plugin-providers.js", async
|
||||
},
|
||||
"zai-coding-global": {
|
||||
baseUrl: ZAI_CODING_GLOBAL_BASE_URL,
|
||||
modelId: "glm-5",
|
||||
modelId: "glm-5.1",
|
||||
},
|
||||
} as const;
|
||||
|
||||
@@ -1064,7 +1064,7 @@ describe("onboard (non-interactive): provider auth", () => {
|
||||
it("stores Z.AI API key after probing the global endpoint", async () => {
|
||||
await withZaiProbeFetch(
|
||||
{
|
||||
[`${ZAI_GLOBAL_BASE_URL}/chat/completions::glm-5`]: 200,
|
||||
[`${ZAI_GLOBAL_BASE_URL}/chat/completions::glm-5.1`]: 200,
|
||||
},
|
||||
async (fetchMock) =>
|
||||
await withOnboardEnv("openclaw-onboard-zai-", async (env) => {
|
||||
@@ -1078,7 +1078,7 @@ describe("onboard (non-interactive): provider auth", () => {
|
||||
expectZaiProbeCalls(fetchMock, [
|
||||
{
|
||||
url: `${ZAI_GLOBAL_BASE_URL}/chat/completions`,
|
||||
modelId: "glm-5",
|
||||
modelId: "glm-5.1",
|
||||
},
|
||||
]);
|
||||
await expectApiKeyProfile({
|
||||
@@ -1093,7 +1093,7 @@ describe("onboard (non-interactive): provider auth", () => {
|
||||
it("supports Z.AI CN coding endpoint auth choice", async () => {
|
||||
await withZaiProbeFetch(
|
||||
{
|
||||
[`${ZAI_CODING_CN_BASE_URL}/chat/completions::glm-5`]: 404,
|
||||
[`${ZAI_CODING_CN_BASE_URL}/chat/completions::glm-5.1`]: 404,
|
||||
[`${ZAI_CODING_CN_BASE_URL}/chat/completions::glm-4.7`]: 200,
|
||||
},
|
||||
async (fetchMock) =>
|
||||
@@ -1108,7 +1108,7 @@ describe("onboard (non-interactive): provider auth", () => {
|
||||
expectZaiProbeCalls(fetchMock, [
|
||||
{
|
||||
url: `${ZAI_CODING_CN_BASE_URL}/chat/completions`,
|
||||
modelId: "glm-5",
|
||||
modelId: "glm-5.1",
|
||||
},
|
||||
{
|
||||
url: `${ZAI_CODING_CN_BASE_URL}/chat/completions`,
|
||||
@@ -1127,7 +1127,7 @@ describe("onboard (non-interactive): provider auth", () => {
|
||||
it("supports Z.AI Coding Plan global endpoint detection", async () => {
|
||||
await withZaiProbeFetch(
|
||||
{
|
||||
[`${ZAI_CODING_GLOBAL_BASE_URL}/chat/completions::glm-5`]: 200,
|
||||
[`${ZAI_CODING_GLOBAL_BASE_URL}/chat/completions::glm-5.1`]: 200,
|
||||
},
|
||||
async (fetchMock) =>
|
||||
await withOnboardEnv("openclaw-onboard-zai-coding-global-", async (env) => {
|
||||
@@ -1141,7 +1141,7 @@ describe("onboard (non-interactive): provider auth", () => {
|
||||
expectZaiProbeCalls(fetchMock, [
|
||||
{
|
||||
url: `${ZAI_CODING_GLOBAL_BASE_URL}/chat/completions`,
|
||||
modelId: "glm-5",
|
||||
modelId: "glm-5.1",
|
||||
},
|
||||
]);
|
||||
await expectApiKeyProfile({
|
||||
|
||||
@@ -27,34 +27,34 @@ describe("detectZaiEndpoint", () => {
|
||||
}> = [
|
||||
{
|
||||
responses: {
|
||||
"https://api.z.ai/api/paas/v4/chat/completions::glm-5": { status: 200 },
|
||||
"https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": { status: 200 },
|
||||
},
|
||||
expected: { endpoint: "global", modelId: "glm-5" },
|
||||
expected: { endpoint: "global", modelId: "glm-5.1" },
|
||||
},
|
||||
{
|
||||
responses: {
|
||||
"https://api.z.ai/api/paas/v4/chat/completions::glm-5": {
|
||||
"https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": {
|
||||
status: 404,
|
||||
body: { error: { message: "not found" } },
|
||||
},
|
||||
"https://open.bigmodel.cn/api/paas/v4/chat/completions::glm-5": { status: 200 },
|
||||
"https://open.bigmodel.cn/api/paas/v4/chat/completions::glm-5.1": { status: 200 },
|
||||
},
|
||||
expected: { endpoint: "cn", modelId: "glm-5" },
|
||||
expected: { endpoint: "cn", modelId: "glm-5.1" },
|
||||
},
|
||||
{
|
||||
responses: {
|
||||
"https://api.z.ai/api/paas/v4/chat/completions::glm-5": { status: 404 },
|
||||
"https://open.bigmodel.cn/api/paas/v4/chat/completions::glm-5": { status: 404 },
|
||||
"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5": { status: 200 },
|
||||
"https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": { status: 404 },
|
||||
"https://open.bigmodel.cn/api/paas/v4/chat/completions::glm-5.1": { status: 404 },
|
||||
"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.1": { status: 200 },
|
||||
},
|
||||
expected: { endpoint: "coding-global", modelId: "glm-5" },
|
||||
expected: { endpoint: "coding-global", modelId: "glm-5.1" },
|
||||
},
|
||||
{
|
||||
endpoint: "coding-global",
|
||||
responses: {
|
||||
"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5": {
|
||||
"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.1": {
|
||||
status: 404,
|
||||
body: { error: { message: "glm-5 unavailable" } },
|
||||
body: { error: { message: "glm-5.1 unavailable" } },
|
||||
},
|
||||
"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-4.7": { status: 200 },
|
||||
},
|
||||
@@ -63,16 +63,18 @@ describe("detectZaiEndpoint", () => {
|
||||
{
|
||||
endpoint: "coding-cn",
|
||||
responses: {
|
||||
"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5": { status: 200 },
|
||||
"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.1": {
|
||||
status: 200,
|
||||
},
|
||||
},
|
||||
expected: { endpoint: "coding-cn", modelId: "glm-5" },
|
||||
expected: { endpoint: "coding-cn", modelId: "glm-5.1" },
|
||||
},
|
||||
{
|
||||
endpoint: "coding-cn",
|
||||
responses: {
|
||||
"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5": {
|
||||
"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.1": {
|
||||
status: 404,
|
||||
body: { error: { message: "glm-5 unavailable" } },
|
||||
body: { error: { message: "glm-5.1 unavailable" } },
|
||||
},
|
||||
"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-4.7": { status: 200 },
|
||||
},
|
||||
@@ -80,11 +82,13 @@ describe("detectZaiEndpoint", () => {
|
||||
},
|
||||
{
|
||||
responses: {
|
||||
"https://api.z.ai/api/paas/v4/chat/completions::glm-5": { status: 401 },
|
||||
"https://open.bigmodel.cn/api/paas/v4/chat/completions::glm-5": { status: 401 },
|
||||
"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5": { status: 401 },
|
||||
"https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": { status: 401 },
|
||||
"https://open.bigmodel.cn/api/paas/v4/chat/completions::glm-5.1": { status: 401 },
|
||||
"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-5.1": { status: 401 },
|
||||
"https://api.z.ai/api/coding/paas/v4/chat/completions::glm-4.7": { status: 401 },
|
||||
"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5": { status: 401 },
|
||||
"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-5.1": {
|
||||
status: 401,
|
||||
},
|
||||
"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions::glm-4.7": { status: 401 },
|
||||
},
|
||||
expected: null,
|
||||
|
||||
@@ -102,28 +102,28 @@ export async function detectZaiEndpoint(params: {
|
||||
{
|
||||
endpoint: "global" as const,
|
||||
baseUrl: ZAI_GLOBAL_BASE_URL,
|
||||
modelId: "glm-5",
|
||||
note: "Verified GLM-5 on global endpoint.",
|
||||
modelId: "glm-5.1",
|
||||
note: "Verified GLM-5.1 on global endpoint.",
|
||||
},
|
||||
{
|
||||
endpoint: "cn" as const,
|
||||
baseUrl: ZAI_CN_BASE_URL,
|
||||
modelId: "glm-5",
|
||||
note: "Verified GLM-5 on cn endpoint.",
|
||||
modelId: "glm-5.1",
|
||||
note: "Verified GLM-5.1 on cn endpoint.",
|
||||
},
|
||||
];
|
||||
const codingGlm5 = [
|
||||
const codingGlm51 = [
|
||||
{
|
||||
endpoint: "coding-global" as const,
|
||||
baseUrl: ZAI_CODING_GLOBAL_BASE_URL,
|
||||
modelId: "glm-5",
|
||||
note: "Verified GLM-5 on coding-global endpoint.",
|
||||
modelId: "glm-5.1",
|
||||
note: "Verified GLM-5.1 on coding-global endpoint.",
|
||||
},
|
||||
{
|
||||
endpoint: "coding-cn" as const,
|
||||
baseUrl: ZAI_CODING_CN_BASE_URL,
|
||||
modelId: "glm-5",
|
||||
note: "Verified GLM-5 on coding-cn endpoint.",
|
||||
modelId: "glm-5.1",
|
||||
note: "Verified GLM-5.1 on coding-cn endpoint.",
|
||||
},
|
||||
];
|
||||
const codingFallback = [
|
||||
@@ -131,13 +131,13 @@ export async function detectZaiEndpoint(params: {
|
||||
endpoint: "coding-global" as const,
|
||||
baseUrl: ZAI_CODING_GLOBAL_BASE_URL,
|
||||
modelId: "glm-4.7",
|
||||
note: "Coding Plan endpoint verified, but this key/plan does not expose GLM-5 there. Defaulting to GLM-4.7.",
|
||||
note: "Coding Plan endpoint verified, but this key/plan does not expose GLM-5.1 there. Defaulting to GLM-4.7.",
|
||||
},
|
||||
{
|
||||
endpoint: "coding-cn" as const,
|
||||
baseUrl: ZAI_CODING_CN_BASE_URL,
|
||||
modelId: "glm-4.7",
|
||||
note: "Coding Plan CN endpoint verified, but this key/plan does not expose GLM-5 there. Defaulting to GLM-4.7.",
|
||||
note: "Coding Plan CN endpoint verified, but this key/plan does not expose GLM-5.1 there. Defaulting to GLM-4.7.",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -148,16 +148,16 @@ export async function detectZaiEndpoint(params: {
|
||||
return general.filter((candidate) => candidate.endpoint === "cn");
|
||||
case "coding-global":
|
||||
return [
|
||||
...codingGlm5.filter((candidate) => candidate.endpoint === "coding-global"),
|
||||
...codingGlm51.filter((candidate) => candidate.endpoint === "coding-global"),
|
||||
...codingFallback.filter((candidate) => candidate.endpoint === "coding-global"),
|
||||
];
|
||||
case "coding-cn":
|
||||
return [
|
||||
...codingGlm5.filter((candidate) => candidate.endpoint === "coding-cn"),
|
||||
...codingGlm51.filter((candidate) => candidate.endpoint === "coding-cn"),
|
||||
...codingFallback.filter((candidate) => candidate.endpoint === "coding-cn"),
|
||||
];
|
||||
default:
|
||||
return [...general, ...codingGlm5, ...codingFallback];
|
||||
return [...general, ...codingGlm51, ...codingFallback];
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user