@jonit-dev/night-watch-cli 1.8.10-beta.4 → 1.8.10-beta.5

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.
@@ -565,6 +565,15 @@ while [ "${ATTEMPT}" -lt "${MAX_RETRIES}" ]; do
565
565
  BACKOFF_MIN=$(( BACKOFF / 60 ))
566
566
  log "RATE-LIMITED: Attempt ${ATTEMPT}/${MAX_RETRIES}, retrying in ${BACKOFF_MIN}m"
567
567
  sleep "${BACKOFF}"
568
+ elif check_network_error "${LOG_FILE}" "${LOG_LINE_BEFORE}"; then
569
+ # Transient API network error — retry with a short backoff
570
+ ATTEMPT=$((ATTEMPT + 1))
571
+ if [ "${ATTEMPT}" -ge "${MAX_RETRIES}" ]; then
572
+ log "NETWORK-ERROR: All ${MAX_RETRIES} attempts exhausted for ${ELIGIBLE_PRD}"
573
+ break
574
+ fi
575
+ log "NETWORK-ERROR: Attempt ${ATTEMPT}/${MAX_RETRIES}, retrying in 60s"
576
+ sleep 60
568
577
  elif check_context_exhausted "${LOG_FILE}" "${LOG_LINE_BEFORE}"; then
569
578
  # Context window exhausted — checkpoint progress and resume in a fresh session
570
579
  ATTEMPT=$((ATTEMPT + 1))
@@ -847,6 +847,19 @@ check_rate_limited() {
847
847
  fi
848
848
  }
849
849
 
850
+ # Detect transient API network errors (e.g. "Network error" in a 400 response).
851
+ # Usage: check_network_error <log_file> [start_line]
852
+ # Returns 0 if a network error was detected, 1 otherwise.
853
+ check_network_error() {
854
+ local log_file="${1:?log_file required}"
855
+ local start_line="${2:-0}"
856
+ if [ "${start_line}" -gt 0 ] 2>/dev/null; then
857
+ tail -n "+$((start_line + 1))" "${log_file}" 2>/dev/null | grep -qi "Network error"
858
+ else
859
+ tail -20 "${log_file}" 2>/dev/null | grep -qi "Network error"
860
+ fi
861
+ }
862
+
850
863
  # Detect context window exhaustion from Claude API logs.
851
864
  # Usage: check_context_exhausted <log_file> [start_line]
852
865
  # Returns 0 if context exhausted, 1 otherwise.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonit-dev/night-watch-cli",
3
- "version": "1.8.10-beta.4",
3
+ "version": "1.8.10-beta.5",
4
4
  "description": "AI agent that implements your specs, opens PRs, and reviews code overnight. Queue GitHub issues or PRDs, wake up to pull requests.",
5
5
  "type": "module",
6
6
  "bin": {