fix: close remaining openclaw governance regressions
This commit is contained in:
16
scripts/cron_precondition_integration_test.sh
Normal file
16
scripts/cron_precondition_integration_test.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
TMP_DIR="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMP_DIR"' EXIT
|
||||
export LLM_DAILY_MEMORY_PATH="$TMP_DIR/2026-05-29.md"
|
||||
export REPORT_DATE='2026-05-29'
|
||||
|
||||
bash scripts/cron_status_report.sh cron precondition_missing 'run_daily.sh failed' 'precondition_missing; 严格真实模式下必须提供 API Key' 'provide missing env/config and rerun' >/tmp/cron_precondition_test.out 2>&1
|
||||
|
||||
grep -q 'status=precondition_missing' "$LLM_DAILY_MEMORY_PATH"
|
||||
grep -q 'precondition_missing; 严格真实模式下必须提供 API Key' "$LLM_DAILY_MEMORY_PATH"
|
||||
grep -q 'provide missing env/config and rerun' "$LLM_DAILY_MEMORY_PATH"
|
||||
@@ -51,7 +51,7 @@ classify_cron_failure_status() {
|
||||
local normalized
|
||||
normalized="$(printf '%s' "$message" | tr '[:upper:]' '[:lower:]')"
|
||||
case "$normalized" in
|
||||
*"api key"*|*"database_url"*|*"must provide"*|*"未设置"*|*"permission denied"*|*"role does not exist"*|*"relation does not exist"*)
|
||||
*"api key"*|*"openrouter_api_key"*|*"database_url"*|*"must provide"*|*"未设置"*|*"permission denied"*|*"role does not exist"*|*"relation does not exist"*|*"数据采集失败"*)
|
||||
printf '%s\n' "precondition_missing"
|
||||
;;
|
||||
*)
|
||||
@@ -108,7 +108,11 @@ error_exit() {
|
||||
output_path="$(report_markdown_path "$REPORT_DATE")"
|
||||
fi
|
||||
track_report_state "$DB_URL" "$REPORT_DATE" "failed" "${MODEL_COUNT:-}" "$PIPELINE_AUDIT_SUMMARY" "$output_path" "$1" "scheduled" "cron" "true" >> "$LOG_FILE" 2>&1 || true
|
||||
report_cron_status "$cron_status" "run_daily.sh failed" "$1" "inspect ${LOG_FILE}"
|
||||
if [[ "$cron_status" == "precondition_missing" ]]; then
|
||||
report_cron_status "$cron_status" "run_daily.sh failed" "precondition_missing; $1" "provide missing env/config and rerun"
|
||||
else
|
||||
report_cron_status "$cron_status" "run_daily.sh failed" "$1" "inspect ${LOG_FILE}"
|
||||
fi
|
||||
# 发送告警
|
||||
if [ -n "$FEISHU_WEBHOOK" ]; then
|
||||
send_alert "$1"
|
||||
|
||||
Reference in New Issue
Block a user