From c148f0b46128898bf73e5042f904b8dd850750b5 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Wed, 18 Feb 2026 00:29:51 +0000 Subject: [PATCH] fix: address CodeRabbit feedback on auto-update-helper.sh (t1084) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three issues from PR #1591 review: 1. Validate AIDEVOPS_SKILL_FRESHNESS_HOURS is a positive integer before arithmetic expansion — non-numeric value crashes under set -e; falls back to DEFAULT_SKILL_FRESHNESS_HOURS with a warning log entry. 2. Fix help text: document 'skill-update-helper.sh check --auto-update --quiet' to match the actual runtime invocation (was missing 'check'). 3. Tighten pgrep -f pattern in is_update_running() from generic 'setup\.sh' to '${INSTALL_DIR}/setup\.sh' to avoid false matches from unrelated projects' setup scripts. ShellCheck zero violations, bash -n syntax OK. --- .agents/scripts/auto-update-helper.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.agents/scripts/auto-update-helper.sh b/.agents/scripts/auto-update-helper.sh index 336710979b..2d8dee3e30 100755 --- a/.agents/scripts/auto-update-helper.sh +++ b/.agents/scripts/auto-update-helper.sh @@ -169,7 +169,8 @@ get_remote_version() { ####################################### is_update_running() { # Check for running setup.sh processes (not our own) - if pgrep -f "setup\.sh" >/dev/null 2>&1; then + # Use full path to avoid matching unrelated projects' setup.sh scripts + if pgrep -f "${INSTALL_DIR}/setup\.sh" >/dev/null 2>&1; then return 0 fi # Check for running aidevops update @@ -237,6 +238,11 @@ check_skill_freshness() { fi local freshness_hours="${AIDEVOPS_SKILL_FRESHNESS_HOURS:-$DEFAULT_SKILL_FRESHNESS_HOURS}" + # Validate freshness_hours is a positive integer (non-numeric crashes under set -e) + if ! [[ "$freshness_hours" =~ ^[0-9]+$ ]] || [[ "$freshness_hours" -eq 0 ]]; then + log_warn "AIDEVOPS_SKILL_FRESHNESS_HOURS='${freshness_hours}' is not a positive integer — using default (${DEFAULT_SKILL_FRESHNESS_HOURS}h)" + freshness_hours="$DEFAULT_SKILL_FRESHNESS_HOURS" + fi local freshness_seconds=$((freshness_hours * 3600)) # Read last skill check timestamp from state file @@ -618,7 +624,7 @@ HOW IT WORKS: 5. Skips if another update is already in progress 6. Runs daily skill freshness check (24h gate): a. Reads last_skill_check from state file - b. If >24h since last check, calls skill-update-helper.sh --auto-update --quiet + b. If >24h since last check, calls skill-update-helper.sh check --auto-update --quiet c. Updates last_skill_check timestamp in state file d. Runs on every cmd_check invocation (gate prevents excessive network calls)