tao-shen Claude Opus 4.6 commited on
Commit
5f20dc1
·
1 Parent(s): e6586a2

fix: accept 302 redirect as healthy in OpenClaw health check

Browse files

The token-redirect module returns 302 on GET /, which caused
the health check to report 'error' instead of 'idle'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/a2a-proxy.cjs +6 -4
scripts/a2a-proxy.cjs CHANGED
@@ -123,13 +123,15 @@ async function pollOpenClawHealth() {
123
  const controller = new AbortController();
124
  const timeout = setTimeout(() => controller.abort(), 5000);
125
  const resp = await fetch(`http://127.0.0.1:${OPENCLAW_PORT}/`, {
126
- signal: controller.signal
 
127
  });
128
  clearTimeout(timeout);
 
129
  currentState = {
130
- state: resp.ok ? 'idle' : 'error',
131
- detail: resp.ok ? `${AGENT_NAME} is running` : `HTTP ${resp.status}`,
132
- progress: resp.ok ? 100 : 0,
133
  updated_at: new Date().toISOString()
134
  };
135
  } catch (_) {
 
123
  const controller = new AbortController();
124
  const timeout = setTimeout(() => controller.abort(), 5000);
125
  const resp = await fetch(`http://127.0.0.1:${OPENCLAW_PORT}/`, {
126
+ signal: controller.signal,
127
+ redirect: 'manual'
128
  });
129
  clearTimeout(timeout);
130
+ const isUp = resp.ok || resp.status === 302;
131
  currentState = {
132
+ state: isUp ? 'idle' : 'error',
133
+ detail: isUp ? `${AGENT_NAME} is running` : `HTTP ${resp.status}`,
134
+ progress: isUp ? 100 : 0,
135
  updated_at: new Date().toISOString()
136
  };
137
  } catch (_) {