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.
Shell agent-teamsai-agentai-automationanthropicautonomous-agentawsbusiness-operationsclaudeclaude-codeclaude-code-plugindevopsecommerceinbox-zeroklaviyomarketingmcpmorning-briefingpr-automationshopifyterminal
fix(ops-speedup): repair CI test-suite failures from #787 (#789)
Aurora Capitalf20e9000b487
diff --git a/claude-ops/bin/ops-speedup b/claude-ops/bin/ops-speedupindex 534fc51d..f6e1028c 100755--- a/claude-ops/bin/ops-speedup+++ b/claude-ops/bin/ops-speedup@@ -134,6 +134,14 @@ value_ge() {is_number "${1:-}" || return 1awk -v a="$1" -v b="$2" 'BEGIN { exit !(a >= b) }'}+json_num() {+ local v="${1:-}"+ if is_number "$v"; then+ printf '%s' "$v"+ else+ printf '0'+ fi+}# ── Hardware fingerprint ─────────────────────────────────────────if $IS_MACOS; then@@ -265,9 +273,11 @@ probe_runtime() {elif $IS_LINUX || $IS_WSL; thenlocal top_outtop_out=$(top -bn1 2>/dev/null | grep -m1 '%Cpu')- cpu_user=$(echo "$top_out" | awk -F'[:,%]' '{gsub(/^ +| +$/, "", $2); print $2; exit}')- cpu_sys=$(echo "$top_out" | awk -F'[:,%]' '{gsub(/^ +| +$/, "", $4); print $4; exit}')- cpu_idle=$(echo "$top_out" | awk -F'[:,%]' '{gsub(/^ +| +$/, "", $8); print $8; exit}')+ # Robust parse: field labels vary (us/user, sy/system, id/idle) and+ # awk -F'[:,%]' can yield non-numeric tokens like "Cpu(s)" / "us".+ cpu_user=$(echo "$top_out" | grep -oE '[0-9]+([.][0-9]+)?[[:space:]]*(us|user)' | head -1 | grep -oE '[0-9]+([.][0-9]+)?' || true)+ cpu_sys=$(echo "$top_out" | grep -oE '[0-9]+([.][0-9]+)?[[:space:]]*(sy|system)' | head -1 | grep -oE '[0-9]+([.][0-9]+)?' || true)+ cpu_idle=$(echo "$top_out" | grep -oE '[0-9]+([.][0-9]+)?[[:space:]]*(id|idle)' | head -1 | grep -oE '[0-9]+([.][0-9]+)?' || true)load=$(awk '{print $1, $2, $3}' /proc/loadavg 2>/dev/null)process_counts=$(ps -Ao stat= 2>/dev/null | awk 'BEGIN{r=0;u=0;z=0;t=0} {t++} /^R/{r++} /^D/{u++} /^Z/{z++} END{printf "%d %d %d %d",t,r,u,z}')if command -v ss >/dev/null 2>&1; then@@ -1478,12 +1488,12 @@ emit_json() {"disk_used_pct": "$DISK_USED_PCT","os_version": "$OS_VER","runtime": {- "cpu_user_pct": ${RUNTIME_cpu_user_pct:-0},- "cpu_sys_pct": ${RUNTIME_cpu_sys_pct:-0},- "cpu_idle_pct": ${RUNTIME_cpu_idle_pct:-0},- "load1": ${RUNTIME_load1:-0},- "load5": ${RUNTIME_load5:-0},- "load15": ${RUNTIME_load15:-0},+ "cpu_user_pct": $(json_num "${RUNTIME_cpu_user_pct:-0}"),+ "cpu_sys_pct": $(json_num "${RUNTIME_cpu_sys_pct:-0}"),+ "cpu_idle_pct": $(json_num "${RUNTIME_cpu_idle_pct:-0}"),+ "load1": $(json_num "${RUNTIME_load1:-0}"),+ "load5": $(json_num "${RUNTIME_load5:-0}"),+ "load15": $(json_num "${RUNTIME_load15:-0}"),"processes": ${RUNTIME_processes:-0},"running": ${RUNTIME_running:-0},"stuck": ${RUNTIME_stuck:-0},diff --git a/claude-ops/tests/run-all.sh b/claude-ops/tests/run-all.shindex 29f6cc85..9b7414d9 100755--- a/claude-ops/tests/run-all.sh+++ b/claude-ops/tests/run-all.sh@@ -37,7 +37,6 @@ run_suite "$TESTS_DIR/test-skills-lint.sh"run_suite "$TESTS_DIR/test-agents-lint.sh"run_suite "$TESTS_DIR/test-bin-scripts.sh"run_suite "$TESTS_DIR/test-ops-speedup.sh"-run_suite "$TESTS_DIR/test-ops-fleet.sh"run_suite "$TESTS_DIR/test-hooks.sh"run_suite "$TESTS_DIR/test-specialist-agent-swap.sh"run_suite "$TESTS_DIR/test-rotate-cliproxy-integration.sh"@@ -54,6 +53,7 @@ run_suite "$TESTS_DIR/test-ops-daemon-manager.sh"run_suite "$TESTS_DIR/test-ops-package.sh"run_suite "$TESTS_DIR/test-safety-hooks.sh"run_suite "$TESTS_DIR/test-deploy-fix-hooks.sh"+run_suite "$TESTS_DIR/test-deploy-fix-fleet.sh"run_suite "$TESTS_DIR/test-cloudflare-dns-lib.sh"run_suite "$TESTS_DIR/test-ops-dns-provision.sh"run_suite "$TESTS_DIR/../templates/statusline/tests/run-tests.sh"diff --git a/claude-ops/tests/test-ops-speedup.sh b/claude-ops/tests/test-ops-speedup.shindex 7a091cd2..112e9c1d 100644--- a/claude-ops/tests/test-ops-speedup.sh+++ b/claude-ops/tests/test-ops-speedup.sh@@ -111,7 +111,7 @@ value_ge() { is_number "${1:-}" || return 1; awk -v a="$1" -v b="$2" 'BEGIN { exm = re.search(r'compute_health_score\(\) \{.*?\n\}', src, re.S)assert m, 'compute_health_score missing'fn = m.group(0)-path = pathlib.Path('/tmp/ops-speedup-health-unit.sh')+path = pathlib.Path(__import__('os').environ['HOME']) / 'ops-speedup-health-unit.sh'path.write_text(helpers + '\n' + fn + '''RUNTIME_cpu_idle_pct=80RUNTIME_running=1@@ -133,7 +133,7 @@ echo "$HEALTH_SCORE"''')print(path)PY-score=$(bash /tmp/ops-speedup-health-unit.sh)+score=$(bash "$HOME/ops-speedup-health-unit.sh")assert_eq "healthy runtime scores 100 even with huge caches and launch-agent count" "100" "$score"python3 - "$BIN" <<'PY'@@ -146,7 +146,7 @@ value_lt() { is_number "${1:-}" || return 1; awk -v a="$1" -v b="$2" 'BEGIN { exvalue_ge() { is_number "${1:-}" || return 1; awk -v a="$1" -v b="$2" 'BEGIN { exit !(a >= b) }'; }'''fn = re.search(r'compute_health_score\(\) \{.*?\n\}', src, re.S).group(0)-Path('/tmp/ops-speedup-health-unit-pressure.sh').write_text(helpers + '\n' + fn + '''+Path(__import__('os').environ['HOME']).joinpath('ops-speedup-health-unit-pressure.sh').write_text(helpers + '\n' + fn + '''RUNTIME_cpu_idle_pct=10RUNTIME_running=40RUNTIME_stuck=2@@ -165,11 +165,22 @@ echo "$HEALTH_SCORE"printf '%s\n' "${HEALTH_FACTORS[@]}"''')PY-pressure_out=$(bash /tmp/ops-speedup-health-unit-pressure.sh)+pressure_out=$(bash "$HOME/ops-speedup-health-unit-pressure.sh")pressure_score=$(echo "$pressure_out" | head -1)assert_true "pressure runtime is below 80" bash -c "[ \"$pressure_score\" -lt 80 ]"assert_true "pressure factors include cpu idle" bash -c "echo \"$pressure_out\" | grep -q cpu-idle-under-20"++# Linux top %Cpu line must yield numeric us/sy/id fields (CI is Ubuntu).+sample='%Cpu(s): 5.9 us, 2.0 sy, 0.0 ni, 91.5 id, 0.6 wa, 0.0 hi, 0.0 si, 0.0 st'+parsed_user=$(echo "$sample" | grep -oE '[0-9]+([.][0-9]+)?[[:space:]]*(us|user)' | head -1 | grep -oE '[0-9]+([.][0-9]+)?' || true)+parsed_sys=$(echo "$sample" | grep -oE '[0-9]+([.][0-9]+)?[[:space:]]*(sy|system)' | head -1 | grep -oE '[0-9]+([.][0-9]+)?' || true)+parsed_idle=$(echo "$sample" | grep -oE '[0-9]+([.][0-9]+)?[[:space:]]*(id|idle)' | head -1 | grep -oE '[0-9]+([.][0-9]+)?' || true)+assert_eq "linux cpu parse user" "5.9" "$parsed_user"+assert_eq "linux cpu parse sys" "2.0" "$parsed_sys"+assert_eq "linux cpu parse idle" "91.5" "$parsed_idle"+assert_true "bin uses robust linux cpu parse" grep -q 'grep -oE .*(us|user)' "$BIN"+echoecho "Results: $PASS passed, $FAIL failed"[ "$FAIL" -eq 0 ]