Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-end-cleanup.mjs\""
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-end-cleanup.mjs\"",
"timeout": 15
}
]
}
Expand Down
16 changes: 16 additions & 0 deletions tests/session-end-cleanup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ describe("session-end-cleanup", () => {
});

describe("hooks.json wiring", () => {
test("gives session cleanup enough time during contended teardown", () => {
const config = JSON.parse(readFileSync(HOOKS_CONFIG_PATH, "utf-8")) as {
hooks?: {
SessionEnd?: Array<{
hooks?: Array<{ type?: string; command?: string; timeout?: number }>;
}>;
};
};

const cleanupHook = config.hooks?.SessionEnd
?.flatMap((entry) => entry.hooks ?? [])
.find((hook) => hook.command?.includes("session-end-cleanup.mjs"));

expect(cleanupHook?.timeout).toBe(15);
});

test("does not register the Agent pretooluse observer hook", () => {
const config = JSON.parse(readFileSync(HOOKS_CONFIG_PATH, "utf-8")) as {
hooks?: {
Expand Down