feat(code-queue): register minimax-m3 alongside minimax-m2.7

Add minimax-m3 as a sibling model on the same path as the existing
minimax-m2.7 support. M3 is the new PROD default; M2.7 remains available
as a one-line rollback target via MINIMAX_MODEL.

Changes:
- code-agent/common.ts: add minimaxM3Model constant, include in
  defaultCodeModels, normalize aliases (minimax-m3 / m3), route to
  opencode port, sibling entry in codeModelProviderSourceContract.
- code-agent/opencode.ts: add M3 branch in openCodeModelId, register
  both M2.7 and M3 in openCodeConfigContent, inject MINIMAX_M3_MODEL
  in local/remote env, M3 branch in missingOpenCodeCredentialMessage.
- index.ts + types.ts: add minimaxM3Model to RuntimeConfig, read
  MINIMAX_M3_MODEL env, propagate to remoteCodexEnvKeys.
- queue-api.ts: include minimaxM3Model in Pick for
  codeModelProviderSourceContract callers.
- scripts/src/code-queue.ts: add minimaxM3SubmitModel, normalize/port
  routing, default route recommendation now points to M3, M2.7 kept
  as minimaxM2FallbackCandidate.
- scripts/src/docker.ts: default UNIDESK_CODE_QUEUE_MINIMAX_M3_MODEL
  to MiniMax-M3.
- k8s yaml (D601 + G14): CODE_QUEUE_MODELS gains minimax-m3, three
  deployments each set MINIMAX_MODEL=MiniMax-M3 and
  MINIMAX_M3_MODEL=MiniMax-M3.
- docker-compose.d601.yml: same env defaults for local compose.
- docs/reference/{code-queue-supervision,microservices,
  windows-passthrough}.md: update model contracts to M3 default +
  M2.7 fallback.
- scripts/code-queue-submit-routing-contract-test.ts: low-risk
  recommendation now asserts minimax-m3; registry asserts both M3
  and M2.7 fallback in modelPorts/opencodeModels; provider source
  contract test passes minimaxM3Model.

