




















@@ -8,6 +8,18 @@ import {
88shouldSkipRetryableCodexHarnessLiveError,
99} from "./gateway-codex-harness.live-helpers.js";
101011+const includesExpectedCodexModelsCommandText = (text: string) =>
12+EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText));
13+14+function expectExpectedCodexModelsCommandText(text: string): void {
15+expect(includesExpectedCodexModelsCommandText(text)).toBe(true);
16+}
17+18+function expectRecognizedCodexModelsCommandText(text: string): void {
19+expectExpectedCodexModelsCommandText(text);
20+expect(isExpectedCodexModelsCommandText(text)).toBe(true);
21+}
22+1123describe("gateway codex harness live helpers", () => {
1224it("does not skip sessions.list timeouts when the Codex subagent probe is enabled", () => {
1325const error = new Error("gateway request timeout for sessions.list");
@@ -228,10 +240,7 @@ describe("gateway codex harness live helpers", () => {
228240"Current active model is `codex/gpt-5.4`.",
229241].join("\n");
230242231-expect(
232-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
233-).toBe(true);
234-expect(isExpectedCodexModelsCommandText(text)).toBe(true);
243+expectRecognizedCodexModelsCommandText(text);
235244});
236245237246it("accepts the configured-model fallback summary", () => {
@@ -256,10 +265,7 @@ describe("gateway codex harness live helpers", () => {
256265"I couldn’t get a fuller model catalog from the local `codex` CLI here.",
257266].join("\n");
258267259-expect(
260-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
261-).toBe(true);
262-expect(isExpectedCodexModelsCommandText(text)).toBe(true);
268+expectRecognizedCodexModelsCommandText(text);
263269});
264270265271it("accepts the current Codex agent model list from the live harness", () => {
@@ -273,10 +279,7 @@ describe("gateway codex harness live helpers", () => {
273279"No other agent models are currently exposed for this session.",
274280].join("\n");
275281276-expect(
277-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
278-).toBe(true);
279-expect(isExpectedCodexModelsCommandText(text)).toBe(true);
282+expectRecognizedCodexModelsCommandText(text);
280283});
281284282285it("accepts the singular Codex agent model list from the live harness", () => {
@@ -289,10 +292,7 @@ describe("gateway codex harness live helpers", () => {
289292"- Configured override: `false`",
290293].join("\n");
291294292-expect(
293-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
294-).toBe(true);
295-expect(isExpectedCodexModelsCommandText(text)).toBe(true);
295+expectRecognizedCodexModelsCommandText(text);
296296});
297297298298it("accepts sandbox namespace failures with current-session model fallback", () => {
@@ -316,10 +316,7 @@ describe("gateway codex harness live helpers", () => {
316316"Current session model from OpenClaw status is `openai/gpt-5.5`.",
317317].join("\n");
318318319-expect(
320-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
321-).toBe(true);
322-expect(isExpectedCodexModelsCommandText(text)).toBe(true);
319+expectRecognizedCodexModelsCommandText(text);
323320});
324321325322it("accepts missing codex CLI fallback output", () => {
@@ -348,9 +345,7 @@ describe("gateway codex harness live helpers", () => {
348345];
349346350347for (const text of texts) {
351-expect(
352-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
353-).toBe(true);
348+expectExpectedCodexModelsCommandText(text);
354349}
355350expect(isExpectedCodexModelsCommandText(texts[1] ?? "")).toBe(true);
356351expect(isExpectedCodexModelsCommandText(texts[2] ?? "")).toBe(true);
@@ -391,9 +386,7 @@ describe("gateway codex harness live helpers", () => {
391386];
392387393388for (const text of texts) {
394-expect(
395-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
396-).toBe(true);
389+expectExpectedCodexModelsCommandText(text);
397390}
398391});
399392@@ -445,10 +438,7 @@ describe("gateway codex harness live helpers", () => {
445438"- The UI indicates `/model` is the command to change models",
446439].join("\n");
447440448-expect(
449-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
450-).toBe(true);
451-expect(isExpectedCodexModelsCommandText(text)).toBe(true);
441+expectRecognizedCodexModelsCommandText(text);
452442});
453443454444it("accepts the local Codex model-cache summary", () => {
@@ -462,9 +452,7 @@ describe("gateway codex harness live helpers", () => {
462452"This session is currently running `codex/gpt-5.4` with `low` reasoning according to `/codex status`.",
463453].join("\n");
464454465-expect(
466-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
467-).toBe(true);
455+expectExpectedCodexModelsCommandText(text);
468456expect(isExpectedCodexModelsCommandText(text)).toBe(false);
469457});
470458@@ -476,9 +464,7 @@ describe("gateway codex harness live helpers", () => {
476464"- Active model: `codex/gpt-5.4`",
477465].join("\n");
478466479-expect(
480-EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
481-).toBe(true);
467+expectExpectedCodexModelsCommandText(text);
482468});
483469484470it("rejects unrelated codex command output", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。