mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
(cherry picked from commit 841f25eae6)
Co-authored-by: Josh Lehman <josh@martian.engineering>
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user