Refs: #189
This commit is contained in:
Codex
2026-06-01 06:51:28 +00:00
parent 0b1c012ba5
commit 201a8c8af2
14 changed files with 102 additions and 33 deletions
@@ -29,7 +29,9 @@ services:
CODE_QUEUE_OPENCODE_XDG_DIR: "/var/lib/unidesk/code-queue/opencode-xdg"
CODE_QUEUE_SOURCE_CODEX_CONFIG: "/root/.codex/config.toml"
CODE_QUEUE_DEFAULT_MODEL: "${CODE_QUEUE_DEFAULT_MODEL:-gpt-5.5}"
CODE_QUEUE_MODELS: "${CODE_QUEUE_MODELS:-gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m2.7}"
CODE_QUEUE_MODELS: "${CODE_QUEUE_MODELS:-gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m3,minimax-m2.7}"
MINIMAX_MODEL: "${MINIMAX_MODEL:-MiniMax-M3}"
MINIMAX_M3_MODEL: "${MINIMAX_M3_MODEL:-MiniMax-M3}"
CODE_QUEUE_MODEL_REASONING_EFFORTS: "${CODE_QUEUE_MODEL_REASONING_EFFORTS:-gpt-5.5=xhigh}"
CODE_QUEUE_SANDBOX: "${CODE_QUEUE_SANDBOX:-danger-full-access}"
CODE_QUEUE_APPROVAL_POLICY: "${CODE_QUEUE_APPROVAL_POLICY:-never}"
@@ -33,8 +33,9 @@ export interface ActiveRunSlotWaiter {
const gitProxyEnvKeys = ["CODE_QUEUE_EGRESS_PROXY_URL", "HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"];
export const minimaxM27Model = "minimax-m2.7";
export const minimaxM3Model = "minimax-m3";
export const deepseekChatModel = "deepseek-chat";
export const defaultCodeModels = ["gpt-5.5", "gpt-5.4-mini", "gpt-5.4", deepseekChatModel, minimaxM27Model];
export const defaultCodeModels = ["gpt-5.5", "gpt-5.4-mini", "gpt-5.4", deepseekChatModel, minimaxM3Model, minimaxM27Model];
export const opencodeNpmPackage = "opencode-ai@1.14.48";
export const defaultCodeExecutionMode: CodeExecutionMode = "default";
export const codeExecutionModes: CodeExecutionMode[] = ["default", "windows-native"];
@@ -49,6 +50,7 @@ export interface CodeModelProviderSourceConfig {
minimaxApiBase: string;
minimaxApiKey: string;
minimaxModel: string;
minimaxM3Model: string;
}
function proxyUrlFromEnv(env: NodeJS.ProcessEnv): string {
@@ -90,13 +92,14 @@ export function normalizeCodeModel(value: string): string {
const lower = raw.toLowerCase();
const leaf = lower.includes("/") ? lower.split("/").at(-1) ?? lower : lower;
if (leaf === "minimax-m2.7" || leaf === "m2.7") return minimaxM27Model;
if (leaf === "minimax-m3" || leaf === "m3") return minimaxM3Model;
if (leaf === "deepseek" || leaf === "deepseek-chat") return deepseekChatModel;
return raw;
}
export function codeAgentPortForModel(model: string): CodeAgentPortKind {
const normalized = normalizeCodeModel(model);
return normalized === minimaxM27Model || normalized === deepseekChatModel ? "opencode" : "codex";
return normalized === minimaxM27Model || normalized === minimaxM3Model || normalized === deepseekChatModel ? "opencode" : "codex";
}
export function normalizeCodeExecutionMode(value: unknown): CodeExecutionMode {
@@ -199,6 +202,19 @@ export function codeModelProviderSourceContract(config: CodeModelProviderSourceC
model: configRef("MINIMAX_MODEL", config.minimaxModel, env),
},
},
minimaxM3: {
runner: "opencode",
publicModel: minimaxM3Model,
providerModel: config.minimaxM3Model.trim() || "MiniMax-M3",
credentialSource: {
apiKey: {
...configRef("MINIMAX_API_KEY", config.minimaxApiKey, env),
present: config.minimaxApiKey.trim().length > 0,
},
baseURL: configRef("MINIMAX_API_BASE", config.minimaxApiBase, env),
model: configRef("MINIMAX_M3_MODEL", config.minimaxM3Model, env),
},
},
},
};
}
@@ -6,11 +6,11 @@ import { resolve } from "node:path";
import * as readline from "node:readline";
import type { AppServerExit, CodexEventSummary, CodexRunResult, JsonValue, QueueTask, RuntimeConfig, TerminalStatus } from "../types";
import type { ActiveRun, CodeAgentClient } from "./common";
import { codeAgentGitConfigEntries, deepseekChatModel, extractRecord, minimaxM27Model, normalizeCodeModel, stripAnsi, withCodeAgentGitConfigEnv } from "./common";
import { codeAgentGitConfigEntries, deepseekChatModel, extractRecord, minimaxM27Model, minimaxM3Model, normalizeCodeModel, stripAnsi, withCodeAgentGitConfigEnv } from "./common";
import { classifyRunnerError, runnerErrorClassificationJson } from "../runner-error-classifier";
export interface OpenCodePortContext {
config: Pick<RuntimeConfig, "deepseekApiBase" | "deepseekApiKey" | "deepseekModel" | "defaultWorkdir" | "minimaxApiBase" | "minimaxApiKey" | "minimaxModel" | "resolvedRunnerSkillsPath" | "turnNoActivityTimeoutMs">;
config: Pick<RuntimeConfig, "deepseekApiBase" | "deepseekApiKey" | "deepseekModel" | "defaultWorkdir" | "minimaxApiBase" | "minimaxApiKey" | "minimaxModel" | "minimaxM3Model" | "resolvedRunnerSkillsPath" | "turnNoActivityTimeoutMs">;
activeRuns: Map<string, ActiveRun>;
addEvent: (task: QueueTask, event: CodexEventSummary) => void;
appendOutput: (task: QueueTask, channel: "system" | "assistant" | "reasoning" | "command" | "diff" | "tool" | "error", text: string, method?: string, itemId?: string, append?: boolean) => unknown;
@@ -74,6 +74,10 @@ function openCodeModelId(model: string): string {
const providerModel = ctx().config.minimaxModel.trim() || "MiniMax-M2.7";
return `minimax/${providerModel}`;
}
if (normalized === minimaxM3Model) {
const providerModel = ctx().config.minimaxM3Model.trim() || "MiniMax-M3";
return `minimax/${providerModel}`;
}
if (normalized === deepseekChatModel) {
const providerModel = ctx().config.deepseekModel.trim() || "deepseek-chat";
return `deepseek/${providerModel}`;
@@ -83,6 +87,7 @@ function openCodeModelId(model: string): string {
function openCodeConfigContent(): string {
const providerModel = ctx().config.minimaxModel.trim() || "MiniMax-M2.7";
const providerModelM3 = ctx().config.minimaxM3Model.trim() || "MiniMax-M3";
const deepseekModel = ctx().config.deepseekModel.trim() || "deepseek-chat";
return JSON.stringify({
$schema: "https://opencode.ai/config.json",
@@ -99,6 +104,10 @@ function openCodeConfigContent(): string {
name: minimaxM27Model,
limit: { context: 200000, output: 16384 },
},
[providerModelM3]: {
name: minimaxM3Model,
limit: { context: 200000, output: 16384 },
},
},
},
deepseek: {
@@ -139,6 +148,7 @@ function openCodeEnv(task: QueueTask): NodeJS.ProcessEnv {
MINIMAX_API_KEY: ctx().config.minimaxApiKey,
MINIMAX_API_BASE: ctx().config.minimaxApiBase,
MINIMAX_MODEL: ctx().config.minimaxModel,
MINIMAX_M3_MODEL: ctx().config.minimaxM3Model,
OPENCODE_CONFIG_CONTENT: openCodeConfigContent(),
UNIDESK_SKILLS_PATH: ctx().config.resolvedRunnerSkillsPath(),
});
@@ -165,6 +175,7 @@ function remoteOpenCodeRunCommand(task: QueueTask, prompt: string): string {
`export DEEPSEEK_MODEL=${ctx().shellQuote(ctx().config.deepseekModel)}`,
`export MINIMAX_API_BASE=${ctx().shellQuote(ctx().config.minimaxApiBase)}`,
`export MINIMAX_MODEL=${ctx().shellQuote(ctx().config.minimaxModel)}`,
`export MINIMAX_M3_MODEL=${ctx().shellQuote(ctx().config.minimaxM3Model)}`,
`export OPENCODE_CONFIG_CONTENT=${ctx().shellQuote(openCodeConfigContent())}`,
`export UNIDESK_SKILLS_PATH=${ctx().shellQuote(ctx().config.resolvedRunnerSkillsPath())}`,
...gitConfigEntries.map(([key, value], index) => `export GIT_CONFIG_KEY_$((\${GIT_CONFIG_COUNT:-0}+${index}))=${ctx().shellQuote(key)} GIT_CONFIG_VALUE_$((\${GIT_CONFIG_COUNT:-0}+${index}))=${ctx().shellQuote(value)}`),
@@ -383,6 +394,7 @@ function classifyOpenCodeRunnerFailure(task: QueueTask, result: Pick<CodexRunRes
function missingOpenCodeCredentialMessage(model: string): string | null {
const normalized = normalizeCodeModel(model);
if (normalized === minimaxM27Model && ctx().config.minimaxApiKey.length === 0) return "MINIMAX_API_KEY is required for opencode model minimax-m2.7.";
if (normalized === minimaxM3Model && ctx().config.minimaxApiKey.length === 0) return "MINIMAX_API_KEY is required for opencode model minimax-m3.";
if (normalized === deepseekChatModel && ctx().config.deepseekApiKey.length === 0) return "DEEPSEEK_API_KEY is required for opencode model deepseek-chat.";
return null;
}
@@ -401,7 +401,7 @@ function readConfig(): RuntimeConfig {
mainProviderId,
remoteDefaultWorkdir,
executionProviderIds,
remoteCodexEnvKeys: envList("CODE_QUEUE_REMOTE_CODEX_ENV_KEYS", ["OPENAI_API_KEY", "CRS_OAI_KEY", "OPENAI_BASE_URL", "OPENAI_API_BASE", "DEEPSEEK_API_KEY", "DEEPSEEK_API_BASE", "DEEPSEEK_MODEL", "MINIMAX_API_KEY", "MINIMAX_API_BASE", "MINIMAX_MODEL", "GH_TOKEN", "GITHUB_TOKEN", "GH_HOST", "GITHUB_API_URL", "GH_REPO"]),
remoteCodexEnvKeys: envList("CODE_QUEUE_REMOTE_CODEX_ENV_KEYS", ["OPENAI_API_KEY", "CRS_OAI_KEY", "OPENAI_BASE_URL", "OPENAI_API_BASE", "DEEPSEEK_API_KEY", "DEEPSEEK_API_BASE", "DEEPSEEK_MODEL", "MINIMAX_API_KEY", "MINIMAX_API_BASE", "MINIMAX_MODEL", "MINIMAX_M3_MODEL", "GH_TOKEN", "GITHUB_TOKEN", "GH_HOST", "GITHUB_API_URL", "GH_REPO"]),
skillsPath: envString("UNIDESK_SKILLS_PATH", "/root/.agents/skills"),
runnerSkillsSourcePath: envString("CODE_QUEUE_RUNNER_SKILLS_SOURCE_PATH", "/home/ubuntu/.agents/skills"),
resolvedRunnerSkillsPath,
@@ -428,6 +428,7 @@ function readConfig(): RuntimeConfig {
minimaxApiKey: envString("MINIMAX_API_KEY", ""),
minimaxApiBase: envString("MINIMAX_API_BASE", "https://api.minimaxi.com/v1").replace(/\/+$/u, ""),
minimaxModel: envString("MINIMAX_MODEL", "MiniMax-M2.7"),
minimaxM3Model: envString("MINIMAX_M3_MODEL", "MiniMax-M3"),
judgeTimeoutMs: envNumber("MINIMAX_JUDGE_TIMEOUT_MS", 90_000),
judgeRepairAttempts: Math.max(0, Math.min(5, envNumber("MINIMAX_JUDGE_REPAIR_ATTEMPTS", 2))),
judgeMaxTokens: Math.max(800, Math.min(4000, envNumber("MINIMAX_JUDGE_MAX_TOKENS", 1800))),
@@ -14,7 +14,7 @@ import type { ActiveRun, ActiveRunSlotWaiter } from "./code-agent/common";
import type { JsonValue, QueueRecord, QueuedStatusReason, QueueTask, RuntimeConfig, TaskStatus, TranscriptLine } from "./types";
export interface QueueApiContext {
config: Pick<RuntimeConfig, "approvalPolicy" | "codeModels" | "codexModels" | "codexSqliteLogExportBatchSize" | "codexSqliteLogExportEnabled" | "codexSqliteLogExportIntervalMs" | "codexSqliteLogMaxBytes" | "deepseekApiBase" | "deepseekApiKey" | "deepseekModel" | "defaultModel" | "defaultReasoningEffort" | "defaultWorkdir" | "judgeMaxTokens" | "judgeRepairAttempts" | "mainProviderId" | "maxActiveQueues" | "maxInMemoryEventRecords" | "maxInMemoryOutputRecords" | "minimaxApiBase" | "minimaxApiKey" | "minimaxModel" | "modelReasoningEfforts" | "notifyClaudeQqBaseUrl" | "notifyClaudeQqEnabled" | "notifyClaudeQqMaxResponseChars" | "notifyClaudeQqRetryIntervalMs" | "notifyClaudeQqSendAttempts" | "notifyClaudeQqTargetType" | "notifyClaudeQqTimeoutMs" | "outputArchiveDir" | "remoteDefaultWorkdir" | "sandbox" | "schedulerEnabled" | "schedulerPollIntervalMs" | "windowsNativeCodexDefaultWorkdir">;
config: Pick<RuntimeConfig, "approvalPolicy" | "codeModels" | "codexModels" | "codexSqliteLogExportBatchSize" | "codexSqliteLogExportEnabled" | "codexSqliteLogExportIntervalMs" | "codexSqliteLogMaxBytes" | "deepseekApiBase" | "deepseekApiKey" | "deepseekModel" | "defaultModel" | "defaultReasoningEffort" | "defaultWorkdir" | "judgeMaxTokens" | "judgeRepairAttempts" | "mainProviderId" | "maxActiveQueues" | "maxInMemoryEventRecords" | "maxInMemoryOutputRecords" | "minimaxApiBase" | "minimaxApiKey" | "minimaxM3Model" | "minimaxModel" | "modelReasoningEfforts" | "notifyClaudeQqBaseUrl" | "notifyClaudeQqEnabled" | "notifyClaudeQqMaxResponseChars" | "notifyClaudeQqRetryIntervalMs" | "notifyClaudeQqSendAttempts" | "notifyClaudeQqTargetType" | "notifyClaudeQqTimeoutMs" | "outputArchiveDir" | "remoteDefaultWorkdir" | "sandbox" | "schedulerEnabled" | "schedulerPollIntervalMs" | "windowsNativeCodexDefaultWorkdir">;
activeRunSlotQueueIds: () => string[];
activeRunSlotWaiterSummaries: () => JsonValue[];
activeRuns: Map<string, ActiveRun>;
@@ -149,6 +149,7 @@ export interface RuntimeConfig {
minimaxApiKey: string;
minimaxApiBase: string;
minimaxModel: string;
minimaxM3Model: string;
judgeTimeoutMs: number;
judgeRepairAttempts: number;
judgeMaxTokens: number;
@@ -87,7 +87,11 @@ spec:
- name: CODE_QUEUE_DEFAULT_MODEL
value: "gpt-5.5"
- name: CODE_QUEUE_MODELS
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m2.7"
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m3,minimax-m2.7"
- name: MINIMAX_MODEL
value: "MiniMax-M3"
- name: MINIMAX_M3_MODEL
value: "MiniMax-M3"
- name: CODE_QUEUE_MODEL_REASONING_EFFORTS
value: "gpt-5.5=xhigh"
- name: CODE_QUEUE_SANDBOX
@@ -335,7 +339,11 @@ spec:
- name: CODE_QUEUE_DEFAULT_MODEL
value: "gpt-5.5"
- name: CODE_QUEUE_MODELS
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m2.7"
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m3,minimax-m2.7"
- name: MINIMAX_MODEL
value: "MiniMax-M3"
- name: MINIMAX_M3_MODEL
value: "MiniMax-M3"
- name: CODE_QUEUE_MODEL_REASONING_EFFORTS
value: "gpt-5.5=xhigh"
- name: CODE_QUEUE_SANDBOX
@@ -1045,7 +1053,11 @@ spec:
- name: CODE_QUEUE_DEFAULT_MODEL
value: "gpt-5.5"
- name: CODE_QUEUE_MODELS
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m2.7"
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m3,minimax-m2.7"
- name: MINIMAX_MODEL
value: "MiniMax-M3"
- name: MINIMAX_M3_MODEL
value: "MiniMax-M3"
- name: CODE_QUEUE_MODEL_REASONING_EFFORTS
value: "gpt-5.5=xhigh"
- name: CODE_QUEUE_SANDBOX
@@ -87,7 +87,11 @@ spec:
- name: CODE_QUEUE_DEFAULT_MODEL
value: "gpt-5.5"
- name: CODE_QUEUE_MODELS
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m2.7"
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m3,minimax-m2.7"
- name: MINIMAX_MODEL
value: "MiniMax-M3"
- name: MINIMAX_M3_MODEL
value: "MiniMax-M3"
- name: CODE_QUEUE_MODEL_REASONING_EFFORTS
value: "gpt-5.5=xhigh"
- name: CODE_QUEUE_SANDBOX
@@ -335,7 +339,11 @@ spec:
- name: CODE_QUEUE_DEFAULT_MODEL
value: "gpt-5.5"
- name: CODE_QUEUE_MODELS
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m2.7"
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m3,minimax-m2.7"
- name: MINIMAX_MODEL
value: "MiniMax-M3"
- name: MINIMAX_M3_MODEL
value: "MiniMax-M3"
- name: CODE_QUEUE_MODEL_REASONING_EFFORTS
value: "gpt-5.5=xhigh"
- name: CODE_QUEUE_SANDBOX
@@ -1042,7 +1050,11 @@ spec:
- name: CODE_QUEUE_DEFAULT_MODEL
value: "gpt-5.5"
- name: CODE_QUEUE_MODELS
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m2.7"
value: "gpt-5.5,gpt-5.4-mini,gpt-5.4,deepseek-chat,minimax-m3,minimax-m2.7"
- name: MINIMAX_MODEL
value: "MiniMax-M3"
- name: MINIMAX_M3_MODEL
value: "MiniMax-M3"
- name: CODE_QUEUE_MODEL_REASONING_EFFORTS
value: "gpt-5.5=xhigh"
- name: CODE_QUEUE_SANDBOX