Skip to content

fix(google): keep Claude tool results contiguous before images - #7303

Closed
yuanyuanlove wants to merge 1 commit into
lidge-jun:devfrom
yuanyuanlove:bugfix-20261018-antigravity-image-results
Closed

yuanyuanlove wants to merge 1 commit into
lidge-jun:devfrom
yuanyuanlove:bugfix-20261018-antigravity-image-results

Conversation

@yuanyuanlove

@yuanyuanlove yuanyuanlove commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix image-bearing parallel tool-result serialization for Claude on Antigravity. Keep the complete functionResponse batch contiguous, followed by the existing image parts in the same user turn. Preserve all text, image bytes, call IDs and call order; do not serialize tool execution or drop images.

A real Pi conversation reproducibly failed with HTTP 400 claiming that two tool results were missing, although all three results were present. A direct upstream A/B experiment used the same account and identical request parts (verified as a multiset), changing only their order:

  • result A, image A, result B, image B, result C: HTTP 400, missing results B/C.
  • result A, result B, result C, image A, image B: HTTP 200, stream finished with STOP and no error events.

The experiment established protocol acceptance, not successful completion of the original UI review. No private conversation text, images, credentials or original request IDs are included in this PR. The running local installation is unchanged.

Verification

  • Regression-first: bun test tests/adapters/google/google-tool-result-adjacency.test.ts failed on the unmodified implementation: 16 passed / 8 failed. All eight ordering cases turned green after the fix.
  • Focused adapter checks: bun test tests/adapters/google/{google-tool-result-adjacency,google-vertex-thought-signature,google-adapter,google-empty-content,google-claude-prefill-guard,google-antigravity-wire,google-antigravity-replay}.test.ts: 268 passed / 0 failed.
  • The actual candidate adapter also replayed the original history directly upstream: HTTP 200, terminal STOP, no error events, both images preserved. No tool execution was performed.
  • bun run typecheck: passed using a working Node executable on the test process PATH (the host Homebrew Node has a missing simdutf dynamic library).
  • bun run privacy:scan, bun run structure:check, bun scripts/file-size-ratchet.ts, git diff --check: passed.
  • bun run test:changed with the repository-pinned Bun 1.4.3 selected 732 files: 17,797 passed / 34 skipped / 57 failed. The first attempt also encountered the broken host Node and inherited proxy variables. This broad run is not claimed green.
  • Re-ran all nine failing files plus the ordering regression with HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY (and lowercase equivalents) removed only from the test process environment: 204 passed / 1 skipped / 1 failed across 10 files. The remaining failure is tests/cli/cli-connect-readiness.test.ts, “a rejected preferred runtime falls back without rewriting the saved selection”: expected two debug models --bundled probes after --version, received only --version.
  • Confirmed the identical CLI failure in a clean, unmodified worktree at upstream 8640c2f30edbd2fbb6947ed5c25e2793f5ae72a6: 26 passed / 1 skipped / 1 failed. It is not introduced by this patch. Keeping this PR draft, with that known baseline failure explicitly disclosed.
  • Full repository suite not run: the targeted impact run already exercised ~18k tests; the remaining full-suite/cross-platform coverage is left to CI. No claim of merge readiness.

Scope: only CCA routed claude-* models change. Tests preserve CCA Gemini/other models, AI Studio, non-Argon Vertex sibling layout, and Vertex Argon nested image layout. No retries, permissions, authentication, execution scheduling, or configuration changes.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. No authentication or permission behavior changes.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ⬜ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

@Ingwannu

Ingwannu commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Scoped review at 3243687ad4: batching matched functionResponse parts before sibling images is restricted to CCA routed claude-* models, while the added final-envelope tests preserve reversed result matching, image bytes and other Google route layouts. Keep the disclosed broad-run failures, the clean-baseline CLI failure and the focused adapter receipt separate; the baseline failure does not justify rewriting unrelated CLI behavior here. Current-head pull_request CI requires maintainer execution approval (Cross-platform CI run 39115402848 is action_required); quality/bot success is not functional Ubuntu coverage. Actual CCA acceptance is the author's reported experiment and native platforms were not exercised by this review. No objection to the narrow ordering direction from this static pass; the author-controlled Draft/readiness decision and merge review remain separate.

@lidge-jun

Copy link
Copy Markdown
Owner

Carried into #7394 (squash 74463a2) on dev with a Co-authored-by trailer, as part of the B4 provider-adapter bundle. It ships in the next release (2.90.0). Thanks!

@lidge-jun lidge-jun closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants