Repository navigation
[build-tools] Wait up to 90 seconds for the first ngrok tunnel open - #5001
Closed
szdziedzic wants to merge 1 commit into
Closed
szdziedzic wants to merge 1 commit into
szdziedzic wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
✅ Thank you for adding a changeset! |
| // settles. The first open waits longer instead, and keeps a listener that arrives late. | ||
| // An open usually takes less than 1 second. When ngrok is slow, most slow opens finish after | ||
| // about 75 seconds, so the first open waits for them instead of failing the session. | ||
| export const FIRST_OPEN_TIMEOUT_MS = 90_000; |
There was a problem hiding this comment.
🔍 Queued opens share the startup budget
Cold agent-device startup waits for both tunnels, but openAsync starts timing before ngrok acquires its shared lock. The single-tunnel test misses time spent behind a slow first open.
Was this helpful? React with 👍 or 👎 to provide feedback.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5001 +/- ##
==========================================
+ Coverage 77.91% 77.91% +0.01%
==========================================
Files 1146 1146
Lines 58697 58701 +4
Branches 13045 13045
==========================================
+ Hits 45728 45732 +4
+ Misses 12849 11990 -859
- Partials 120 979 +859 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Since 11:50 UTC on 30 Nov, ngrok tunnel opens for device run sessions are often slow. Before that, the slowest open in each 10 minutes took 0.5–0.7 s. During the incident, about 1 in 6 opens did not finish within our timeout. At least 14 iOS sessions failed with
Ngrok tunnel open timed out after 19000msbefore the simulator became available.The
late_openmetric shows when a timed-out open finally finishes. On 30 Nov, slow opens finished after 64–77 s on average, and the slowest took 142 s. In four earlier episodes (27 Nov, 28 Nov, 30 Nov 00:00 UTC), the slowest open took about 75.5 s each time. So a 19 s first-open timeout fails sessions whose tunnel would open a minute later.How
FIRST_OPEN_TIMEOUT_MSinngrokTunnel.tsfrom 19 s to 90 s. Retries and reopens keep their 15 s timeout.INITIAL_OPEN_MAX_DURATION_MS(123 s): the first open plus both retries and their delays.deviceSessionHost.tswas the host'stimeoutMs(60 s for agent-device, web preview and Argent). It is now the larger oftimeoutMsandINITIAL_OPEN_MAX_DURATION_MS.STARTUP_TIMEOUT_MSdoes not change, so the daemon and readiness waits keep their limits.All tunnels get the longer first open: web-preview, agent-device, egress, Argent and Appium. Only the preview tunnel had an outer limit. The CLI's 120 s local egress limit starts after the session is ready, so it does not overlap the egress tunnel's first open.
Trade-off: when an open never finishes, the session now fails after about 90 s instead of about 20 s. On normal days opens take less than 1 s, so nothing changes.
Test Plan
ngrokTunnel.test.ts).deviceSessionHost.test.ts). This replaces theopening timeoutcase of the shared cleanup test: the host's preview limit no longer fires while the ngrok open is pending, so cleanup does not wait for it.FIRST_OPEN_TIMEOUT_MS.yarn jest-unitinpackages/build-tools: 3290 passed, 8 skipped.yarn fmt:check,yarn lint,yarn typecheckpass.expo.www.eas.device_run_session.ngrok_tunnel.late_openstays near zero during slow periods and that sessions stop failing withNgrok tunnel open timed out.🤖 Generated with Claude Code