Commit 7b79b07
committed
fix: normalize path slashes in PostToolUse hook to prevent session_id write failure
When CLAUDE_PLUGIN_ROOT has a trailing slash, the command template
produces double slashes (e.g. "humania//scripts/setup-rlcr-loop.sh").
The setup script normalizes its own path via cd+pwd (single slash),
but tool_input.command preserves the original double-slash string.
This causes the boundary-aware string match in loop-post-bash-hook.sh
to always fail, so the .pending-session-id signal is never consumed
and session_id is never written to state.md.
With an empty session_id, find_active_loop() backward-compat logic
matches any session, causing cross-instance stop hook hijacking when
multiple Claude Code sessions run concurrently.
Fix: normalize consecutive slashes with tr -s '/' before comparison.
Fixes: #671 parent 1e3fa1a commit 7b79b07
4 files changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
70 | 80 | | |
71 | 81 | | |
72 | 82 | | |
| |||
0 commit comments