fix(qa): bind Codex auth fixture to runtime version (#116859)

* fix(qa): update Codex auth fixture protocol version

* test(qa): bind Codex auth fixture to runtime version

* test(qa): load Codex fixture version through public surface
This commit is contained in:
Dallin Romney
2026-08-01 13:36:31 +08:00
committed by GitHub
parent 0892684551
commit bcff3a0de3
3 changed files with 22 additions and 5 deletions

View File

@@ -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<typeof buildThreadStartParams>;

View File

@@ -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 }) => {

View File

@@ -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: {