Skip to content

Commit 7b79b07

Browse files
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: #67
1 parent 1e3fa1a commit 7b79b07

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "humanize",
99
"source": "./",
1010
"description": "Humanize - An iterative development plugin that uses Codex to review Claude's work. Creates a feedback loop where Claude implements plans and Codex independently reviews progress, ensuring quality through continuous refinement.",
11-
"version": "1.15.1"
11+
"version": "1.15.2"
1212
}
1313
]
1414
}

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "humanize",
33
"description": "Humanize - An iterative development plugin that uses Codex to review Claude's work. Creates a feedback loop where Claude implements plans and Codex independently reviews progress, ensuring quality through continuous refinement.",
4-
"version": "1.15.1",
4+
"version": "1.15.2",
55
"author": {
66
"name": "humania-org"
77
},

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Humanize
22

3-
**Current Version: 1.15.1**
3+
**Current Version: 1.15.2**
44

55
> Derived from the [GAAC (GitHub-as-a-Context)](https://github.com/SihaoLiu/gaac) project.
66

hooks/loop-post-bash-hook.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ if [[ -n "$COMMAND_SIGNATURE" ]]; then
6767
exit 0
6868
fi
6969

70+
# Normalize consecutive slashes (e.g. "humania//scripts" -> "humania/scripts").
71+
# CLAUDE_PLUGIN_ROOT may have a trailing slash, producing double slashes when
72+
# concatenated with "/scripts/..." in the command template. The setup script
73+
# normalizes its own path via cd+pwd (removing double slashes), but the
74+
# tool_input.command preserves the original string. Without normalization,
75+
# the string comparison below always fails and session_id is never written.
76+
# See: https://github.com/humania-org/humanize/issues/67
77+
HOOK_COMMAND=$(printf '%s' "$HOOK_COMMAND" | tr -s '/')
78+
COMMAND_SIGNATURE=$(printf '%s' "$COMMAND_SIGNATURE" | tr -s '/')
79+
7080
# Boundary-aware match: command must be a valid setup invocation form.
7181
# Requires the script path to be followed by end-of-string or any POSIX
7282
# whitespace ([[:space:]]), preventing concatenated forms.

0 commit comments

Comments
 (0)