From e95a37fd3c62a67ef9f5ad6663d15681045b0a89 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 27 Apr 2026 18:21:06 +0900 Subject: [PATCH] fix(doctor): parse multi-slash model IDs Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .../doctor/checks/model-resolution.test.ts | 41 +++++++++++++++++++ src/cli/doctor/checks/model-resolution.ts | 4 +- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/cli/doctor/checks/model-resolution.test.ts b/src/cli/doctor/checks/model-resolution.test.ts index 49d308f3c..b81af8185 100644 --- a/src/cli/doctor/checks/model-resolution.test.ts +++ b/src/cli/doctor/checks/model-resolution.test.ts @@ -1,6 +1,47 @@ import { describe, it, expect } from "bun:test" describe("model-resolution check", () => { + describe("parseProviderModel", () => { + it("splits chutes model IDs at the provider separator", async () => { + const { parseProviderModel } = await import("./model-resolution") + + // #given a provider-prefixed model whose model ID contains a slash + const value = "chutes/deepseek-ai/DeepSeek-V3.2-TEE" + + // #when parsing the provider and model IDs + const result = parseProviderModel(value) + + // #then only the first slash separates the provider + expect(result).toEqual({ providerID: "chutes", modelID: "deepseek-ai/DeepSeek-V3.2-TEE" }) + }) + + it("splits simple provider model IDs", async () => { + const { parseProviderModel } = await import("./model-resolution") + + // #given a provider-prefixed model without extra slashes + const value = "openai/gpt-5" + + // #when parsing the provider and model IDs + const result = parseProviderModel(value) + + // #then provider and model are split normally + expect(result).toEqual({ providerID: "openai", modelID: "gpt-5" }) + }) + + it("splits synthetic provider model IDs at the provider separator", async () => { + const { parseProviderModel } = await import("./model-resolution") + + // #given a synthetic provider model whose model ID contains a slash + const value = "synthetic/hf:zai-org/GLM-5.1" + + // #when parsing the provider and model IDs + const result = parseProviderModel(value) + + // #then only the first slash separates the provider + expect(result).toEqual({ providerID: "synthetic", modelID: "hf:zai-org/GLM-5.1" }) + }) + }) + describe("getModelResolutionInfo", () => { // given: Model requirements are defined in model-requirements.ts // when: Getting model resolution info diff --git a/src/cli/doctor/checks/model-resolution.ts b/src/cli/doctor/checks/model-resolution.ts index ccc697845..bb534ec48 100644 --- a/src/cli/doctor/checks/model-resolution.ts +++ b/src/cli/doctor/checks/model-resolution.ts @@ -8,8 +8,8 @@ import { buildModelResolutionDetails } from "./model-resolution-details" import { buildEffectiveResolution, getEffectiveModel } from "./model-resolution-effective-model" import type { AgentResolutionInfo, CategoryResolutionInfo, ModelResolutionInfo, OmoConfig } from "./model-resolution-types" -function parseProviderModel(value: string): { providerID: string; modelID: string } | null { - const slashIndex = value.lastIndexOf("/") +export function parseProviderModel(value: string): { providerID: string; modelID: string } | null { + const slashIndex = value.indexOf("/") if (slashIndex <= 0 || slashIndex === value.length - 1) { return null }