fix: restore ci gates on main

This commit is contained in:
Peter Steinberger
2026-04-28 19:42:50 +01:00
parent bb0461b682
commit f2f34e5f35
11 changed files with 136 additions and 35 deletions

View File

@@ -1,3 +1,4 @@
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { clearRuntimeConfigSnapshot, setRuntimeConfigSnapshot } from "../config/config.js";
import {
@@ -15,20 +16,32 @@ import {
} from "./test-helpers/temp-plugin-extension-fixtures.js";
const originalBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
const originalDisableBundledPlugins = process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS;
const tempDirs: string[] = [];
function createTempDir(): string {
return createTempPluginDir(tempDirs, "openclaw-codex-ext-");
}
function createBundledTempDir(): string {
delete process.env.OPENCLAW_DISABLE_BUNDLED_PLUGINS;
return createTempPluginDir(tempDirs, "openclaw-codex-ext-", {
parentDir: path.join(process.cwd(), "dist-runtime", "extensions"),
});
}
afterEach(() => {
clearRuntimeConfigSnapshot();
cleanupTempPluginTestEnvironment(tempDirs, originalBundledPluginsDir);
cleanupTempPluginTestEnvironment(
tempDirs,
originalBundledPluginsDir,
originalDisableBundledPlugins,
);
});
describe("agent tool result middleware", () => {
it("includes plugin-registered middleware and restores it from cache", async () => {
const tmp = createTempDir();
const tmp = createBundledTempDir();
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
writeTempPlugin({
@@ -81,7 +94,7 @@ describe("agent tool result middleware", () => {
});
it("rejects middleware when the manifest omits the runtime contract", () => {
const tmp = createTempDir();
const tmp = createBundledTempDir();
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
writeTempPlugin({
@@ -158,7 +171,7 @@ describe("agent tool result middleware", () => {
});
it("merges runtimes when a plugin registers the same middleware function twice", () => {
const tmp = createTempDir();
const tmp = createBundledTempDir();
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
writeTempPlugin({
@@ -194,7 +207,7 @@ export default { id: "tool-result-middleware", register(api) {
});
it("lazily loads bundled middleware owners from manifest contracts", async () => {
const tmp = createTempDir();
const tmp = createBundledTempDir();
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
writeTempPlugin({
@@ -246,7 +259,7 @@ export default { id: "tool-result-middleware", register(api) {
describe("Codex app-server extension factories", () => {
it("includes plugin-registered Codex app-server extension factories and restores them from cache", async () => {
const tmp = createTempDir();
const tmp = createBundledTempDir();
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
writeTempPlugin({
@@ -337,7 +350,7 @@ describe("Codex app-server extension factories", () => {
});
it("rejects bundled plugins that omit the Codex app-server extension contract", () => {
const tmp = createTempDir();
const tmp = createBundledTempDir();
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
writeTempPlugin({
@@ -373,7 +386,7 @@ describe("Codex app-server extension factories", () => {
});
it("rejects non-function Codex app-server extension factories from bundled plugins", () => {
const tmp = createTempDir();
const tmp = createBundledTempDir();
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = tmp;
writeTempPlugin({