Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

fix(deploy-fix): guard dispatch_fix_agent against set -e + add lock-held test

auroracapital1f7270d128c1
diff --git a/claude-ops/bin/ops-deploy-fix-build-trigger b/claude-ops/bin/ops-deploy-fix-build-trigger
index a4e20249..a763e6b3 100755
--- a/claude-ops/bin/ops-deploy-fix-build-trigger
+++ b/claude-ops/bin/ops-deploy-fix-build-trigger
@@ -62,9 +62,10 @@ if [ "$(config auto_dispatch_fixer true)" != "true" ]; then
exit 0
fi
+fix_rc=0
fix_log=$(dispatch_fix_agent "build-fixer" "$repo_slug-build" \
- "COMMAND=$cmd" "REPO_PATH=$repo_path" "BRANCH=$branch" "LOGS=$last_lines")
-case $? in
+ "COMMAND=$cmd" "REPO_PATH=$repo_path" "BRANCH=$branch" "LOGS=$last_lines") || fix_rc=$?
+case $fix_rc in
0)
cat <<JSON
{
diff --git a/claude-ops/tests/test-deploy-fix-hooks.sh b/claude-ops/tests/test-deploy-fix-hooks.sh
index b03ada10..5e77b663 100755
--- a/claude-ops/tests/test-deploy-fix-hooks.sh
+++ b/claude-ops/tests/test-deploy-fix-hooks.sh
@@ -259,6 +259,31 @@ test_build_trigger_transient() {
assert_contains "2d.transient-message" "transient" "$out"
}
test_build_trigger_transient
+
+# 2e — dispatch_fix_agent returns non-zero (lock held) under set -e: hook must still exit 0
+test_build_trigger_lock_held() {
+ new_isolated_env "case2-lock-held"
+ export CLAUDE_PLUGIN_OPTION_DEPLOY_FIX_ENABLED=true
+ export CLAUDE_PLUGIN_OPTION_MONITOR_BUILD_FAILURES=true
+ export CLAUDE_PLUGIN_OPTION_AUTO_DISPATCH_FIXER=true
+ # Pre-create a live lock owned by current PID so dispatch_fix_agent returns 2
+ local slug_full
+ slug_full=$(git -C "$(pwd -P)" config --get remote.origin.url 2>/dev/null | \
+ sed -E 's|.*[:/]([^/]+/[^/]+)(\.git)?$|\1|; s|\.git$||' || true)
+ local repo_slug
+ repo_slug=$(echo "${slug_full:-local-build}" | tr '/' '-')
+ echo $$ > "$TEST_STATE/lock-${repo_slug}-build"
+ out=$(cat "$FIXTURES/build-trigger-fail.json" | bash "$PLUGIN_ROOT/bin/ops-deploy-fix-build-trigger" 2>&1)
+ rc=$?
+ assert_eq "2e.exit-zero-on-lock" "0" "$rc"
+ sleep 0.3
+ if [ ! -s "$TEST_LOGS/claude.log" ]; then
+ pass "2e.no-dispatch-when-locked"
+ else
+ fail "2e.no-dispatch-when-locked" "claude invoked despite lock"
+ fi
+}
+test_build_trigger_lock_held
# ===========================================================================
# CASE 3 — is_transient
# ===========================================================================