Skip to content

fix: resolve Gemini history image references - #9874

Merged
Soulter merged 1 commit into
AstrBotDevs:masterfrom
SunmiJJW:codex/fix-gemini-local-image-history
Aug 31, 2026
Merged

fix: resolve Gemini history image references#9874
Soulter merged 1 commit into
AstrBotDevs:masterfrom
SunmiJJW:codex/fix-gemini-local-image-history

Conversation

@SunmiJJW

@SunmiJJW SunmiJJW commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Gemini conversation history can contain image references accepted by AstrBot's shared media resolver, including local paths. The adapter's history converter still assumed every image was a base64 data URI, so a local history image raised before the provider request and triggered fallback.

Modifications / 改动点

  • Resolve Gemini history image references through the existing shared media resolver.

  • Make conversation preparation asynchronous and await it in both streaming and non-streaming request paths.

  • Add a regression test for a local WebP history image and update existing conversation tests for the async preparation path.

  • No new dependencies.

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Verification steps / 验证步骤

  1. Run: python -m pytest -q tests/test_gemini_source.py
  2. Run Ruff check and format check for the two changed files.
  3. Compile gemini_source.py.

Test results / 运行结果

  • Gemini provider tests: 7 passed.
  • Ruff check: passed.
  • Ruff format check: passed.
  • Compile check: passed.

Checklist / 检查清单

  • This is a bug fix, not a new feature.
  • My changes have been well-tested, and verification steps/results are provided above.
  • No new dependencies are introduced.
  • My changes do not introduce malicious code.

Summary by Sourcery

Fix Gemini history image handling so supported media references are resolved before provider requests.

Bug Fixes:

  • Resolve image references in Gemini conversation history through the shared media resolver, including local image paths, instead of assuming base64 data URIs.

Enhancements:

  • Make Gemini conversation preparation asynchronous and await it for both streaming and non-streaming requests.

Tests:

  • Add regression coverage for resolving a local WebP history image and update conversation preparation tests for asynchronous execution.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. labels Aug 30, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T07:46:15.005294Z 88768d0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Soulter
Soulter merged commit 5aca0c9 into AstrBotDevs:master Aug 31, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants