Skip to content

fix(explorer): retry Gemini candidates with empty content parts - #236

Open
ferdy252 wants to merge 1 commit into
google:mainfrom
ferdy252:fix/explorer-empty-gemini-content
Open

ferdy252 wants to merge 1 commit into
google:mainfrom
ferdy252:fix/explorer-empty-gemini-content

Conversation

@ferdy252

@ferdy252 ferdy252 commented Nov 6, 2026

Copy link
Copy Markdown

Fixes #230.

A native Gemini reply can contain a truthy Content object with parts=None or parts=[]. Explorer currently appends that object to history: the next turn either crashes while pruning images or sends an empty model turn back to Gemini. Treat these replies like missing content and reuse the existing synthetic model text and retry reminder. Valid model content and turn limits retain their existing behavior.

Add regression coverage through the real google-genai client with an httpx.MockTransport. The tests cover omitted parts, empty content with MALFORMED_FUNCTION_CALL, and an empty parts list in both Pro and Ultra, plus missing-content and plain-text controls. They verify successful recovery and the serialized retry request without a device, credentials, or live API calls. Thanks to @swf1996120 for the report and reproduction.

Validation on Windows, Python 3.12.13, using the frozen development environment:

  • New regression cases before the fix: 6 failed, 4 passed.
  • uv run --frozen pytest tests/unit/agents/test_explorer_tiers.py -q: 40 passed.
  • ruff format --check ., ruff check ., scripts/quality_ratchet.py, scripts/check_dependency_sources.py, and pyright --project pyright-core.json: passed (run via uv run --frozen).

The full deterministic suite was also executed on this branch and on an untouched worktree at 351ca8422f7b5b54e80a9c1ce03a222e02415b6b, using the same environment:

Checkout Passed Failed Errors Skipped Deselected
Untouched main 2,441 83 0 9 8
This branch 2,450 84 1 9 8

There are 82 shared failing tests, mainly missing-credential and mock-provider configuration errors. The four differing test IDs concern background persistence/thread timing or Windows SQLite cleanup, outside this change. Sequential reruns of those four test bodies passed on both checkouts; the SQLite teardown error also reproduced on untouched main. The full suite is therefore not green in this environment. All added cases pass in the full run.

Live Gemini and Android-device execution were not performed. AI-assisted implementation and testing using OpenAI Codex.

@google-cla

google-cla Bot commented Nov 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

Explorer: a Gemini candidate with no parts ends the lookup instead of retrying

1 participant