
























@@ -319,10 +319,12 @@ async function writePluginBindingApproval(params: {
319319async function writeGatewayConfig(params: {
320320configPath: string;
321321model: string;
322+modelProvider?: string;
322323port: number;
323324token: string;
324325workspace: string;
325326}): Promise<void> {
327+const modelProvider = params.modelProvider?.trim() || "codex";
326328const cfg: OpenClawConfig = {
327329gateway: {
328330mode: "local",
@@ -348,7 +350,7 @@ async function writeGatewayConfig(params: {
348350defaults: {
349351workspace: params.workspace,
350352agentRuntime: { id: "codex" },
351-model: { primary: `codex/${params.model}` },
353+model: { primary: `${modelProvider}/${params.model}` },
352354skipBootstrap: true,
353355heartbeat: { every: "0m" },
354356sandbox: { mode: "off" },
@@ -358,6 +360,14 @@ async function writeGatewayConfig(params: {
358360await fs.writeFile(params.configPath, `${JSON.stringify(cfg, null, 2)}\n`);
359361}
360362363+function resolveCodexBindModelProvider(): string | undefined {
364+const configured = process.env.OPENCLAW_LIVE_CODEX_BIND_PROVIDER?.trim();
365+if (configured) {
366+return configured;
367+}
368+return process.env.OPENCLAW_LIVE_CODEX_HARNESS_AUTH === "api-key" ? "openai" : undefined;
369+}
370+361371describeLive("gateway live (native Codex conversation binding)", () => {
362372it(
363373"binds a Slack DM to Codex app-server, updates controls, and forwards image media paths",
@@ -386,6 +396,7 @@ describeLive("gateway live (native Codex conversation binding)", () => {
386396const conversationId = `user:${slackUserId}`;
387397const bindModel =
388398process.env.OPENCLAW_LIVE_CODEX_BIND_MODEL?.trim() || DEFAULT_CODEX_BIND_MODEL;
399+const bindProvider = resolveCodexBindModelProvider();
389400const outboundReplies: CapturedOutboundReply[] = [];
390401391402await fs.mkdir(workspace, { recursive: true });
@@ -400,7 +411,14 @@ describeLive("gateway live (native Codex conversation binding)", () => {
400411);
401412await fs.mkdir(tempHome, { recursive: true });
402413await fs.mkdir(stateDir, { recursive: true });
403-await writeGatewayConfig({ configPath, model: bindModel, port, token, workspace });
414+await writeGatewayConfig({
415+ configPath,
416+model: bindModel,
417+modelProvider: bindProvider,
418+ port,
419+ token,
420+ workspace,
421+});
404422405423clearConfigCache();
406424clearRuntimeConfigSnapshot();
@@ -449,7 +467,9 @@ describeLive("gateway live (native Codex conversation binding)", () => {
449467 client,
450468 sessionKey,
451469idempotencyKey: `idem-codex-bind-${randomUUID()}`,
452-message: `/codex bind --cwd ${workspace} --model ${bindModel}`,
470+message: `/codex bind --cwd ${workspace} --model ${bindModel}${
471+ bindProvider ? ` --provider ${bindProvider}` : ""
472+ }`,
453473originatingChannel: "slack",
454474originatingTo: conversationId,
455475originatingAccountId: accountId,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。