mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:10:44 +00:00
test(live): accept current Codex status text
Accept current Codex harness status prose while still requiring the OpenClaw status shape, active model, and live harness session.
This commit is contained in:
@@ -1,10 +1,29 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
EXPECTED_CODEX_MODELS_COMMAND_TEXT,
|
||||
EXPECTED_CODEX_STATUS_COMMAND_TEXT,
|
||||
isExpectedCodexModelsCommandText,
|
||||
isExpectedCodexStatusCommandText,
|
||||
} from "./gateway-codex-harness.live-helpers.js";
|
||||
|
||||
describe("gateway codex harness live helpers", () => {
|
||||
it("accepts the current codex status prose from the live harness", () => {
|
||||
const text =
|
||||
"OpenClaw is running on `openai/gpt-5.5` with low reasoning/text settings. Context is at `22k/272k` tokens, no compactions, and the current session is `agent:dev:live-codex-harness`.";
|
||||
|
||||
expect(
|
||||
EXPECTED_CODEX_STATUS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
|
||||
).toBe(false);
|
||||
expect(isExpectedCodexStatusCommandText(text)).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects status prose for a different codex session", () => {
|
||||
const text =
|
||||
"OpenClaw is running on `openai/gpt-5.5` with low reasoning/text settings. Context is at `22k/272k` tokens, no compactions, and the current session is `agent:dev:other`.";
|
||||
|
||||
expect(isExpectedCodexStatusCommandText(text)).toBe(false);
|
||||
});
|
||||
|
||||
it("accepts the interactive model-selection summary emitted by current codex", () => {
|
||||
const text = [
|
||||
"`/codex models` opened an interactive model-selection prompt rather than printing a plain list.",
|
||||
|
||||
@@ -71,6 +71,39 @@ export const EXPECTED_CODEX_MODELS_COMMAND_TEXT = [
|
||||
"Current OpenClaw session status reports the active model as:",
|
||||
] as const;
|
||||
|
||||
export const EXPECTED_CODEX_STATUS_COMMAND_TEXT = [
|
||||
"Codex app-server:",
|
||||
"Model: `codex/",
|
||||
"Model: codex/",
|
||||
"Session: `agent:dev:live-codex-harness`",
|
||||
"Session: agent:dev:live-codex-harness",
|
||||
"OpenClaw `",
|
||||
"OpenClaw status:",
|
||||
"model `codex/",
|
||||
"session `agent:dev:live-codex-harness`",
|
||||
"Model/status card shown above",
|
||||
"Status shown above.",
|
||||
] as const;
|
||||
|
||||
export function isExpectedCodexStatusCommandText(text: string): boolean {
|
||||
const normalized = text.toLowerCase();
|
||||
const mentionsOpenClawStatus =
|
||||
normalized.includes("openclaw is running on") || normalized.includes("openclaw status:");
|
||||
const mentionsHarnessSession =
|
||||
normalized.includes("session: `agent:dev:live-codex-harness`") ||
|
||||
normalized.includes("session: agent:dev:live-codex-harness") ||
|
||||
normalized.includes("session `agent:dev:live-codex-harness`") ||
|
||||
normalized.includes("current session is `agent:dev:live-codex-harness`") ||
|
||||
normalized.includes("current session is agent:dev:live-codex-harness");
|
||||
const mentionsModel =
|
||||
normalized.includes("`openai/") ||
|
||||
normalized.includes(" openai/") ||
|
||||
normalized.includes("`codex/") ||
|
||||
normalized.includes(" codex/");
|
||||
|
||||
return mentionsOpenClawStatus && mentionsHarnessSession && mentionsModel;
|
||||
}
|
||||
|
||||
export function isExpectedCodexModelsCommandText(text: string): boolean {
|
||||
const normalized = text.toLowerCase();
|
||||
const mentionsCodexModelsCommand =
|
||||
|
||||
@@ -17,7 +17,9 @@ import {
|
||||
} from "./gateway-cli-backend.live-helpers.js";
|
||||
import {
|
||||
EXPECTED_CODEX_MODELS_COMMAND_TEXT,
|
||||
EXPECTED_CODEX_STATUS_COMMAND_TEXT,
|
||||
isExpectedCodexModelsCommandText,
|
||||
isExpectedCodexStatusCommandText,
|
||||
} from "./gateway-codex-harness.live-helpers.js";
|
||||
import {
|
||||
assertCronJobMatches,
|
||||
@@ -790,19 +792,8 @@ describeLive("gateway live (Codex harness)", () => {
|
||||
client,
|
||||
sessionKey,
|
||||
command: "/codex status",
|
||||
expectedText: [
|
||||
"Codex app-server:",
|
||||
"Model: `codex/",
|
||||
"Model: codex/",
|
||||
"Session: `agent:dev:live-codex-harness`",
|
||||
"Session: agent:dev:live-codex-harness",
|
||||
"OpenClaw `",
|
||||
"OpenClaw status:",
|
||||
"model `codex/",
|
||||
"session `agent:dev:live-codex-harness`",
|
||||
"Model/status card shown above",
|
||||
"Status shown above.",
|
||||
],
|
||||
expectedText: [...EXPECTED_CODEX_STATUS_COMMAND_TEXT],
|
||||
isExpectedText: isExpectedCodexStatusCommandText,
|
||||
});
|
||||
logCodexLiveStep("codex-status-command", { statusText });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user