ci: Test with Deno (PR Preview) hangs for 18m and fails with 408 Request Timeout on esm.sh
Describe the bug
In .github/workflows/typescript-pr-preview.yml, the Test with Deno (PR Preview) job frequently hangs for ~18 minutes and fails across PRs (e.g. #2488, #2498, and Dependabot PRs) due to an external 408 Request Timeout on esm.sh when attempting to fetch the ephemeral preview package published to pkg.pr.new.
Even when all 34 core test suites (TypeScript Conformance Tests v2, TypeDoc validation, unit/integration test suites on Ubuntu and Windows, Knip, lint, build, changesets) pass 100% green, the overall PR check status is marked with a red failure because of this external third-party CDN timeout.
Evidence across Recent PRs & Workflow Runs
- PR #2488 (Run 34364889325 & Run 34368728244):
- 34 of 35 checks passed.
Test with Deno (PR Preview)hung for 17m 51s and failed with408 Request Timeout.
- PR #2498 (Run 34370061707):
- Core maintainer PR faced the same 18-minute hang in
Wait for esm.sh to pick up the package.
- Core maintainer PR faced the same 18-minute hang in
- Dependabot PRs (Run 34337582315):
- Failed with the same preview package fetch timeout.
Failure Log:
Waiting for esm.sh to pick up the preview package...
Checking URLs:
PR URL: https://esm.sh/pr/mcp-use/mcp-use@2488
Commit URL: https://esm.sh/pr/mcp-use/mcp-use@fe032de
Waiting for packages... (attempt 1/10, PR: false, Commit: false)
...
Waiting for packages... (attempt 10/10, PR: false, Commit: false)
⚠️ Packages didn't become fully available after 10 attempts (5 minutes)
PR URL ready: false
Commit URL ready: false
Proceeding with tests anyway...
Pre-caching Deno dependencies to avoid download timeouts during tests...
Cache attempt 1/3...
...
⚠️ Failed to cache after 3 attempts
Proceeding with tests anyway - they may download dependencies on demand...
Running Deno tests against PR #2488 preview packages...
Download https://esm.sh/pr/mcp-use/mcp-use@fe032de?no-dts&external=zod
error: Import 'https://esm.sh/pr/mcp-use/mcp-use@fe032de?no-dts&external=zod' failed: 408 Request Timeout
at file:///home/runner/work/mcp-use/mcp-use/libraries/typescript/packages/server/tests/deno/basic-server.test.ts:1:27
##[error]Process completed with exit code 1.Root Cause Analysis
curl -s -f -IsendsHEADrequests: In.github/workflows/typescript-pr-preview.yml:123:Theif curl -s -f -I "$PR_URL" > /dev/null 2>&1; then-Iflag issues an HTTPHEADrequest.esm.shdoes not trigger background compilation onHEADrequests, so the polling loop loops for 5 minutes without ever starting the build worker.- On-Demand Bundler Timeout:
When
deno testsubsequently initiates an HTTPGETforhttps://esm.sh/pr/mcp-use/mcp-use@<hash>?no-dts&external=zod,esm.shattempts a cold build of the multi-packagemcp-usebundle. This cold build frequently exceeds the 30-second gateway timeout, returning408 Request Timeout. - No
continue-on-error: trueon Advisory Preview Tests: Testing preview packages published to ephemeral 3rd-party CDNs is an advisory/preview smoke check. When an external CDN times out, it should not fail the overall pull request status check when all unit, integration, and conformance tests pass. - Missing Graceful Fallback:
When the 5-minute polling loop times out and packages are marked
PR: false, Commit: false, the script logsProceeding with tests anyway...and runsdeno test, which is guaranteed to fail immediately.
Expected behavior
- Advisory PR preview tests on external CDNs should not fail PR status checks when the external CDN times out or experiences high queue latency.
- The polling step should use
GETto actually warm/trigger theesm.shbuild worker. - If packages do not become available after the retry timeout, the job should skip
deno testgracefully rather than exiting with code 1.
Proposed Fix
In .github/workflows/typescript-pr-preview.yml:
deno-test:
name: Test with Deno (PR Preview)
runs-on: ubuntu-latest
needs: preview
+ continue-on-error: true
steps:
...
- name: Wait for esm.sh to pick up the package
run: |
...
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
if [ "$PR_READY" = false ]; then
- if curl -s -f -I "$PR_URL" > /dev/null 2>&1; then
+ if curl -s -f -r 0-0 "$PR_URL" > /dev/null 2>&1; then
echo "✅ PR URL is available"
PR_READY=true
fi
fi
if [ "$COMMIT_READY" = false ]; then
- if curl -s -f -I "$COMMIT_URL" > /dev/null 2>&1; then
+ if curl -s -f -r 0-0 "$COMMIT_URL" > /dev/null 2>&1; then
echo "✅ Commit URL is available"
COMMIT_READY=true
fi
fi
...
done
+ echo "ready=$([ "$PR_READY" = true ] && [ "$COMMIT_READY" = true ] && echo "true" || echo "false")" >> $GITHUB_ENV
+
+ - name: Cache Deno Dependencies
+ if: env.ready == 'true'
+ ...
+ - name: Run Deno Tests
+ if: env.ready == 'true'
+ ...Source: mcp-use/mcp-use