From f2df789ca57b2020924ea7892ddf8e0518217e80 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 10:46:54 +0100 Subject: [PATCH] test: accept codex models shell fallback --- .../gateway-codex-harness.live-helpers.test.ts | 17 +++++++++++++++++ .../gateway-codex-harness.live-helpers.ts | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/src/gateway/gateway-codex-harness.live-helpers.test.ts b/src/gateway/gateway-codex-harness.live-helpers.test.ts index 0243c0ab52c..1deb206af82 100644 --- a/src/gateway/gateway-codex-harness.live-helpers.test.ts +++ b/src/gateway/gateway-codex-harness.live-helpers.test.ts @@ -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 couldn’t 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 = [ [ diff --git a/src/gateway/gateway-codex-harness.live-helpers.ts b/src/gateway/gateway-codex-harness.live-helpers.ts index ef879cb34a2..e34d8218c0a 100644 --- a/src/gateway/gateway-codex-harness.live-helpers.ts +++ b/src/gateway/gateway-codex-harness.live-helpers.ts @@ -24,6 +24,7 @@ export const EXPECTED_CODEX_MODELS_COMMAND_TEXT = [ "`codex` is not installed in the shell environment", "`codex models` didn’t return a plain list in this environment", "I couldn’t get a direct `codex models` CLI listing because the local sandbox blocked that command.", + "I couldn’t get `/codex models` from the shell here.", "I couldn’t list all installed/available Codex models from the local CLI because the sandboxed `codex` command failed to start in this environment.", "I couldn’t 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 =