mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 22:34:45 +00:00
fix(codex): use stable hooks feature flag (#82078)
This commit is contained in:
committed by
GitHub
parent
445ed9b0b4
commit
3de97057d0
@@ -13,7 +13,7 @@ describe("Codex native hook relay config", () => {
|
||||
});
|
||||
|
||||
expect(config).toEqual({
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
"hooks.PreToolUse": [
|
||||
{
|
||||
matcher: null,
|
||||
@@ -87,7 +87,7 @@ describe("Codex native hook relay config", () => {
|
||||
events: ["permission_request"],
|
||||
}),
|
||||
).toEqual({
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
"hooks.PermissionRequest": [
|
||||
{
|
||||
matcher: null,
|
||||
@@ -118,7 +118,7 @@ describe("Codex native hook relay config", () => {
|
||||
|
||||
it("builds deterministic clearing config when the relay is disabled", () => {
|
||||
expect(buildCodexNativeHookRelayDisabledConfig()).toEqual({
|
||||
"features.codex_hooks": false,
|
||||
"features.hooks": false,
|
||||
"hooks.PreToolUse": [],
|
||||
"hooks.PostToolUse": [],
|
||||
"hooks.PermissionRequest": [],
|
||||
|
||||
@@ -27,7 +27,7 @@ export function buildCodexNativeHookRelayConfig(params: {
|
||||
}): JsonObject {
|
||||
const events = params.events?.length ? params.events : CODEX_NATIVE_HOOK_RELAY_EVENTS;
|
||||
const config: JsonObject = {
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
};
|
||||
for (const event of events) {
|
||||
const codexEvent = CODEX_HOOK_EVENT_BY_NATIVE_EVENT[event];
|
||||
@@ -51,7 +51,7 @@ export function buildCodexNativeHookRelayConfig(params: {
|
||||
|
||||
export function buildCodexNativeHookRelayDisabledConfig(): JsonObject {
|
||||
return {
|
||||
"features.codex_hooks": false,
|
||||
"features.hooks": false,
|
||||
"hooks.PreToolUse": [],
|
||||
"hooks.PostToolUse": [],
|
||||
"hooks.PermissionRequest": [],
|
||||
|
||||
@@ -624,11 +624,11 @@ describe("Codex plugin thread config", () => {
|
||||
it("merges app config with native hook config", () => {
|
||||
expect(
|
||||
mergeCodexThreadConfigs(
|
||||
{ "features.codex_hooks": true, hooks: { PreToolUse: [] } },
|
||||
{ "features.hooks": true, hooks: { PreToolUse: [] } },
|
||||
{ apps: { _default: { enabled: false } } },
|
||||
),
|
||||
).toEqual({
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
hooks: { PreToolUse: [] },
|
||||
apps: { _default: { enabled: false } },
|
||||
});
|
||||
|
||||
@@ -2947,7 +2947,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
const startRequest = harness.requests.find((request) => request.method === "thread/start");
|
||||
const startConfig = (startRequest?.params as { config?: Record<string, unknown> } | undefined)
|
||||
?.config;
|
||||
expect(startConfig?.["features.codex_hooks"]).toBe(true);
|
||||
expect(startConfig?.["features.hooks"]).toBe(true);
|
||||
const preToolUseHooks = startConfig?.["hooks.PreToolUse"] as
|
||||
| Array<{ hooks?: Array<{ command?: string; timeout?: number; type?: string }> }>
|
||||
| undefined;
|
||||
@@ -3035,7 +3035,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
const startRequest = harness.requests.find((request) => request.method === "thread/start");
|
||||
const startConfig = (startRequest?.params as { config?: Record<string, unknown> } | undefined)
|
||||
?.config;
|
||||
expect(startConfig?.["features.codex_hooks"]).toBe(true);
|
||||
expect(startConfig?.["features.hooks"]).toBe(true);
|
||||
expect(Array.isArray(startConfig?.["hooks.PreToolUse"])).toBe(true);
|
||||
expect(Array.isArray(startConfig?.["hooks.PostToolUse"])).toBe(true);
|
||||
expect(Array.isArray(startConfig?.["hooks.Stop"])).toBe(true);
|
||||
@@ -3071,7 +3071,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
const startRequest = harness.requests.find((request) => request.method === "thread/start");
|
||||
const startConfig = (startRequest?.params as { config?: Record<string, unknown> } | undefined)
|
||||
?.config;
|
||||
expect(startConfig?.["features.codex_hooks"]).toBe(true);
|
||||
expect(startConfig?.["features.hooks"]).toBe(true);
|
||||
expect(Array.isArray(startConfig?.["hooks.PermissionRequest"])).toBe(true);
|
||||
const relayId = extractRelayIdFromThreadRequest(startRequest?.params);
|
||||
expect(
|
||||
@@ -3211,7 +3211,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
const startRequest = harness.requests.find((request) => request.method === "thread/start");
|
||||
const startConfig = (startRequest?.params as { config?: Record<string, unknown> } | undefined)
|
||||
?.config;
|
||||
expect(startConfig?.["features.codex_hooks"]).toBe(false);
|
||||
expect(startConfig?.["features.hooks"]).toBe(false);
|
||||
expect(startConfig?.["hooks.PreToolUse"]).toEqual([]);
|
||||
expect(startConfig?.["hooks.PostToolUse"]).toEqual([]);
|
||||
expect(startConfig?.["hooks.PermissionRequest"]).toEqual([]);
|
||||
@@ -5367,7 +5367,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
throw new Error(`unexpected method: ${method}`);
|
||||
});
|
||||
const config = {
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
"hooks.PreToolUse": [],
|
||||
};
|
||||
const expectedConfig = {
|
||||
@@ -5426,7 +5426,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
cwd: workspaceDir,
|
||||
dynamicTools: [],
|
||||
appServer,
|
||||
config: { "features.codex_hooks": true, hooks: { PreToolUse: [] } },
|
||||
config: { "features.hooks": true, hooks: { PreToolUse: [] } },
|
||||
pluginThreadConfig: {
|
||||
enabled: true,
|
||||
inputFingerprint: "plugin-apps-input-1",
|
||||
@@ -5439,7 +5439,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
const requestCalls = request.mock.calls as unknown as Array<[string, { config?: unknown }]>;
|
||||
expect(requestCalls.map(([method]) => method)).toEqual(["thread/start"]);
|
||||
expect(requestCalls[0]?.[1].config).toEqual({
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
"features.code_mode": true,
|
||||
"features.code_mode_only": true,
|
||||
hooks: { PreToolUse: [] },
|
||||
@@ -5479,7 +5479,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
cwd: workspaceDir,
|
||||
dynamicTools: [],
|
||||
appServer,
|
||||
config: { "features.codex_hooks": true },
|
||||
config: { "features.hooks": true },
|
||||
pluginThreadConfig: {
|
||||
enabled: true,
|
||||
inputFingerprint: "plugin-apps-input-1",
|
||||
@@ -5492,7 +5492,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
cwd: workspaceDir,
|
||||
dynamicTools: [],
|
||||
appServer,
|
||||
config: { "features.codex_hooks": true },
|
||||
config: { "features.hooks": true },
|
||||
pluginThreadConfig: {
|
||||
enabled: true,
|
||||
inputFingerprint: "plugin-apps-input-1",
|
||||
@@ -5506,13 +5506,13 @@ describe("runCodexAppServerAttempt", () => {
|
||||
const requestCalls = request.mock.calls as unknown as Array<[string, { config?: unknown }]>;
|
||||
expect(requestCalls.map(([method]) => method)).toEqual(["thread/start", "thread/resume"]);
|
||||
expect(requestCalls[0]?.[1].config).toEqual({
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
"features.code_mode": true,
|
||||
"features.code_mode_only": true,
|
||||
...createPluginAppConfigPatch(),
|
||||
});
|
||||
expect(requestCalls[1]?.[1].config).toEqual({
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
"features.code_mode": true,
|
||||
"features.code_mode_only": true,
|
||||
});
|
||||
@@ -5972,7 +5972,7 @@ describe("runCodexAppServerAttempt", () => {
|
||||
const resumeRequest = requests.find((request) => request.method === "thread/resume");
|
||||
const resumeRequestParams = resumeRequest?.params as Record<string, unknown> | undefined;
|
||||
const resumeConfig = resumeRequestParams?.config as Record<string, unknown> | undefined;
|
||||
expect(resumeConfig?.["features.codex_hooks"]).toBe(true);
|
||||
expect(resumeConfig?.["features.hooks"]).toBe(true);
|
||||
expect(resumeConfig?.["features.code_mode"]).toBe(true);
|
||||
expect(resumeConfig?.["features.code_mode_only"]).toBe(true);
|
||||
expect(resumeRequestParams?.developerInstructions).toContain(CODEX_GPT5_BEHAVIOR_CONTRACT);
|
||||
|
||||
@@ -61,13 +61,13 @@ describe("Codex app-server native code mode config", () => {
|
||||
appServer: createAppServerOptions() as never,
|
||||
developerInstructions: "test instructions",
|
||||
config: {
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
apps: { _default: { enabled: false } },
|
||||
},
|
||||
});
|
||||
|
||||
expect(request.config).toEqual({
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
apps: { _default: { enabled: false } },
|
||||
"features.code_mode": true,
|
||||
"features.code_mode_only": true,
|
||||
@@ -101,14 +101,14 @@ describe("Codex app-server native code mode config", () => {
|
||||
developerInstructions: "test instructions",
|
||||
config: {
|
||||
project_doc_max_bytes: 64_000,
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
expect(request.config).toEqual({
|
||||
project_doc_max_bytes: 0,
|
||||
"features.codex_hooks": true,
|
||||
"features.hooks": true,
|
||||
"features.code_mode": true,
|
||||
"features.code_mode_only": true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user