




















11// Covers provider/model gates for strict agentic execution-contract activation.
22import { describe, expect, it } from "vitest";
33import type { OpenClawConfig } from "../config/types.openclaw.js";
4-import {
5-isStrictAgenticExecutionContractActive,
6-resolveEffectiveExecutionContract,
7-} from "./execution-contract.js";
4+import { isStrictAgenticExecutionContractActive } from "./execution-contract.js";
859-describe("resolveEffectiveExecutionContract", () => {
6+describe("isStrictAgenticExecutionContractActive", () => {
107const supportedProvider = "openai";
118const unsupportedProvider = "anthropic";
129const emptyConfig: OpenClawConfig = {};
13101411describe("supported provider + model detection", () => {
1512it("auto-activates on bare gpt-5 model ids", () => {
1613expect(
17-resolveEffectiveExecutionContract({
14+isStrictAgenticExecutionContractActive({
1815config: emptyConfig,
1916provider: supportedProvider,
2017modelId: "gpt-5.4",
2118}),
22-).toBe("strict-agentic");
19+).toBe(true);
2320});
24212522it("auto-activates on the mock-openai qa lane", () => {
2623expect(
27-resolveEffectiveExecutionContract({
24+isStrictAgenticExecutionContractActive({
2825config: emptyConfig,
2926provider: "mock-openai",
3027modelId: "mock-openai/gpt-5.4",
3128}),
32-).toBe("strict-agentic");
29+).toBe(true);
3330});
34313532it("auto-activates on gpt-5o and variants without a separator", () => {
3633for (const modelId of ["gpt-5", "gpt-5o", "gpt-5o-mini"]) {
3734expect(
38-resolveEffectiveExecutionContract({
35+isStrictAgenticExecutionContractActive({
3936config: emptyConfig,
4037provider: supportedProvider,
4138 modelId,
4239}),
43-).toBe("strict-agentic");
40+).toBe(true);
4441}
4542});
46434744it("auto-activates on dot-separated variants", () => {
4845for (const modelId of ["gpt-5.0", "gpt-5.4", "gpt-5.4-alt", "gpt-5.99"]) {
4946expect(
50-resolveEffectiveExecutionContract({
47+isStrictAgenticExecutionContractActive({
5148config: emptyConfig,
5249provider: supportedProvider,
5350 modelId,
5451}),
55-).toBe("strict-agentic");
52+).toBe(true);
5653}
5754});
58555956it("auto-activates on dash-separated variants", () => {
6057for (const modelId of ["gpt-5-preview", "gpt-5-turbo", "gpt-5-2025-03"]) {
6158expect(
62-resolveEffectiveExecutionContract({
59+isStrictAgenticExecutionContractActive({
6360config: emptyConfig,
6461provider: supportedProvider,
6562 modelId,
6663}),
67-).toBe("strict-agentic");
64+).toBe(true);
6865}
6966});
7067@@ -81,24 +78,24 @@ describe("resolveEffectiveExecutionContract", () => {
8178" OPENAI:GPT-5.4 ",
8279]) {
8380expect(
84-resolveEffectiveExecutionContract({
81+isStrictAgenticExecutionContractActive({
8582config: emptyConfig,
8683provider: supportedProvider,
8784 modelId,
8885}),
89-).toBe("strict-agentic");
86+).toBe(true);
9087}
9188});
92899390it("is case-insensitive", () => {
9491for (const modelId of ["GPT-5.4", "Gpt-5O", "OPENAI/GPT-5.4"]) {
9592expect(
96-resolveEffectiveExecutionContract({
93+isStrictAgenticExecutionContractActive({
9794config: emptyConfig,
9895provider: supportedProvider,
9996 modelId,
10097}),
101-).toBe("strict-agentic");
98+).toBe(true);
10299}
103100});
104101@@ -113,25 +110,25 @@ describe("resolveEffectiveExecutionContract", () => {
113110"mistral-large",
114111]) {
115112expect(
116-resolveEffectiveExecutionContract({
113+isStrictAgenticExecutionContractActive({
117114config: emptyConfig,
118115provider: supportedProvider,
119116 modelId,
120117}),
121-).toBe("default");
118+).toBe(false);
122119}
123120});
124121125122it("collapses to default on unsupported providers even with gpt-5 model ids", () => {
126123// Model naming alone is insufficient; unsupported providers must not
127124// inherit OpenAI-specific strict-agentic handling by accident.
128125expect(
129-resolveEffectiveExecutionContract({
126+isStrictAgenticExecutionContractActive({
130127config: emptyConfig,
131128provider: unsupportedProvider,
132129modelId: "gpt-5.4",
133130}),
134-).toBe("default");
131+).toBe(false);
135132});
136133});
137134@@ -147,12 +144,12 @@ describe("resolveEffectiveExecutionContract", () => {
147144},
148145};
149146expect(
150-resolveEffectiveExecutionContract({
147+isStrictAgenticExecutionContractActive({
151148 config,
152149provider: supportedProvider,
153150modelId: "gpt-5.4",
154151}),
155-).toBe("strict-agentic");
152+).toBe(true);
156153});
157154158155it("honors explicit default opt-out even on the supported lane", () => {
@@ -166,12 +163,12 @@ describe("resolveEffectiveExecutionContract", () => {
166163},
167164};
168165expect(
169-resolveEffectiveExecutionContract({
166+isStrictAgenticExecutionContractActive({
170167 config,
171168provider: supportedProvider,
172169modelId: "gpt-5.4",
173170}),
174-).toBe("default");
171+).toBe(false);
175172});
176173177174it("collapses explicit strict-agentic to default on an unsupported lane", () => {
@@ -185,12 +182,12 @@ describe("resolveEffectiveExecutionContract", () => {
185182},
186183};
187184expect(
188-resolveEffectiveExecutionContract({
185+isStrictAgenticExecutionContractActive({
189186 config,
190187provider: unsupportedProvider,
191188modelId: "claude-opus-4-6",
192189}),
193-).toBe("default");
190+).toBe(false);
194191});
195192});
196193此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。