fix(cron): route CLI-runtime cron models through compatible backend

Co-authored-by: vishutdhar <68405187+vishutdhar@users.noreply.github.com>
This commit is contained in:
clawsweeper
2026-05-02 23:50:50 +00:00
parent 06cdb17ad2
commit 5ee1f48a49
3 changed files with 48 additions and 1 deletions

View File

@@ -60,6 +60,7 @@ Docs: https://docs.openclaw.ai
- Gateway: avoid repeated plugin tool descriptor config hashing so large runtime configs do not block reply startup and trigger reconnect/timeouts. (#75944) Thanks @joshavant.
- Plugins/externalization: keep diagnostics ClawHub packages and persisted bundled-plugin relocation on npm-first install metadata for launch, and omit Discord from the core package now that its external package is published. Thanks @vincentkoc.
- Setup/TUI: bound the Terminal hatch bootstrap run so a stalled provider request times out instead of leaving first-run hatching stuck behind the watchdog. (#76241) Thanks @joshavant.
- Cron/CLI runtimes: route isolated cron jobs through configured CLI runtimes only when the resolved model provider is compatible, so OpenAI job overrides no longer inherit a mismatched Claude CLI backend. Thanks @vishutdhar.
- Plugins/Codex: allow the official npm Codex plugin to install without the unsafe-install override, keep `/codex` command ownership, and cover the real npm Docker live path through managed `.openclaw/npm` dependencies plus uninstall failure proof.
- Gateway/status: add concrete service, config, listener-owner, and log collection next steps when gateway probes fail and Bonjour finds no local gateway, so frozen or port-conflict reports include the data needed for root-cause triage. Refs #49012. Thanks @vincentkoc.
- Codex harness: forward OpenClaw workspace bootstrap files such as `SOUL.md` through native Codex config instructions while leaving `AGENTS.md` to Codex project-doc discovery. Fixes #76273. Thanks @zknicker.

View File

@@ -401,6 +401,45 @@ describe("cron model formatting and precedence edge cases", () => {
});
});
describe("CLI runtime compatibility", () => {
it("uses a configured Claude CLI runtime for resolved Anthropic models", async () => {
await expectSelectedModel(
{
cfg: {
agents: {
defaults: {
model: "anthropic/claude-opus-4-6",
agentRuntime: { id: "claude-cli" },
},
},
},
},
{ provider: "claude-cli", model: "claude-opus-4-6" },
);
});
it("keeps an OpenAI payload override on OpenAI when Claude CLI is configured", async () => {
await expectSelectedModel(
{
cfg: {
agents: {
defaults: {
model: "anthropic/claude-opus-4-6",
agentRuntime: { id: "claude-cli" },
},
},
},
payload: {
kind: "agentTurn",
message: DEFAULT_MESSAGE,
model: "openai/gpt-4.1-mini",
},
},
{ provider: "openai", model: "gpt-4.1-mini" },
);
});
});
describe("stored session overrides", () => {
it("stored modelOverride/providerOverride are applied", async () => {
await expectSelectedModel(

View File

@@ -1,3 +1,4 @@
import { resolveCliRuntimeExecutionProvider } from "../../agents/model-runtime-aliases.js";
import type { OpenClawConfig } from "../../config/types.openclaw.js";
import type { CronJob } from "../types.js";
import {
@@ -147,5 +148,11 @@ export async function resolveCronModelSelection(
}
}
return { ok: true, provider, model };
const executionProvider =
resolveCliRuntimeExecutionProvider({
provider,
cfg: params.cfgWithAgentDefaults,
}) ?? provider;
return { ok: true, provider: executionProvider, model };
}