Skip to content

fix: retry Gemini timeouts and transient server errors in visual tests - #40

Merged
kikoso merged 1 commit into
mainfrom
fix/gemini-timeout-retry
Dec 2, 2026
Merged

kikoso merged 1 commit into
mainfrom
fix/gemini-timeout-retry

Conversation

@kikoso

@kikoso kikoso commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

VisualMapSampleTest.verifyStoreLocatorMapRendering fails whenever Gemini is slow or busy, on any PR and on main. On Dec 2 the instrumentation job failed four times in a row: once with 503 UNAVAILABLE ("This model is currently experiencing high demand") and three times with HttpRequestTimeoutException after 60 seconds. A workflow_dispatch run on main at the same time as one on #39 failed the same way, so the cause is Gemini latency, not the code under test.

Root cause

GeminiVisualTestHelper.executeWithRetry only retried 429 and 503, with a short linear backoff, and never retried a timeout. A request timeout escaped from client.post and failed the test on the first slow response.

Changes

  • Retry request timeouts and other network IOExceptions, 429, and any 5xx. Other statuses such as 400 still fail immediately.
  • Exponential backoff (2s, then 4s) and no wait after the last attempt. Three attempts in total, as before.
  • Raise the default request timeout from 60 to 120 seconds.
  • Add GeminiRetryTest covering timeout, 5xx and 429 retries, giving up after the last attempt, and no retry on 400.

No public API change (apiCheck passes).

Verification

  • ./gradlew spotlessCheck :visual-testing:testDebugUnitTest :visual-testing:apiCheck :visual-testing:lintDebug --rerun-tasks --no-build-cache passes (36 tests, 7 new).
  • The emulator job on this PR exercises the live Gemini path.

Request timeouts escaped executeWithRetry and only 429/503 were retried, so a slow or busy Gemini failed visual tests on any PR. Retry timeouts, network errors, 429 and 5xx with exponential backoff, and raise the request timeout to 120 seconds.
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Coverage (unit tests)

No unit baseline recorded in coverage/history.csv yet, so this run only reports absolute numbers.

Module Line % Change Branch % Change
golden-testing 90.42% new 58.00% new
maps3d-robolectric-testing 71.65% new 50.94% new
robolectric-testing 84.25% new 51.87% new
visual-testing 66.56% new 39.03% new
TOTAL 80.76% new 48.54% new

Line and branch coverage from unit test reports. History is recorded in coverage/history.csv after each merge to main.

@LoyalAbbas LoyalAbbas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kikoso
kikoso merged commit ac814df into main Dec 2, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants