Skip to content

Commit f73acce

Browse files
committed
fix: probe binary and ad-hoc sign on macOS in session hook
Cross-compiled darwin/arm64 binaries from Linux release runners ship unsigned, and Apple Silicon's kernel kills unsigned arm64 binaries. The hook's `exec "$BINARY"` path then aborts the script with status 127 before the bash fallback can run, so users see a SessionStart hook error every session. Probe with `conclave version` before exec'ing; if the probe fails, remove the cached binary and fall through to download. After download, ad-hoc sign on macOS with `codesign --sign -` so the kernel will accept the binary, then probe again before exec. Bumps to v10.2.1.
1 parent 6542053 commit f73acce

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

.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": "conclave",
33
"description": "Core skills library for Claude Code: TDD, debugging, collaboration patterns, and proven techniques",
4-
"version": "10.2.0",
4+
"version": "10.2.1",
55
"author": {
66
"name": "Gabe Ortiz",
77
"email": "gabe@signalnine.com"

hooks/ensure-binary.sh

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
88
PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
99
BINARY="${PLUGIN_ROOT}/conclave"
1010

11-
# If binary exists and is executable, run it directly
12-
if [ -x "$BINARY" ]; then
13-
exec "$BINARY" hook session-start
14-
fi
15-
1611
# Detect OS
1712
case "$(uname -s)" in
1813
Linux) OS="linux" ;;
@@ -33,6 +28,19 @@ case "$(uname -m)" in
3328
;;
3429
esac
3530

31+
# Probe binary: an unsigned cross-compiled darwin/arm64 binary will be killed
32+
# by the macOS kernel. A broken binary cached from a prior run would make
33+
# `exec` abort the script (exit 127) before the fallback could run, so we
34+
# verify it works first and remove it if not.
35+
binary_works() {
36+
[ -x "$1" ] && "$1" version >/dev/null 2>&1
37+
}
38+
39+
if binary_works "$BINARY"; then
40+
exec "$BINARY" hook session-start
41+
fi
42+
rm -f "$BINARY"
43+
3644
# Read version from plugin.json (no jq dependency)
3745
VERSION=$(grep -o '"version"[[:space:]]*:[[:space:]]*"[^"]*"' "${PLUGIN_ROOT}/.claude-plugin/plugin.json" | grep -o '"[^"]*"$' | tr -d '"')
3846

@@ -45,8 +53,16 @@ URL="https://github.com/signalnine/conclave/releases/download/v${VERSION}/concla
4553

4654
if curl -fsSL -o "$BINARY" "$URL" 2>/dev/null; then
4755
chmod +x "$BINARY"
48-
exec "$BINARY" hook session-start
56+
# Ad-hoc sign on macOS: cross-compiled Mach-O binaries built on Linux
57+
# runners have no signature, and arm64 macOS rejects unsigned binaries.
58+
if [ "$OS" = "darwin" ] && command -v codesign >/dev/null 2>&1; then
59+
codesign --sign - --force "$BINARY" >/dev/null 2>&1 || true
60+
fi
61+
if binary_works "$BINARY"; then
62+
exec "$BINARY" hook session-start
63+
fi
64+
rm -f "$BINARY"
4965
fi
5066

51-
# Download failed, fall back to bash script
67+
# Download failed or binary still doesn't run — fall back to bash script
5268
exec "${SCRIPT_DIR}/session-start.sh"

0 commit comments

Comments
 (0)