diff --git a/extensions/codex/test-api.ts b/extensions/codex/test-api.ts index 0738ae24ed27..2216f4401400 100644 --- a/extensions/codex/test-api.ts +++ b/extensions/codex/test-api.ts @@ -21,6 +21,8 @@ import { buildTurnStartParams, } from "./src/app-server/thread-lifecycle.js"; +export { CODEX_APP_SERVER_VERSION } from "./src/app-server/version.js"; + type CodexHarnessPromptSnapshot = { developerInstructions: string; threadStartParams: ReturnType; diff --git a/test/e2e/qa-lab/runtime/codex-auth-app-server.fixture.mjs b/test/e2e/qa-lab/runtime/codex-auth-app-server.fixture.mjs index 23ca248638d9..87ea08f936f0 100644 --- a/test/e2e/qa-lab/runtime/codex-auth-app-server.fixture.mjs +++ b/test/e2e/qa-lab/runtime/codex-auth-app-server.fixture.mjs @@ -9,6 +9,10 @@ const requestLog = process.env.OPENCLAW_QA_CODEX_AUTH_APP_SERVER_LOG; if (!requestLog) { throw new Error("missing OPENCLAW_QA_CODEX_AUTH_APP_SERVER_LOG"); } +const appServerVersion = process.env.OPENCLAW_QA_CODEX_APP_SERVER_VERSION; +if (!appServerVersion) { + throw new Error("missing OPENCLAW_QA_CODEX_APP_SERVER_VERSION"); +} runFakeCodexAppServer({ requestLog, @@ -18,8 +22,8 @@ runFakeCodexAppServer({ sendResult( createFakeInitializeResponse({ name: "openclaw-qa-codex-auth", - version: "0.143.0", - userAgent: "openclaw/0.143.0 (test)", + version: appServerVersion, + userAgent: `openclaw/${appServerVersion} (test)`, }), ), "account/login/start": ({ params, sendResult }) => sendResult({ type: params?.type }), @@ -54,7 +58,7 @@ runFakeCodexAppServer({ params, threadId: "thread-qa-codex-auth", sessionId: "session-qa-codex-auth", - version: "0.143.0", + version: appServerVersion, }), ), "turn/start": ({ notify, params, sendResult }) => { diff --git a/test/e2e/qa-lab/runtime/codex-auth-product-proof.e2e.test.ts b/test/e2e/qa-lab/runtime/codex-auth-product-proof.e2e.test.ts index d26f58ef2a12..73dfbe639913 100644 --- a/test/e2e/qa-lab/runtime/codex-auth-product-proof.e2e.test.ts +++ b/test/e2e/qa-lab/runtime/codex-auth-product-proof.e2e.test.ts @@ -3,6 +3,7 @@ import { fileURLToPath } from "node:url"; import { afterEach, describe, expect, it, vi } from "vitest"; import { createJsonlRequestTailer } from "../../../../scripts/e2e/lib/codex-media-path/jsonl-request-tail.mjs"; import { closeOpenClawAgentDatabasesForTest } from "../../../../src/state/openclaw-agent-db.js"; +import { loadBundledPluginPublicSurface } from "../../../../src/test-utils/bundled-plugin-public-surface.js"; import { connectGatewayStatusClient, postJson } from "../../../helpers/gateway-e2e-harness.js"; import { createOpenClawTestInstance, @@ -38,9 +39,15 @@ afterEach(async () => { function waitForRequest(requestLog: AppServerRequestLog, method: string) { return vi.waitFor( () => { - const request = requestLog.read().find((entry) => entry.method === method); + const entries = requestLog.read(); + const request = entries.find((entry) => entry.method === method); if (!request) { - throw new Error(`waiting for Codex app-server method ${method}`); + const observedMethods = entries.flatMap((entry) => + typeof entry.method === "string" ? [entry.method] : [], + ); + throw new Error( + `waiting for Codex app-server method ${method}; observed ${observedMethods.join(", ") || "no methods"}`, + ); } return request; }, @@ -103,6 +110,9 @@ describe("Codex auth product proof", () => { "repairs mixed legacy auth into SQLite and sends the selected OAuth profile to app-server", { timeout: 180_000 }, async () => { + const { CODEX_APP_SERVER_VERSION } = await loadBundledPluginPublicSurface<{ + CODEX_APP_SERVER_VERSION: string; + }>({ pluginId: "codex", artifactBasename: "test-api.js" }); const appServerFixture = fileURLToPath( new URL("./codex-auth-app-server.fixture.mjs", import.meta.url), ); @@ -110,6 +120,7 @@ describe("Codex auth product proof", () => { name: "qa-codex-auth-product-proof", env: { OPENCLAW_AGENT_HARNESS_FALLBACK: "none", + OPENCLAW_QA_CODEX_APP_SERVER_VERSION: CODEX_APP_SERVER_VERSION, OPENCLAW_SKIP_PROVIDERS: undefined, }, config: {