Files
openclaw/src/plugin-sdk/config-runtime.test.ts
Peter Steinberger f94a7dc183 feat(codex): supervise native Codex sessions (#104045)
* feat(codex): add native session supervision

* fix(codex): harden supervision integration

* fix(codex): preserve locked harness ownership

* fix(codex): fence native session archive

* fix(codex): revalidate archive binding ownership

* feat(codex): integrate supervision runtime

* feat(sessions): preserve harness-owned execution

* feat(sessions): persist harness ownership invariants

* feat(gateway): enforce harness-owned sessions

* feat(setup): enable detected Codex supervision

* feat(mac): expose supervised Codex sessions

* feat(ui): make Codex sessions actionable

* docs(codex): document session supervision

* test(codex): cover integration ownership

* chore(i18n): refresh supervision inventories

* fix(setup): finalize Codex activation atomically

* test(codex): narrow binding store update

* fix(sessions): preserve legacy model locks

* test(macos): serialize Codex catalog fixtures

* fix(sessions): preserve legacy lock admission

* chore(i18n): reconcile supervision metadata

* test(sessions): mark legacy lock fixture

* fix(macos): drain final Codex catalog frame

* docs: leave supervision note to release

* style(macos): satisfy Codex catalog type length

* chore: record session accessor seam owners

* fix(macos): honor configured Codex supervision

* fix(codex): preserve harness-owned model locks

* fix(codex): satisfy supervision lint gates

* chore(i18n): refresh native supervision inventory

* fix(codex): align supervision validation contracts

* fix(codex): close supervision boundary gaps

* fix(codex): preserve supervision activation contracts

* fix(codex): dispose standalone supervision runtime

* fix(codex): pin supervised source connection

* fix(plugins): bind delegated runs to exact session target

* fix(codex): scope supervised sessions to configured agents

* fix(codex): fingerprint effective supervision home

* fix(codex): normalize supervision plugin policy

* fix(codex): keep supervised bindings stable across upgrades

* fix(codex): guard all supervised binding connections

* fix(codex): preserve catalog filters and pending CAS identity

* fix(codex): preserve supervision identity for diagnostics

* fix(codex): bind uncertain commits to supervision connection

* fix(codex): satisfy supervision type boundaries

* fix(macos): reconcile current main validation

* fix(codex): handle absent runtime config in supervision

* fix(doctor): own local audio acceleration check

* fix(codex): satisfy integration lint gates

* fix(codex): satisfy lifecycle safety guards
2026-07-11 00:12:08 -07:00

114 lines
3.1 KiB
TypeScript

/**
* Tests config runtime exports and snapshot/cache behavior exposed through the SDK.
*/
import { describe, expect, it } from "vitest";
import {
getSessionEntry,
listSessionEntries,
readSessionUpdatedAt,
resolveLivePluginConfigObject,
resolvePluginConfigObject,
type OpenClawConfig,
} from "./config-runtime.js";
import {
getSessionEntry as getSessionStoreEntry,
listSessionEntries as listSessionStoreEntries,
readSessionUpdatedAt as readSessionStoreUpdatedAt,
} from "./session-store-runtime.js";
describe("config-runtime session read exports", () => {
it("re-exports the session-store runtime seam wrappers", () => {
expect(getSessionEntry).toBe(getSessionStoreEntry);
expect(listSessionEntries).toBe(listSessionStoreEntries);
expect(readSessionUpdatedAt).toBe(readSessionStoreUpdatedAt);
});
});
describe("resolvePluginConfigObject", () => {
it("returns the plugin config object for a configured plugin entry", () => {
const config = {
plugins: {
entries: {
"demo-plugin": {
enabled: true,
config: {
enabled: false,
mode: "strict",
},
},
},
},
} as unknown as OpenClawConfig;
expect(resolvePluginConfigObject(config, "demo-plugin")).toEqual({
enabled: false,
mode: "strict",
});
});
it("reads config through normalized plugin entry ids", () => {
const config = {
plugins: {
entries: {
" CODEX ": {
enabled: true,
config: { supervision: { enabled: true } },
},
},
},
} as unknown as OpenClawConfig;
expect(resolvePluginConfigObject(config, "codex")).toEqual({
supervision: { enabled: true },
});
});
it("returns undefined for missing or non-object plugin configs", () => {
const config = {
plugins: {
entries: {
"demo-plugin": {
enabled: true,
config: "bad-shape",
},
"array-plugin": {
enabled: true,
config: ["bad-shape"],
},
},
},
} as unknown as OpenClawConfig;
expect(resolvePluginConfigObject(config, "missing-plugin")).toBeUndefined();
expect(resolvePluginConfigObject(config, "demo-plugin")).toBeUndefined();
expect(resolvePluginConfigObject(config, "array-plugin")).toBeUndefined();
expect(resolvePluginConfigObject(undefined, "demo-plugin")).toBeUndefined();
});
});
describe("resolveLivePluginConfigObject", () => {
it("falls back to startup config only when no runtime loader exists", () => {
expect(
resolveLivePluginConfigObject(undefined, "demo-plugin", {
enabled: true,
}),
).toEqual({
enabled: true,
});
});
it("fails closed when the runtime loader exists but the plugin entry is missing", () => {
const config = {
plugins: {
entries: {},
},
} as unknown as OpenClawConfig;
expect(
resolveLivePluginConfigObject(() => config, "demo-plugin", {
enabled: true,
}),
).toBeUndefined();
});
});