-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(onboard): retry transient inference smoke #5932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -610,21 +610,40 @@ section "Phase 5: Live inference" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ── Test 5a: Direct hosted inference endpoint ── | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| info "[LIVE] Direct API test → ${HOSTED_INFERENCE_BASE_URL}..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_response=$(curl -s --max-time 30 \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -X POST "${HOSTED_INFERENCE_BASE_URL}/chat/completions" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -H "Content-Type: application/json" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -H "Authorization: Bearer $HOSTED_INFERENCE_KEY" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -d "$(printf '{"model":"%s","messages":[{"role":"user","content":"Reply with exactly one word: PONG"}],"max_tokens":100}' "$HOSTED_INFERENCE_MODEL")" 2>/dev/null) || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$api_response" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_content=$(echo "$api_response" | parse_chat_content 2>/dev/null) || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_response="" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_content="" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_failure_summary="" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for attempt in 1 2 3; do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| max_tokens=1024 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$attempt" -eq 1 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| max_tokens=256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_response_file="$(mktemp)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_http_status="$(curl -sS --max-time 90 \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -o "$api_response_file" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -w "%{http_code}" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -X POST "${HOSTED_INFERENCE_BASE_URL}/chat/completions" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -H "Content-Type: application/json" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -H "Authorization: Bearer $HOSTED_INFERENCE_KEY" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -d "$(printf '{"model":"%s","messages":[{"role":"user","content":"Reply with exactly one word: PONG"}],"max_tokens":%s}' "$HOSTED_INFERENCE_MODEL" "$max_tokens")" 2>/dev/null || true)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_response="$(cat "$api_response_file" 2>/dev/null || true)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -f "$api_response_file" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ -n "$api_http_status" ] || api_http_status="000" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_content="$(printf '%s' "$api_response" | parse_chat_content 2>/dev/null || true)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| api_failure_summary="response without PONG (HTTP ${api_http_status: -3}, chars=${#api_response})" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if grep -qi "PONG" <<<"$api_content"; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pass "[LIVE] Direct API: model responded with PONG" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail "[LIVE] Direct API: expected PONG, got: ${api_content:0:200}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$attempt" -lt 3 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| info "[LIVE] Direct API attempt ${attempt}/3 ${api_failure_summary}; retrying..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sleep $((5 * attempt)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if grep -qi "PONG" <<<"$api_content"; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pass "[LIVE] Direct API: model responded with PONG" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+632
to
+644
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Require an exact Lines 634 and 643 currently pass on any parsed text that merely contains As per path instructions, tests should “prefer observable outcomes through the public boundary” and flag “conditionals that make a test pass without exercising its claim.” Suggested change- if grep -qi "PONG" <<<"$api_content"; then
+ if printf '%s\n' "$api_content" | grep -Eqix 'PONG'; then
break
fi
@@
-if grep -qi "PONG" <<<"$api_content"; then
+if printf '%s\n' "$api_content" | grep -Eqix 'PONG'; then
pass "[LIVE] Direct API: model responded with PONG"
else
fail "[LIVE] Direct API: expected PONG after 3 attempts; ${api_failure_summary}"
fi📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail "[LIVE] Direct API: empty response from curl" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail "[LIVE] Direct API: expected PONG after 3 attempts; ${api_failure_summary}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ── Test 5b: Inference through the sandbox (THE definitive test) ── | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.