Skip to content

Commit 0291e56

Browse files
ci(065): fix D1 retrieval job — create data_dir + single-step server lifecycle
The retrieval-d1 job failed: `mcpproxy serve` exited immediately with "data_dir: directory does not exist" (serve refuses to create a missing data_dir), and the server was backgrounded in a separate step from the readiness poll (a process backgrounded in one step is reaped when that step's shell exits). Fix: mkdir -p the data_dir, and boot + readiness-poll + run the scorer in ONE step (shared shell) with a trap that stops the server however the step ends; also fail fast if the server process dies during startup. D2 gate unaffected. Verified: mcpproxy boots and serves /api/v1/status locally with the created data_dir; actionlint clean. Related #555 datasets; MCP-742. Co-Authored-By: Paperclip <noreply@paperclip.ing>
1 parent 5eedb33 commit 0291e56

1 file changed

Lines changed: 29 additions & 23 deletions

File tree

.github/workflows/eval.yml

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -131,51 +131,57 @@ jobs:
131131
- name: Build mcpproxy
132132
run: go build -o mcpproxy ./cmd/mcpproxy
133133

134-
- name: Start mcpproxy (7 reference servers)
134+
# Boot, poll and score in ONE step: a server backgrounded in a separate
135+
# step is reaped when that step's shell exits, so start + wait + run must
136+
# share a shell. The trap stops the server however this step ends.
137+
- name: Run D1 retrieval gate (boot mcpproxy + score)
138+
working-directory: ${{ github.workspace }}
139+
env:
140+
DS: ${{ github.workspace }}/specs/065-evaluation-foundation/datasets
135141
run: |
142+
set -uo pipefail
143+
base="http://127.0.0.1:8092"; key="eval-corpus-snapshot"
144+
# data_dir must exist — `serve` refuses to create a missing one.
145+
mkdir -p "$RUNNER_TEMP/eval"
136146
./mcpproxy serve \
137-
--config specs/065-evaluation-foundation/datasets/snapshot-servers.config.json \
147+
--config "$DS/snapshot-servers.config.json" \
138148
--data-dir "$RUNNER_TEMP/eval" \
139149
--listen 127.0.0.1:8092 \
140150
--log-level info > "$RUNNER_TEMP/mcpproxy.log" 2>&1 &
141-
echo "MCPPROXY_PID=$!" >> "$GITHUB_ENV"
151+
server_pid=$!
152+
trap 'kill "$server_pid" 2>/dev/null || true' EXIT
142153
143-
- name: Wait for index readiness
144-
run: |
145-
base="http://127.0.0.1:8092"; key="eval-corpus-snapshot"
154+
ready=0
146155
for i in $(seq 1 60); do
156+
if ! kill -0 "$server_pid" 2>/dev/null; then
157+
echo "::error::mcpproxy process exited during startup"
158+
break
159+
fi
147160
if curl -fsS -H "X-API-Key: $key" "$base/api/v1/status" >/dev/null 2>&1; then
148161
n="$(curl -fsS -H "X-API-Key: $key" "$base/api/v1/index/search?q=file&limit=5" \
149162
| python3 -c 'import sys,json;d=json.load(sys.stdin);print(len(d.get("tools",d.get("results",[]))))' 2>/dev/null || echo 0)"
150163
echo "attempt $i: index search returned $n result(s)"
151-
[ "$n" -ge 1 ] && { echo "Index ready."; exit 0; }
164+
[ "$n" -ge 1 ] && { ready=1; echo "Index ready."; break; }
152165
else
153166
echo "attempt $i: server not up yet"
154167
fi
155168
sleep 5
156169
done
157-
echo "::error::mcpproxy index did not become ready in time"
158-
tail -50 "$RUNNER_TEMP/mcpproxy.log" || true
159-
exit 1
170+
if [ "$ready" != 1 ]; then
171+
echo "::error::mcpproxy index did not become ready in time"
172+
echo "----- mcpproxy.log (tail) -----"; tail -80 "$RUNNER_TEMP/mcpproxy.log" || true
173+
exit 1
174+
fi
160175
161-
- name: Run D1 retrieval gate
162-
working-directory: mcp-eval
163-
env:
164-
DS: ${{ github.workspace }}/specs/065-evaluation-foundation/datasets
165-
run: |
166-
PYTHONPATH=src uv run python -m mcp_eval.cli retrieval \
176+
( cd "$GITHUB_WORKSPACE/mcp-eval" && PYTHONPATH=src uv run python -m mcp_eval.cli retrieval \
167177
--corpus "$DS/corpus_v1.tools.json" \
168178
--golden "$DS/retrieval_golden_v1.json" \
169179
--baseline "$DS/baseline_v1.json" \
170180
--tolerance 0.05 \
171181
--runs 1 \
172-
--base-url http://127.0.0.1:8092 \
173-
--api-key eval-corpus-snapshot \
174-
--out-dir "${{ github.workspace }}/reports/retrieval"
175-
176-
- name: Stop mcpproxy
177-
if: always()
178-
run: kill "${MCPPROXY_PID}" 2>/dev/null || true
182+
--base-url "$base" \
183+
--api-key "$key" \
184+
--out-dir "$GITHUB_WORKSPACE/reports/retrieval" )
179185
180186
- name: Upload D1 reports
181187
if: always()

0 commit comments

Comments
 (0)