aidevops 3.39.301 → 3.39.302

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,7 +25,7 @@ token efficiency, and quality control built in.**
25
25
  [![Maintainability](https://qlty.sh/gh/marcusquinn/projects/aidevops/maintainability.svg)](https://qlty.sh/gh/marcusquinn/projects/aidevops)
26
26
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/2b1adbd66c454dae92234341e801b984)](https://app.codacy.com/gh/marcusquinn/aidevops/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
27
27
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
28
- [![Version](https://img.shields.io/badge/Version-3.39.301-blue.svg)](https://github.com/marcusquinn/aidevops/releases)
28
+ [![Version](https://img.shields.io/badge/Version-3.39.302-blue.svg)](https://github.com/marcusquinn/aidevops/releases)
29
29
  [![npm version](https://img.shields.io/npm/v/aidevops)](https://www.npmjs.com/package/aidevops)
30
30
  [![Homebrew](https://img.shields.io/badge/homebrew-marcusquinn%2Ftap-orange)](https://github.com/marcusquinn/homebrew-tap)
31
31
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 3.39.301
1
+ 3.39.302
package/aidevops.sh CHANGED
@@ -5,7 +5,7 @@
5
5
  # AI DevOps Framework CLI
6
6
  # Usage: aidevops <command> [options]
7
7
  #
8
- # Version: 3.39.301
8
+ # Version: 3.39.302
9
9
 
10
10
  set -euo pipefail
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aidevops",
3
- "version": "3.39.301",
3
+ "version": "3.39.302",
4
4
  "description": "AI DevOps Framework - AI-assisted development workflows, code quality, and deployment automation",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.11",
package/setup.sh CHANGED
@@ -17,7 +17,7 @@ fi
17
17
  # AI Assistant Server Access Framework Setup Script
18
18
  # Helps developers set up the framework for their infrastructure
19
19
  #
20
- # Version: 3.39.301
20
+ # Version: 3.39.302
21
21
  #
22
22
  # Quick Install:
23
23
  # npm install -g aidevops && aidevops update (recommended)
@@ -345,6 +345,8 @@ SETUP_IMPL_MODULES_DIR="${SETUP_MODULES_DIR}/modules"
345
345
  source "${INSTALL_DIR}/.agents/scripts/runtime-bundle-verifier.sh"
346
346
  # shellcheck source=.agents/scripts/pulse-runtime-pin.sh
347
347
  source "${INSTALL_DIR}/.agents/scripts/pulse-runtime-pin.sh"
348
+ # shellcheck source=.agents/scripts/process-safety-lib.sh
349
+ source "${INSTALL_DIR}/.agents/scripts/process-safety-lib.sh"
348
350
  # shellcheck disable=SC1091 # Dynamic path via $SETUP_IMPL_MODULES_DIR
349
351
  source "${SETUP_IMPL_MODULES_DIR}/core.sh"
350
352
  # shellcheck disable=SC1091
@@ -716,64 +718,75 @@ _setup_pid_elapsed_seconds() {
716
718
 
717
719
  _setup_register_child_pid() {
718
720
  local pid="$1"
719
- [[ -n "$pid" ]] || return 0
721
+ # #aidevops:trust-boundary (GH#40830): only canonical PIDs > 1 enter the list.
722
+ [[ "$pid" =~ ^[1-9][0-9]*$ && "$pid" != "1" ]] || return 0
723
+ case " ${SETUP_NONINTERACTIVE_CHILD_PIDS:-} " in
724
+ *" ${pid} "*) return 0 ;;
725
+ esac
720
726
  SETUP_NONINTERACTIVE_CHILD_PIDS="${SETUP_NONINTERACTIVE_CHILD_PIDS}${SETUP_NONINTERACTIVE_CHILD_PIDS:+ }${pid}"
721
727
  return 0
722
728
  }
723
729
 
724
- _setup_collect_child_pids() {
725
- local parent_pid="$1"
726
- local child_pid=""
727
- local child_pids=""
728
- local current_pid="${BASHPID:-$$}"
729
- child_pids=$(pgrep -P "$parent_pid" 2>/dev/null || true)
730
- for child_pid in $child_pids; do
731
- [[ -n "$child_pid" && "$child_pid" != "$current_pid" ]] || continue
732
- printf '%s\n' "$child_pid"
733
- _setup_collect_child_pids "$child_pid"
730
+ # Drop a reaped child so a recycled PID can never be signalled later (GH#40830).
731
+ _setup_unregister_child_pid() {
732
+ local pid="$1"
733
+ local kept="" entry=""
734
+ for entry in ${SETUP_NONINTERACTIVE_CHILD_PIDS:-}; do
735
+ [[ "$entry" == "$pid" ]] && continue
736
+ kept="${kept}${kept:+ }${entry}"
734
737
  done
738
+ SETUP_NONINTERACTIVE_CHILD_PIDS="$kept"
735
739
  return 0
736
740
  }
737
741
 
742
+ # Wait for a registered background child, then forget its PID.
743
+ _setup_wait_child_pid() {
744
+ local pid="$1"
745
+ local rc=0
746
+ wait "$pid" 2>/dev/null || rc=$?
747
+ _setup_unregister_child_pid "$pid"
748
+ return "$rc"
749
+ }
750
+
751
+ # Signal a setup-owned subtree. #aidevops:trust-boundary (GH#40830): the root
752
+ # must be a live descendant of this setup run ($$) in a fresh process table;
753
+ # PID 1, the caller and its ancestors are always refused by the shared guard.
738
754
  _setup_kill_pid_tree() {
739
755
  local signal_name="$1"
740
756
  local root_pid="$2"
741
- local child_pid=""
742
- local current_pid="${BASHPID:-$$}"
743
- [[ -n "$root_pid" && "$root_pid" != "$current_pid" ]] || return 0
744
- for child_pid in $(_setup_collect_child_pids "$root_pid"); do
745
- kill "-${signal_name}" "$child_pid" 2>/dev/null || true
746
- done
747
- kill "-${signal_name}" "$root_pid" 2>/dev/null || true
757
+ local table="${3:-}"
758
+ declare -F aidevops_signal_process_tree >/dev/null 2>&1 || return 0
759
+ aidevops_signal_process_tree "$signal_name" "$root_pid" "$$" "$table"
748
760
  return 0
749
761
  }
750
762
 
763
+ # Signal only registered PIDs that are still live descendants of $$; their
764
+ # subtrees are descendants too. Unregistered descendants (helpers that set up
765
+ # their own background work) are also owned by this run and are included.
751
766
  _setup_cleanup_noninteractive_children() {
752
767
  local pid=""
753
- local current_pid="${BASHPID:-$$}"
768
+ local table=""
769
+ local targets=""
754
770
  local grace_s="${AIDEVOPS_SETUP_CHILD_TERM_GRACE_S:-2}"
755
- local has_live_child=false
756
771
  [[ "$grace_s" =~ ^[0-9]+$ ]] || grace_s=2
757
- for pid in $(_setup_collect_child_pids "$current_pid"); do
758
- _setup_register_child_pid "$pid"
759
- done
760
- for pid in ${SETUP_NONINTERACTIVE_CHILD_PIDS:-}; do
761
- if _setup_lock_pid_alive "$pid"; then
762
- has_live_child=true
763
- _setup_kill_pid_tree TERM "$pid"
764
- fi
765
- done
766
- if [[ "$has_live_child" == "true" && "$grace_s" -gt 0 ]]; then
767
- sleep "$grace_s" 2>/dev/null || true
772
+ declare -F aidevops_proc_descendants >/dev/null 2>&1 || return 0
773
+ table="$(aidevops_proc_table)"
774
+ targets="$(aidevops_proc_descendants "$$" "$table" | tr '\n' ' ')"
775
+ if [[ -n "${targets// /}" ]]; then
776
+ for pid in $targets; do
777
+ _setup_kill_pid_tree TERM "$pid" "$table"
778
+ done
779
+ ((grace_s > 0)) && { sleep "$grace_s" 2>/dev/null || true; }
780
+ # Fresh snapshot: survivors must still descend from $$ to be killed.
781
+ table="$(aidevops_proc_table)"
782
+ for pid in $targets; do
783
+ _setup_kill_pid_tree KILL "$pid" "$table"
784
+ done
768
785
  fi
769
- for pid in ${SETUP_NONINTERACTIVE_CHILD_PIDS:-}; do
770
- if _setup_lock_pid_alive "$pid"; then
771
- _setup_kill_pid_tree KILL "$pid"
772
- fi
773
- done
774
786
  for pid in ${SETUP_NONINTERACTIVE_CHILD_PIDS:-}; do
775
787
  wait "$pid" 2>/dev/null || true
776
788
  done
789
+ SETUP_NONINTERACTIVE_CHILD_PIDS=""
777
790
  return 0
778
791
  }
779
792
 
@@ -795,14 +808,14 @@ _setup_run_noncritical_stage_bounded() {
795
808
  _setup_kill_pid_tree TERM "$pid"
796
809
  sleep "${AIDEVOPS_SETUP_CHILD_TERM_GRACE_S:-2}" 2>/dev/null || true
797
810
  _setup_kill_pid_tree KILL "$pid"
798
- wait "$pid" 2>/dev/null || true
811
+ _setup_wait_child_pid "$pid" || true
799
812
  _SETUP_NONCRITICAL_STAGE_TIMED_OUT=true
800
813
  print_warning "${stage_label} exceeded ${timeout_s}s — skipping remaining non-critical work"
801
814
  return 0
802
815
  fi
803
816
  sleep 1
804
817
  done
805
- wait "$pid" 2>/dev/null || rc=$?
818
+ _setup_wait_child_pid "$pid" || rc=$?
806
819
  return "$rc"
807
820
  }
808
821