Skip to content

Commit 822931f

Browse files
committed
ci(sandbox): poll for running:True in health probe (fix MCP-3236 startup race)
The 'Verify server health' step checked /api/v1/status once, immediately after the start step's readiness loop broke on the first HTTP-200 — but the server responds to /status before it finishes warming up (Bleve index, capability registration), so 'running' was still False and the step failed on CI. Retry for running:True up to 30s before failing. Related #71
1 parent 7b14f79 commit 822931f

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/sandbox-integration.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,21 @@ jobs:
118118
119119
- name: Verify server health under sandbox config
120120
run: |
121-
STATUS=$(curl -sf -H "X-API-Key: qa-sandbox-ci-test" \
122-
http://127.0.0.1:19237/api/v1/status)
123-
echo "$STATUS" | python3 -m json.tool
124-
RUNNING=$(echo "$STATUS" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('running',False))")
121+
# Poll for running:True — the server responds to /status before it
122+
# finishes warming up (Bleve index, capability registration), so a
123+
# single check races against startup. Retry up to 30s.
124+
RUNNING=False
125+
STATUS=""
126+
for i in $(seq 1 30); do
127+
STATUS=$(curl -sf -H "X-API-Key: qa-sandbox-ci-test" \
128+
http://127.0.0.1:19237/api/v1/status 2>/dev/null) || { sleep 1; continue; }
129+
RUNNING=$(echo "$STATUS" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('running',False))" 2>/dev/null || echo False)
130+
[ "$RUNNING" = "True" ] && { echo "Server ready after ${i}s"; break; }
131+
sleep 1
132+
done
133+
echo "$STATUS" | python3 -m json.tool || true
125134
if [ "$RUNNING" != "True" ]; then
126-
echo "ERROR: server not running"
135+
echo "ERROR: server not running (running != True after 30s)"
127136
cat /tmp/mcp3236-ci/server.log
128137
exit 1
129138
fi

0 commit comments

Comments
 (0)