fix: classify effective provider parameters

This commit is contained in:
Dallin Romney
2026-08-13 19:11:32 +08:00
parent 9cc7500e75
commit 4d93a6d1ed
2 changed files with 34 additions and 3 deletions
+3 -3
View File
@@ -101,7 +101,7 @@ export function hasAuthoredProviderRequestParams(
params: Parameters<typeof resolveModelExtraParamSources>[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));
}
+31
View File
@@ -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: {} }),