惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
J
Java Code Geeks
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
G
Google Developers Blog
Engineering at Meta
Engineering at Meta
量子位
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
A
About on SuperTechFans
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
Recent Announcements
Recent Announcements
腾讯CDC
I
InfoQ
F
Fortinet All Blogs
Hugging Face - Blog
Hugging Face - Blog
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
爱范儿
爱范儿

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
Bridge Codex native hooks into OpenClaw · openclaw/opencl...
pashpashpash · 2026-04-24 · via Recent Commits to openclaw:main

@@ -0,0 +1,118 @@

1+

import type { NativeHookRelayRegistrationHandle } from "openclaw/plugin-sdk/agent-harness-runtime";

2+

import { describe, expect, it } from "vitest";

3+

import {

4+

buildCodexNativeHookRelayConfig,

5+

buildCodexNativeHookRelayDisabledConfig,

6+

} from "./native-hook-relay.js";

7+8+

describe("Codex native hook relay config", () => {

9+

it("builds deterministic Codex config overrides with command hooks", () => {

10+

const config = buildCodexNativeHookRelayConfig({

11+

relay: createRelay(),

12+

hookTimeoutSec: 7,

13+

});

14+15+

expect(config).toEqual({

16+

"features.codex_hooks": true,

17+

"hooks.PreToolUse": [

18+

{

19+

matcher: null,

20+

hooks: [

21+

{

22+

type: "command",

23+

command:

24+

"openclaw hooks relay --provider codex --relay-id relay-1 --event pre_tool_use",

25+

timeout: 7,

26+

async: false,

27+

statusMessage: "OpenClaw native hook relay",

28+

},

29+

],

30+

},

31+

],

32+

"hooks.PostToolUse": [

33+

{

34+

matcher: null,

35+

hooks: [

36+

{

37+

type: "command",

38+

command:

39+

"openclaw hooks relay --provider codex --relay-id relay-1 --event post_tool_use",

40+

timeout: 7,

41+

async: false,

42+

statusMessage: "OpenClaw native hook relay",

43+

},

44+

],

45+

},

46+

],

47+

"hooks.PermissionRequest": [

48+

{

49+

matcher: null,

50+

hooks: [

51+

{

52+

type: "command",

53+

command:

54+

"openclaw hooks relay --provider codex --relay-id relay-1 --event permission_request",

55+

timeout: 7,

56+

async: false,

57+

statusMessage: "OpenClaw native hook relay",

58+

},

59+

],

60+

},

61+

],

62+

});

63+

expect(JSON.stringify(config)).not.toContain("timeoutSec");

64+

expect(config).not.toHaveProperty("hooks.SessionStart");

65+

expect(config).not.toHaveProperty("hooks.UserPromptSubmit");

66+

expect(config).not.toHaveProperty("hooks.Stop");

67+

});

68+69+

it("includes only requested hook events", () => {

70+

expect(

71+

buildCodexNativeHookRelayConfig({

72+

relay: createRelay(),

73+

events: ["permission_request"],

74+

}),

75+

).toEqual({

76+

"features.codex_hooks": true,

77+

"hooks.PermissionRequest": [

78+

{

79+

matcher: null,

80+

hooks: [

81+

{

82+

type: "command",

83+

command:

84+

"openclaw hooks relay --provider codex --relay-id relay-1 --event permission_request",

85+

timeout: 5,

86+

async: false,

87+

statusMessage: "OpenClaw native hook relay",

88+

},

89+

],

90+

},

91+

],

92+

});

93+

});

94+95+

it("builds deterministic clearing config when the relay is disabled", () => {

96+

expect(buildCodexNativeHookRelayDisabledConfig()).toEqual({

97+

"features.codex_hooks": false,

98+

"hooks.PreToolUse": [],

99+

"hooks.PostToolUse": [],

100+

"hooks.PermissionRequest": [],

101+

});

102+

});

103+

});

104+105+

function createRelay(): NativeHookRelayRegistrationHandle {

106+

return {

107+

relayId: "relay-1",

108+

provider: "codex",

109+

sessionId: "session-1",

110+

sessionKey: "agent:main:session-1",

111+

runId: "run-1",

112+

allowedEvents: ["pre_tool_use", "post_tool_use", "permission_request"],

113+

expiresAtMs: Date.now() + 1000,

114+

commandForEvent: (event) =>

115+

`openclaw hooks relay --provider codex --relay-id relay-1 --event ${event}`,

116+

unregister: () => undefined,

117+

};

118+

}