@@ -50,8 +50,8 @@ TIMEOUT_UPDATE_POLL_GRACE_S=60
|
50 | 50 | TIMEOUT_VERIFY_S=120 |
51 | 51 | TIMEOUT_ONBOARD_S=600 |
52 | 52 | TIMEOUT_ONBOARD_PHASE_S=$((TIMEOUT_ONBOARD_S + 120)) |
53 | | -# verify_gateway_reachable runs six 30s probes plus short retry sleeps. |
54 | 53 | TIMEOUT_GATEWAY_S=420 |
| 54 | +GATEWAY_RECOVERY_AFTER_S="${OPENCLAW_PARALLELS_WINDOWS_GATEWAY_RECOVERY_AFTER_S:-180}" |
55 | 55 | TIMEOUT_AGENT_S="${OPENCLAW_PARALLELS_WINDOWS_AGENT_TIMEOUT_S:-900}" |
56 | 56 | PHASE_STALE_WARN_S=60 |
57 | 57 | |
@@ -2395,8 +2395,13 @@ verify_gateway() {
|
2395 | 2395 | } |
2396 | 2396 | |
2397 | 2397 | verify_gateway_reachable() { |
2398 | | -local probe_json attempt |
2399 | | -for attempt in 1 2 3 4 5 6; do |
| 2398 | +local probe_json attempt start_seconds deadline recovery_tried |
| 2399 | + start_seconds="$SECONDS" |
| 2400 | + deadline=$((SECONDS + TIMEOUT_GATEWAY_S)) |
| 2401 | + recovery_tried=0 |
| 2402 | + attempt=1 |
| 2403 | + |
| 2404 | +while (( SECONDS < deadline )); do |
2400 | 2405 | probe_json="$( |
2401 | 2406 | guest_run_openclaw "" "" gateway probe --url ws://127.0.0.1:18789 --timeout 30000 --json |
2402 | 2407 | )" |
@@ -2411,11 +2416,25 @@ PY
|
2411 | 2416 | then |
2412 | 2417 | return 0 |
2413 | 2418 | fi |
2414 | | -if (( attempt < 6 )); then |
2415 | | -printf 'gateway-reachable retry %s\n' "$attempt" >&2 |
2416 | | - sleep 3 |
| 2419 | + |
| 2420 | +if [[ "$recovery_tried" -eq 0 && $((SECONDS - start_seconds)) -ge "$GATEWAY_RECOVERY_AFTER_S" ]]; then |
| 2421 | +printf 'gateway-reachable recovery: gateway start after %ss\n' "$((SECONDS - start_seconds))" >&2 |
| 2422 | +if ! run_gateway_daemon_action start; then |
| 2423 | +printf 'gateway-reachable recovery start failed; continuing probes\n' >&2 |
| 2424 | +fi |
| 2425 | + recovery_tried=1 |
2417 | 2426 | fi |
| 2427 | + |
| 2428 | +printf 'gateway-reachable retry %s elapsed=%ss\n' "$attempt" "$((SECONDS - start_seconds))" >&2 |
| 2429 | + attempt=$((attempt + 1)) |
| 2430 | + sleep 5 |
2418 | 2431 | done |
| 2432 | + |
| 2433 | +if [[ "$recovery_tried" -eq 0 ]]; then |
| 2434 | +printf 'gateway-reachable recovery: gateway start after timeout\n' >&2 |
| 2435 | + run_gateway_daemon_action start || true |
| 2436 | +fi |
| 2437 | + |
2419 | 2438 | return 1 |
2420 | 2439 | } |
2421 | 2440 | |
|