test: accept codex models shell fallback

This commit is contained in:
Peter Steinberger
2026-05-02 10:46:54 +01:00
parent 701811e013
commit f2df789ca5
2 changed files with 21 additions and 0 deletions

View File

@@ -189,6 +189,23 @@ describe("gateway codex harness live helpers", () => {
expect(isExpectedCodexModelsCommandText(text)).toBe(true);
});
it("accepts the GPT-5.5 Docker harness shell fallback", () => {
const text = [
"I couldnt get `/codex models` from the shell here.",
"",
"What happened:",
"- In the sandbox, `codex models` failed because the kernel disallows unprivileged user namespaces.",
"- Outside the sandbox, `codex` is not on `PATH`.",
"",
"Current session model from OpenClaw status is `openai/gpt-5.5`.",
].join("\n");
expect(
EXPECTED_CODEX_MODELS_COMMAND_TEXT.some((expectedText) => text.includes(expectedText)),
).toBe(true);
expect(isExpectedCodexModelsCommandText(text)).toBe(true);
});
it("accepts missing codex CLI fallback output", () => {
const texts = [
[

View File

@@ -24,6 +24,7 @@ export const EXPECTED_CODEX_MODELS_COMMAND_TEXT = [
"`codex` is not installed in the shell environment",
"`codex models` didnt return a plain list in this environment",
"I couldnt get a direct `codex models` CLI listing because the local sandbox blocked that command.",
"I couldnt get `/codex models` from the shell here.",
"I couldnt list all installed/available Codex models from the local CLI because the sandboxed `codex` command failed to start in this environment.",
"I couldnt get `codex models` from the CLI because the sandbox blocks the namespace setup it needs",
"I can only see the current session model from this environment",
@@ -139,6 +140,7 @@ export function isExpectedCodexModelsCommandText(text: string): boolean {
normalized.includes("could not run") ||
normalized.includes("could not be run") ||
normalized.includes("failed in this sandbox") ||
normalized.includes("failed because") ||
normalized.includes("failed with:") ||
normalized.includes("fails to start") ||
normalized.includes("repo-local fallback") ||
@@ -163,6 +165,7 @@ export function isExpectedCodexModelsCommandText(text: string): boolean {
normalized.includes("command not found") ||
normalized.includes("not installed") ||
normalized.includes("required user namespace") ||
normalized.includes("unprivileged user namespaces") ||
normalized.includes("user-namespace restriction") ||
normalized.includes("bwrap: no permissions to create a new namespace"));
@@ -173,6 +176,7 @@ export function isExpectedCodexModelsCommandText(text: string): boolean {
const mentionsSessionModel =
normalized.includes("current session is using") ||
normalized.includes("current session model") ||
normalized.includes("current session model from openclaw status") ||
normalized.includes("visible session model") ||
normalized.includes("the current session is using");
const mentionsConfigSummary =