Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(codex): quote plugin hook script paths (#4707)

Abhayfd6b3f62c93f
diff --git a/examples/codex-memory-plugin/hooks/hooks.json b/examples/codex-memory-plugin/hooks/hooks.json
index 4e58859a5..6a1470dc7 100644
--- a/examples/codex-memory-plugin/hooks/hooks.json
+++ b/examples/codex-memory-plugin/hooks/hooks.json
@@ -6,7 +6,7 @@
"hooks": [
{
"type": "command",
- "command": "node ${PLUGIN_ROOT}/scripts/session-start-commit.mjs",
+ "command": "node \"${PLUGIN_ROOT}/scripts/session-start-commit.mjs\"",
"timeout": 70
}
]
@@ -18,7 +18,7 @@
"hooks": [
{
"type": "command",
- "command": "node ${PLUGIN_ROOT}/scripts/auto-recall.mjs",
+ "command": "node \"${PLUGIN_ROOT}/scripts/auto-recall.mjs\"",
"timeout": 130
}
]
@@ -30,7 +30,7 @@
"hooks": [
{
"type": "command",
- "command": "node ${PLUGIN_ROOT}/scripts/auto-capture.mjs",
+ "command": "node \"${PLUGIN_ROOT}/scripts/auto-capture.mjs\"",
"timeout": 30
}
]
@@ -42,7 +42,7 @@
"hooks": [
{
"type": "command",
- "command": "node ${PLUGIN_ROOT}/scripts/session-end.mjs",
+ "command": "node \"${PLUGIN_ROOT}/scripts/session-end.mjs\"",
"timeout": 3
}
]
@@ -54,7 +54,7 @@
"hooks": [
{
"type": "command",
- "command": "node ${PLUGIN_ROOT}/scripts/pre-compact-capture.mjs",
+ "command": "node \"${PLUGIN_ROOT}/scripts/pre-compact-capture.mjs\"",
"timeout": 60
}
]
diff --git a/examples/codex-memory-plugin/scripts/marketplace.test.mjs b/examples/codex-memory-plugin/scripts/marketplace.test.mjs
index 0e5c75692..d1cc3047d 100644
--- a/examples/codex-memory-plugin/scripts/marketplace.test.mjs
+++ b/examples/codex-memory-plugin/scripts/marketplace.test.mjs
@@ -158,7 +158,11 @@ test("hooks.json uses Codex's native ${PLUGIN_ROOT}, not the legacy placeholder"
.map((h) => h.command || "");
assert.ok(commands.length >= 5, "expected at least 5 hook commands (SessionStart/UserPromptSubmit/Stop/SessionEnd/PreCompact)");
for (const cmd of commands) {
- assert.ok(cmd.includes("${PLUGIN_ROOT}/scripts/"), `hook command must be rooted at \${PLUGIN_ROOT}: ${cmd}`);
+ assert.match(
+ cmd,
+ /^node "\$\{PLUGIN_ROOT\}\/scripts\/[^"\n]+\.mjs"$/,
+ `hook command must quote the \${PLUGIN_ROOT} script path: ${cmd}`,
+ );
}
});