diff --git a/src/agents/model-extra-params.ts b/src/agents/model-extra-params.ts index c89c4c3b4df6..a7e824d2ecfd 100644 --- a/src/agents/model-extra-params.ts +++ b/src/agents/model-extra-params.ts @@ -101,7 +101,7 @@ export function hasAuthoredProviderRequestParams( params: Parameters[0], ): boolean { const sources = resolveModelExtraParamSources(params); - return [sources.defaultParams, sources.modelParams, sources.agentParams].some((source) => - Object.entries(source ?? {}).some(([key, value]) => !isAgentRuntimeModelParam(key, value)), - ); + return Object.entries( + Object.assign({}, sources.defaultParams, sources.modelParams, sources.agentParams), + ).some(([key, value]) => !isAgentRuntimeModelParam(key, value)); } diff --git a/src/agents/openai-routing.test.ts b/src/agents/openai-routing.test.ts index ef66701d7135..07d4917bdb90 100644 --- a/src/agents/openai-routing.test.ts +++ b/src/agents/openai-routing.test.ts @@ -148,6 +148,37 @@ describe("OpenAI runtime routing policy", () => { ).toBe(false); }); + it("classifies only the effective value after agent-model parameter precedence", () => { + const modelKey = "openai/gpt-5.6-sol"; + const config = { + agents: { + defaults: { + params: { thinking: { type: "enabled", budget_tokens: 2_048 } }, + }, + entries: { + audit: { + models: { + [modelKey]: { params: { thinking: "high" } }, + }, + }, + }, + }, + } satisfies OpenClawConfig; + + expect( + resolveOpenAIImplicitAgentRuntime({ + provider: "openai", + modelId: "gpt-5.6-sol", + config, + agentId: "audit", + env: {}, + }), + ).toBe("codex"); + expect( + modelSelectionShouldEnsureCodexPlugin({ model: modelKey, config, agentId: "audit" }), + ).toBe(true); + }); + it("maps provider route facts onto a closed implicit runtime", () => { expect( resolveOpenAIImplicitAgentRuntime({ provider: "openai", modelId: "gpt-5.6", env: {} }),