

























@@ -1685,24 +1685,16 @@ describe("runCodexAppServerAttempt", () => {
16851685await run;
1686168616871687const startRequest = harness.requests.find((request) => request.method === "thread/start");
1688-expect(startRequest?.params).toEqual(
1689-expect.objectContaining({
1690-config: expect.objectContaining({
1691-"features.codex_hooks": true,
1692-"hooks.PreToolUse": [
1693-expect.objectContaining({
1694-hooks: [
1695-expect.objectContaining({
1696-type: "command",
1697-timeout: 9,
1698-command: expect.stringContaining("--event pre_tool_use --timeout 4321"),
1699-}),
1700-],
1701-}),
1702-],
1703-}),
1704-}),
1705-);
1688+const startConfig = (startRequest?.params as { config?: Record<string, unknown> } | undefined)
1689+?.config;
1690+expect(startConfig?.["features.codex_hooks"]).toBe(true);
1691+const preToolUseHooks = startConfig?.["hooks.PreToolUse"] as
1692+| Array<{ hooks?: Array<{ command?: string; timeout?: number; type?: string }> }>
1693+| undefined;
1694+const preToolUseCommand = preToolUseHooks?.[0]?.hooks?.[0];
1695+expect(preToolUseCommand?.type).toBe("command");
1696+expect(preToolUseCommand?.timeout).toBe(9);
1697+expect(preToolUseCommand?.command).toContain("--event pre_tool_use --timeout 4321");
17061698const relayId = extractRelayIdFromThreadRequest(startRequest?.params);
17071699expect(nativeHookRelayTesting.getNativeHookRelayRegistrationForTests(relayId)).toBeUndefined();
17081700});
@@ -1777,27 +1769,17 @@ describe("runCodexAppServerAttempt", () => {
17771769await harness.waitForMethod("turn/start");
1778177017791771const startRequest = harness.requests.find((request) => request.method === "thread/start");
1780-expect(startRequest?.params).toEqual(
1781-expect.objectContaining({
1782-config: expect.objectContaining({
1783-"features.codex_hooks": true,
1784-"hooks.PreToolUse": expect.any(Array),
1785-"hooks.PostToolUse": expect.any(Array),
1786-"hooks.Stop": expect.any(Array),
1787-}),
1788-}),
1789-);
1790-expect(startRequest?.params).toEqual(
1791-expect.objectContaining({
1792-config: expect.not.objectContaining({
1793-"hooks.PermissionRequest": expect.anything(),
1794-}),
1795-}),
1796-);
1772+const startConfig = (startRequest?.params as { config?: Record<string, unknown> } | undefined)
1773+?.config;
1774+expect(startConfig?.["features.codex_hooks"]).toBe(true);
1775+expect(Array.isArray(startConfig?.["hooks.PreToolUse"])).toBe(true);
1776+expect(Array.isArray(startConfig?.["hooks.PostToolUse"])).toBe(true);
1777+expect(Array.isArray(startConfig?.["hooks.Stop"])).toBe(true);
1778+expect(startConfig).not.toHaveProperty("hooks.PermissionRequest");
17971779const relayId = extractRelayIdFromThreadRequest(startRequest?.params);
1798-expect(nativeHookRelayTesting.getNativeHookRelayRegistrationForTests(relayId)).toMatchObject({
1799-allowedEvents: ["pre_tool_use", "post_tool_use", "before_agent_finalize"],
1800-});
1780+expect(
1781+nativeHookRelayTesting.getNativeHookRelayRegistrationForTests(relayId)?.allowedEvents,
1782+).toEqual(["pre_tool_use", "post_tool_use", "before_agent_finalize"]);
1801178318021784await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
18031785await run;
@@ -1823,18 +1805,14 @@ describe("runCodexAppServerAttempt", () => {
18231805await harness.waitForMethod("turn/start");
1824180618251807const startRequest = harness.requests.find((request) => request.method === "thread/start");
1826-expect(startRequest?.params).toEqual(
1827-expect.objectContaining({
1828-config: expect.objectContaining({
1829-"features.codex_hooks": true,
1830-"hooks.PermissionRequest": expect.any(Array),
1831-}),
1832-}),
1833-);
1808+const startConfig = (startRequest?.params as { config?: Record<string, unknown> } | undefined)
1809+?.config;
1810+expect(startConfig?.["features.codex_hooks"]).toBe(true);
1811+expect(Array.isArray(startConfig?.["hooks.PermissionRequest"])).toBe(true);
18341812const relayId = extractRelayIdFromThreadRequest(startRequest?.params);
1835-expect(nativeHookRelayTesting.getNativeHookRelayRegistrationForTests(relayId)).toMatchObject({
1836-allowedEvents: ["permission_request"],
1837-});
1813+expect(
1814+nativeHookRelayTesting.getNativeHookRelayRegistrationForTests(relayId)?.allowedEvents,
1815+).toEqual(["permission_request"]);
1838181618391817await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
18401818await run;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。