Environment
- Kanna: v0.41.5
- Claude Code: 2.1.143
- OS: Linux (Debian, amd64)
- Deployed as a persistent server via supervisord (not desktop app)
Description
The Stop hook fires correctly after each agent response. However, the SessionEnd hook never fires when a Kanna session ends — neither when the browser window is closed, nor when the Kanna server process is stopped (via SIGTERM from
supervisord).
Claude Code hooks are configured in the project's .claude/settings.json:
{
"hooks": {
"Stop": [{ "hooks": [{ "type": "command", "command": "python3 ..." }] }],
"SessionEnd": [{ "hooks": [{ "type": "command", "command": "bash ..." }] }]
}
}
Steps to reproduce
- Configure a
SessionEnd hook in .claude/settings.json of any project.
- Open Kanna, start a conversation in that project.
- Close the browser tab or stop the Kanna server.
- Observe:
SessionEnd hook is never executed.
Expected behavior
When Kanna terminates a Claude Code session (gracefully or on server shutdown), the underlying Claude Code process should receive a graceful shutdown signal so the SessionEnd hook fires before the process exits.
Impact
SessionEnd is the standard integration point for post-session automation (report generation, session archiving, cleanup). Without it, Kanna is incompatible with hook-based pipelines that rely on session lifecycle events.
Possible fix
Ensure that when a session ends (browser disconnect, explicit close, or server shutdown), Kanna sends SIGTERM to the Claude Code subprocess and waits for graceful exit rather than killing it immediately
Environment
Description
The
Stophook fires correctly after each agent response. However, theSessionEndhook never fires when a Kanna session ends — neither when the browser window is closed, nor when the Kanna server process is stopped (via SIGTERM fromsupervisord).
Claude Code hooks are configured in the project's
.claude/settings.json:{
"hooks": {
"Stop": [{ "hooks": [{ "type": "command", "command": "python3 ..." }] }],
"SessionEnd": [{ "hooks": [{ "type": "command", "command": "bash ..." }] }]
}
}
Steps to reproduce
SessionEndhook in.claude/settings.jsonof any project.SessionEndhook is never executed.Expected behavior
When Kanna terminates a Claude Code session (gracefully or on server shutdown), the underlying Claude Code process should receive a graceful shutdown signal so the
SessionEndhook fires before the process exits.Impact
SessionEndis the standard integration point for post-session automation (report generation, session archiving, cleanup). Without it, Kanna is incompatible with hook-based pipelines that rely on session lifecycle events.Possible fix
Ensure that when a session ends (browser disconnect, explicit close, or server shutdown), Kanna sends SIGTERM to the Claude Code subprocess and waits for graceful exit rather than killing it immediately