v1.57.7.0 fix(ios-qa): sliding tunnel cache so device sessions survive past 30s#1919
Closed
sternryan wants to merge 1 commit into
Closed
v1.57.7.0 fix(ios-qa): sliding tunnel cache so device sessions survive past 30s#1919sternryan wants to merge 1 commit into
sternryan wants to merge 1 commit into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
The daemon cached the CoreDevice tunnel for a flat 30s from bootstrap and never refreshed the timer on use. A vision-driven agent loop that pauses to read a screenshot and decide the next action exceeds 30s, the cache expires, and getTunnel re-bootstraps. Re-bootstrap then fails permanently with boot_token_unavailable because StateServer deletes the on-disk boot token at /auth/rotate (StateServer.swift) — recovery requires a cold app relaunch. Make the cache a sliding idle-timeout: refresh cachedTunnelAt on every reuse so an active session keeps its live tunnel + rotated bearer. Default idle window 5 min (was 30s), overridable via GSTACK_IOS_TUNNEL_CACHE_MS. No security change: the boot token still dies at rotate. Adds a regression test asserting a burst of requests bootstraps exactly once.
sternryan
force-pushed
the
fix/ios-qa-sliding-tunnel-cache
branch
from
July 1, 2026 20:50
d1cca02 to
71e044a
Compare
Contributor
Author
|
Rebased onto current main to clear the conflict — the PR is now mergeable. The only conflict was a stale |
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.
What
Make the iOS QA daemon's device-tunnel cache a sliding idle-timeout instead of a flat 30s window, with a configurable default.
Why
getTunnel()inios-qa/daemon/src/index.tscached the CoreDevice tunnel for a flat 30s measured from bootstrap, and never refreshed the timer on use. A vision-driven agent loop (/ios-qa) reads a screenshot, reasons, then taps — that round trip routinely exceeds 30s. When the cache expires the daemon re-bootstraps, but re-bootstrap can't succeed against a still-running app:StateServerdeletes its on-disk boot token at/auth/rotate(templates/StateServer.swift.template→removeItem(atPath: bootTokenPath)), sobootstrapTunnelfails withboot_token_unavailableuntil the app is cold-relaunched.Observed live: the bridge died roughly every 30 seconds mid-session and could only recover by killing + relaunching the app on the device.
Fix
Refresh
cachedTunnelAton every cache hit (sliding idle-timeout), so an active session holds the same live tunnel and rotated bearer for as long as it keeps working. Default idle window raised to 5 min (covers reason-then-act gaps) and made configurable viaGSTACK_IOS_TUNNEL_CACHE_MS. No security change — the boot token still dies at rotate; this only avoids needless re-bootstrap of a healthy tunnel.The default bump (30s → 5min) is the debatable knob; with the sliding behavior even a short default survives active use, but the reason-then-act gap between requests is what needs the longer window. Easy to dial back if you'd prefer.
Test
Adds a regression test in
daemon-integration.test.tsasserting a burst of requests bootstraps the tunnel exactly once.bun test test/daemon-integration.test.ts→ 5 pass, 0 fail.Notes
daemon-integration.test.tsimportsafterEachat the bottom of the file, and thetailnet listenerdescribe block errors withafterEach is not a functionunder bun — reproduces onmainverbatim, so that block's tests don't run. Worth a separate fix (move the import to the top).