fix(codex): accept newer desktop app-server versions (#126450) (#127269)

(cherry picked from commit 841f25eae6)

Co-authored-by: Josh Lehman <josh@martian.engineering>
This commit is contained in:
pash-openai
2026-08-21 09:10:17 -07:00
committed by GitHub
parent cafcf0b79b
commit 05df7749f0
2 changed files with 25 additions and 13 deletions
+12 -12
View File
@@ -431,19 +431,19 @@ describe("CodexAppServerClient", () => {
expect(harness.writes).toHaveLength(1);
});
it("blocks stable Codex app-server versions newer than generated schemas", async () => {
const newerVersion = "0.146.1";
const { harness, initializing, outbound } = startInitialize();
harness.send({
id: outbound.id,
result: { userAgent: `openclaw/${newerVersion} (macOS; test)` },
});
it.each(["0.146.1", "0.149.0"])(
"accepts newer stable Codex app-server version %s",
async (newerVersion) => {
const { harness, initializing, outbound } = startInitialize();
harness.send({
id: outbound.id,
result: { userAgent: `openclaw/${newerVersion} (macOS; test)` },
});
await expect(initializing).rejects.toThrow(
`Codex app-server ${CODEX_APP_SERVER_VERSION} is required`,
);
expect(harness.writes).toHaveLength(1);
});
await expect(initializing).resolves.toBeUndefined();
expect(harness.writes).toHaveLength(2);
},
);
it("blocks app-server initialize responses without a version", async () => {
const { harness, initializing, outbound } = startInitialize();
+13 -1
View File
@@ -1047,9 +1047,21 @@ class CodexAppServerVersionError extends Error {
function assertSupportedCodexAppServerVersion(response: CodexInitializeResponse): string {
const detectedVersion = readCodexVersionFromUserAgent(response.userAgent);
if (detectedVersion !== CODEX_APP_SERVER_VERSION) {
// External app-servers may advance independently of OpenClaw's bundled runtime.
// Keep the reviewed stable release as a compatibility floor, not an exact pin.
if (
!detectedVersion ||
!/^\d+\.\d+\.\d+$/.test(detectedVersion) ||
detectedVersion.localeCompare(CODEX_APP_SERVER_VERSION, "en", { numeric: true }) < 0
) {
throw new CodexAppServerVersionError(detectedVersion);
}
if (detectedVersion !== CODEX_APP_SERVER_VERSION) {
embeddedAgentLog.warn(
"codex app-server is newer than OpenClaw's managed runtime; continuing with normal startup validation",
{ detectedVersion, validatedVersion: CODEX_APP_SERVER_VERSION },
);
}
return detectedVersion;
}