diff --git a/src/mgr/server.ts b/src/mgr/server.ts index ee3b699..ff39a32 100644 --- a/src/mgr/server.ts +++ b/src/mgr/server.ts @@ -5,6 +5,7 @@ import type { AgentRunStore, ListQueueTasksInput, ListSessionsInput, SessionEven import { openAgentRunStoreFromEnv } from "./store.js"; import { AgentRunError, errorToJson } from "../common/errors.js"; import { asRecord, validateBackendProfile, validateCreateCommand, validateCreateQueueTask, validateCreateRun, validateQueueTaskState, validateSessionListState } from "../common/validation.js"; +import { isBackendProfile } from "../common/backend-profiles.js"; import type { ApiErrorBody, ApiOkBody, JsonRecord, JsonValue, RunEvent } from "../common/types.js"; import { createKubernetesRunnerJob } from "./kubernetes-runner-job.js"; import { dispatchQueueTask, refreshQueueTaskFromCore } from "./queue-dispatch.js"; @@ -187,7 +188,7 @@ async function route({ method, url, body, store, sourceCommit, runnerJobDefaults const tenantId = stringField(record, "tenantId"); const projectId = stringField(record, "projectId"); const backendProfileRaw = typeof record.backendProfile === "string" ? record.backendProfile : "codex"; - if (backendProfileRaw !== "codex" && backendProfileRaw !== "deepseek" && backendProfileRaw !== "minimax-m3") throw new AgentRunError("schema-invalid", `backendProfile ${backendProfileRaw} is not supported`, { httpStatus: 400 }); + if (!isBackendProfile(backendProfileRaw)) throw new AgentRunError("schema-invalid", `backendProfile ${backendProfileRaw} is not supported`, { httpStatus: 400 }); const conversationId = typeof record.conversationId === "string" ? record.conversationId : null; const codexRolloutSubdir = typeof record.codexRolloutSubdir === "string" && record.codexRolloutSubdir.length > 0 ? record.codexRolloutSubdir : "sessions"; const expiresAt = typeof record.expiresAt === "string" ? record.expiresAt : new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString();