fix(mac-compat): resolve absolute path of agent binary and strip macos quarantine attribute to prevent gatekeeper and path-resolution timeouts
This commit is contained in:
@@ -148,11 +148,29 @@ if [ -n "$ISOLATION_ROOT" ]; then
|
||||
ISO_ENV_PREFIX="$(isolation_env_prefix "$AGENT" "$ISOLATION_ROOT")"
|
||||
ISO_CMD_ARGS="$(isolation_cmd_args "$AGENT" "$ISOLATION_ROOT")"
|
||||
fi
|
||||
|
||||
# Resolve absolute path of the agent command to prevent tmux PATH inheritance issues (especially on macOS)
|
||||
RESOLVED_BIN="$AGENT"
|
||||
if [ "$AGENT" = "cline" ]; then
|
||||
if command -v cline >/dev/null 2>&1; then
|
||||
RESOLVED_BIN="$(command -v cline)"
|
||||
fi
|
||||
else
|
||||
if command -v "$AGENT" >/dev/null 2>&1; then
|
||||
RESOLVED_BIN="$(command -v "$AGENT")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# On macOS, clear quarantine attribute for the agent binary to prevent Gatekeeper hangs
|
||||
if [ "$(uname)" = "Darwin" ] && [ -f "$RESOLVED_BIN" ]; then
|
||||
xattr -d com.apple.quarantine "$RESOLVED_BIN" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
case "$AGENT" in
|
||||
claude) CMD_FULL="${ISO_ENV_PREFIX}claude --dangerously-skip-permissions" ;;
|
||||
agy) CMD_FULL="${ISO_ENV_PREFIX}agy --dangerously-skip-permissions" ;;
|
||||
hermes) CMD_FULL="${ISO_ENV_PREFIX}hermes" ;;
|
||||
cline) CMD_FULL="cline -i${ISO_CMD_ARGS:+ $ISO_CMD_ARGS}" ;;
|
||||
claude) CMD_FULL="${ISO_ENV_PREFIX}${RESOLVED_BIN} --dangerously-skip-permissions" ;;
|
||||
agy) CMD_FULL="${ISO_ENV_PREFIX}${RESOLVED_BIN} --dangerously-skip-permissions" ;;
|
||||
hermes) CMD_FULL="${ISO_ENV_PREFIX}${RESOLVED_BIN}" ;;
|
||||
cline) CMD_FULL="${RESOLVED_BIN} -i${ISO_CMD_ARGS:+ $ISO_CMD_ARGS}" ;;
|
||||
esac
|
||||
|
||||
spawn() {
|
||||
|
||||
@@ -87,12 +87,29 @@ if [ -n "$ISO_ROOT" ]; then
|
||||
echo "Re-applying isolation: root=$ISO_ROOT env=$ISO_ENV args=$ISO_ARGS"
|
||||
fi
|
||||
|
||||
# Resolve absolute path of the agent command to prevent tmux PATH inheritance issues (especially on macOS)
|
||||
RESOLVED_BIN="$AGENT"
|
||||
if [ "$AGENT" = "cline" ]; then
|
||||
if command -v cline >/dev/null 2>&1; then
|
||||
RESOLVED_BIN="$(command -v cline)"
|
||||
fi
|
||||
else
|
||||
if command -v "$AGENT" >/dev/null 2>&1; then
|
||||
RESOLVED_BIN="$(command -v "$AGENT")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# On macOS, clear quarantine attribute for the agent binary to prevent Gatekeeper hangs
|
||||
if [ "$(uname)" = "Darwin" ] && [ -f "$RESOLVED_BIN" ]; then
|
||||
xattr -d com.apple.quarantine "$RESOLVED_BIN" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Determine CMD_FULL with isolation applied
|
||||
case "$AGENT" in
|
||||
claude) CMD_FULL="claude --dangerously-skip-permissions -r $UUID" ;;
|
||||
agy) CMD_FULL="agy --dangerously-skip-permissions --conversation $UUID" ;;
|
||||
hermes) CMD_FULL="hermes --resume $UUID" ;;
|
||||
cline) CMD_FULL="cline -i --id $UUID" ;;
|
||||
claude) CMD_FULL="${RESOLVED_BIN} --dangerously-skip-permissions -r $UUID" ;;
|
||||
agy) CMD_FULL="${RESOLVED_BIN} --dangerously-skip-permissions --conversation $UUID" ;;
|
||||
hermes) CMD_FULL="${RESOLVED_BIN} --resume $UUID" ;;
|
||||
cline) CMD_FULL="${RESOLVED_BIN} -i --id $UUID" ;;
|
||||
esac
|
||||
|
||||
# Prepend env prefix and append command args (T4)
|
||||
|
||||
Reference in New Issue
Block a user