chore(fleet): sync operator memory, hatch menu dialogs, and watchdog alerts
This commit is contained in:
@@ -2,10 +2,14 @@
|
||||
# chrome-error-scan.sh - scan per-profile chrome logs for concerning patterns.
|
||||
# Self-contained: scans, compares against watermark, reports only NEW matches.
|
||||
#
|
||||
# Usage: chrome-error-scan.sh [--json]
|
||||
# Usage: chrome-error-scan.sh [--json] [--no-advance]
|
||||
# Default output: "profile:new_count" lines for profiles with new matches,
|
||||
# or "OK: no new errors" if clean.
|
||||
# --json: output JSON {"profile": {"total": N, "new": M}, ...}
|
||||
# --no-advance: report against the watermark WITHOUT advancing it.
|
||||
# Peek-only read for high-frequency pollers (e.g. the web
|
||||
# surface via `box-ctl chrome-errors --no-advance`). Runs
|
||||
# without the flag keep the classic advance-on-read semantics.
|
||||
#
|
||||
# Watermark: /home/super/Projects/NetVM/chrome-error-watermark.json
|
||||
# Patterns: FATAL, crash, segfault, out of memory (case-insensitive)
|
||||
@@ -13,6 +17,16 @@
|
||||
LOGDIR="/home/super/Projects/NetVM"
|
||||
WATERMARK="$LOGDIR/chrome-error-watermark.json"
|
||||
|
||||
AS_JSON=0
|
||||
NO_ADVANCE=0
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--json) AS_JSON=1 ;;
|
||||
--no-advance) NO_ADVANCE=1 ;;
|
||||
*) echo "chrome-error-scan.sh: unknown argument: $arg" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Gather current counts per profile (grep -c prints 0 with exit 1 on no match;
|
||||
# the || true masks the exit code while preserving the "0" on stdout)
|
||||
get_count() {
|
||||
@@ -29,7 +43,7 @@ PIP_C=$(get_count pip)
|
||||
N646_C=$(get_count 646)
|
||||
OPM_C=$(get_count opm)
|
||||
|
||||
python3 - "$WATERMARK" "$MUSE_C" "$PIP_C" "$N646_C" "$OPM_C" "$1" <<'PYEOF'
|
||||
python3 - "$WATERMARK" "$MUSE_C" "$PIP_C" "$N646_C" "$OPM_C" "$AS_JSON" "$NO_ADVANCE" <<'PYEOF'
|
||||
import json, sys, os
|
||||
|
||||
watermark_path = sys.argv[1]
|
||||
@@ -39,7 +53,8 @@ current = {
|
||||
"646": int(sys.argv[4]),
|
||||
"opm": int(sys.argv[5]),
|
||||
}
|
||||
as_json = len(sys.argv) > 6 and sys.argv[6] == "--json"
|
||||
as_json = len(sys.argv) > 6 and sys.argv[6] == "1"
|
||||
no_advance = len(sys.argv) > 7 and sys.argv[7] == "1"
|
||||
|
||||
# Load watermark (tolerate missing/corrupt file -> treat as all-zero)
|
||||
watermark = {}
|
||||
@@ -73,9 +88,12 @@ else:
|
||||
if not any_new:
|
||||
print("OK: no new errors")
|
||||
|
||||
# Update watermark atomically
|
||||
tmp = watermark_path + ".tmp"
|
||||
with open(tmp, "w") as f:
|
||||
json.dump({"counts": current}, f, indent=2)
|
||||
os.replace(tmp, watermark_path)
|
||||
# Update watermark atomically (skipped in --no-advance peek mode: the
|
||||
# caller gets a read-only view and the CLI's advance-on-read semantics are
|
||||
# left untouched).
|
||||
if not no_advance:
|
||||
tmp = watermark_path + ".tmp"
|
||||
with open(tmp, "w") as f:
|
||||
json.dump({"counts": current}, f, indent=2)
|
||||
os.replace(tmp, watermark_path)
|
||||
PYEOF
|
||||
|
||||
Reference in New Issue
Block a user