Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .agents/scripts/pulse-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
# where launchd fires between rm -f and the next write, which caused the
# 82-concurrent-pulse incident (2026-03-13T02:06:01Z, issue #4318).
#
# Called by launchd every 120s via the supervisor-pulse plist.
# Called by cron (Linux) or launchd (macOS) every 120s.
# GH#4513: The cron/launchd entry now runs this script directly from the
# repo (not the deployed copy at ~/.aidevops/agents/scripts/), so fixes
# are effective immediately after merge without needing setup.sh.

set -euo pipefail

Expand Down
14 changes: 11 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -857,11 +857,19 @@ main() {
# - Consent persisted: written to config.jsonc so it survives updates
# - Never silently re-enabled: if config says false, skip entirely
# - Non-interactive: only installs if config explicitly says true
local wrapper_script="$HOME/.aidevops/agents/scripts/pulse-wrapper.sh"
#
local pulse_label="com.aidevops.aidevops-supervisor-pulse"
local _aidevops_dir _pulse_repo_dir
_aidevops_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
_pulse_repo_dir=$(_resolve_main_worktree_dir "$_aidevops_dir")
# GH#4513: Use the repo version of pulse-wrapper.sh directly instead of
# the deployed copy at ~/.aidevops/agents/scripts/. The canonical repo
# directory is always on main (worktree-first workflow), so the repo
# version is always the latest merged code. This eliminates the
# deployment gap where fixes are merged but not deployed until the next
# setup.sh run — which caused 6 concurrent pulse sessions (GH#4513)
# because the flock guard (GH#4409) was merged but not deployed.
local wrapper_script="${_pulse_repo_dir}/.agents/scripts/pulse-wrapper.sh"

# Read explicit user consent from config.jsonc (not merged defaults).
# Empty = user never configured this; "true"/"false" = explicit choice.
Expand Down Expand Up @@ -930,9 +938,9 @@ main() {
fi
fi

# Guard: wrapper must exist
# Guard: wrapper must exist in the repo
if [[ "$_do_install" == "true" && ! -f "$wrapper_script" ]]; then
# Wrapper not deployed yet — skip (will install on next run after rsync)
# Wrapper not found in repo — skip (repo may be in a broken state)
_do_install=false
fi

Expand Down