mirror of
https://git.valherun.com/valherun/pxe_boot_alma.git
synced 2026-10-14 19:02:03 -04:00
- restructure boot/kickstarts/scripts/docs into homelab/ - docs: alma9->10 breaking changes, CIS hardening, kickstart changes - add find_cron_entries.sh helper and codex running memory notes Co-Authored-By: Claude Fable 5 <[email protected]>
83 lines
2.1 KiB
Bash
Executable File
83 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT=/usr/local/valherun/pxe_boot_alma
|
|
WATCH_ROOT=/tmp/probe-stage-watch
|
|
TRIAGE_FILE="$WATCH_ROOT/needs-triage.env"
|
|
RUN_LOG="$WATCH_ROOT/supervisor/router.log"
|
|
STATUS_FILE="$WATCH_ROOT/supervisor/router-status.env"
|
|
ENABLE_CODEX_FALLBACK="${ENABLE_CODEX_FALLBACK:-0}"
|
|
|
|
mkdir -p "$WATCH_ROOT/supervisor"
|
|
|
|
timestamp() {
|
|
date '+%F %T'
|
|
}
|
|
|
|
if [[ ! -f "$TRIAGE_FILE" ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
# shellcheck disable=SC1090
|
|
source "$TRIAGE_FILE"
|
|
|
|
outcome="${TRIAGE_OUTCOME:-unknown}"
|
|
mode="${TRIAGE_MODE:-unknown}"
|
|
stage="${TRIAGE_STAGE:-unknown}"
|
|
suspect="${TRIAGE_SUSPECT:-unknown}"
|
|
attempt="${TRIAGE_ATTEMPT:-unknown}"
|
|
|
|
run_codex=0
|
|
run_claude=0
|
|
route_reason=""
|
|
|
|
case "$outcome" in
|
|
*install\ timeout*|*template\ capture*|*snapshot\ stage\ apply\ failed*)
|
|
run_claude=1
|
|
route_reason="claude-first-harness-or-apply-failure"
|
|
;;
|
|
*snapshot\ stage\ failed*)
|
|
run_claude=1
|
|
route_reason="claude-first-snapshot-stage-regression"
|
|
;;
|
|
*boot\ failed/no\ ssh*|*snapshot\ boot\ failed/no\ ssh*|*snapshot\ reboot\ failed/no\ ssh*)
|
|
run_claude=1
|
|
route_reason="claude-first-boot-or-stage-regression"
|
|
;;
|
|
*)
|
|
run_claude=1
|
|
route_reason="claude-first-default"
|
|
;;
|
|
esac
|
|
|
|
if [[ "$ENABLE_CODEX_FALLBACK" == "1" ]]; then
|
|
case "$outcome" in
|
|
*watcher\ missing/stale\ state*|*watcher\ running/state\ stale*|*template\ capture*|*snapshot\ stage\ apply\ failed*)
|
|
run_codex=1
|
|
route_reason="${route_reason}+codex-fallback"
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
{
|
|
echo "ROUTED_AT='$(timestamp)'"
|
|
echo "TRIAGE_STAGE='${stage}'"
|
|
echo "TRIAGE_ATTEMPT='${attempt}'"
|
|
echo "TRIAGE_SUSPECT='${suspect}'"
|
|
echo "TRIAGE_OUTCOME='${outcome}'"
|
|
echo "TRIAGE_MODE='${mode}'"
|
|
echo "ROUTE_REASON='${route_reason}'"
|
|
echo "RUN_CODEX='${run_codex}'"
|
|
echo "RUN_CLAUDE='${run_claude}'"
|
|
} > "$STATUS_FILE"
|
|
|
|
echo "[$(timestamp)] route stage=$stage attempt=$attempt suspect=$suspect outcome=$outcome reason=$route_reason codex=$run_codex claude=$run_claude" >> "$RUN_LOG"
|
|
|
|
if [[ "$run_claude" == "1" ]]; then
|
|
"$ROOT/tools/claude_harness_supervisor.sh" || true
|
|
fi
|
|
|
|
if [[ "$run_codex" == "1" ]]; then
|
|
"$ROOT/tools/codex_harness_supervisor.sh" || true
|
|
fi
|