Skip to content

fix(benchmark): gemini stream-json content/stats parse (#2159)#2221

Open
time-attack wants to merge 4 commits into
garrytan:mainfrom
time-attack:fix-gstack-issue
Open

fix(benchmark): gemini stream-json content/stats parse (#2159)#2221
time-attack wants to merge 4 commits into
garrytan:mainfrom
time-attack:fix-gstack-issue

Conversation

@time-attack

@time-attack time-attack commented Jul 10, 2026

Copy link
Copy Markdown

Summary

Fixes #2159: GeminiAdapter was reading legacy message.text / result.usage, so current gemini CLI content + stats events produced empty output, 0 tokens, and no error — a silent $0 success that mis-ranked gemini in benchmark tables.

  • Parse message.content when role === 'assistant' (ignore user-prompt echoes); keep legacy text fallback
  • Read tokens from result.stats with legacy usage fallbacks; model from init
  • Empty exit-0 output → error row (not a $0 success)
  • --skip-trust for headless/temp workdirs (required by current gemini CLI)
  • Recognize GEMINI_API_KEY; map IneligibleTier / auth failures cleanly
  • Unit + post-CLI fixture tests; live-verified with API key (3/3 probes)

No VERSION / CHANGELOG / package.json bump — leaving release metadata to maintainers.

Test plan

  • bun test test/helpers/providers/gemini.test.ts (+ related free tests)
  • Live: 3 separate GeminiAdapter.run() instances → real PONG/ALPHA/OK READY, positive tokens, no error
  • Optional: gstack-model-benchmark --prompt 'Reply with exactly the word: PONG' --models gemini --output json

Closes #2159

time-attack and others added 2 commits July 10, 2026 09:28
GeminiAdapter was reading message.text and result.usage, so current CLI
content/stats events produced empty $0 success rows. Accept content with
an assistant role guard, stats token fallbacks, init model, and treat
empty exit-0 output as an error (garrytan#2159).

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@trunk-io

trunk-io Bot commented Jul 10, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

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

time-attack and others added 2 commits July 10, 2026 09:38
Exercise resultFromGeminiStream against current stream-json fixtures
(including empty-success hardening). Recognize GEMINI_API_KEY and map
IneligibleTierError to auth — personal OAuth free-tier is no longer
supported by gemini CLI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Pass --skip-trust so temp/untrusted workdirs work in headless
benchmarks (mirrors Codex --skip-git-repo-check). Revert VERSION,
CHANGELOG, and package.json bumps — leave release bookkeeping to
maintainers / /ship, matching community PR practice.

Co-authored-by: Cursor <cursoragent@cursor.com>
@time-attack time-attack changed the title v1.60.2.0 fix: gemini benchmark stream-json content/stats parse (#2159) fix(benchmark): gemini stream-json content/stats parse (#2159) Jul 10, 2026
@time-attack

Copy link
Copy Markdown
Author

basically gemini updated their cli so we had to adjust to that. Google has stated they will switch to anti gravity for cli and depreciate later but the current version is not compatible with model benchmark, when google does the full migration we can handle that

@time-attack

Copy link
Copy Markdown
Author

/trunk merge

@trunk-io

trunk-io Bot commented Jul 10, 2026

Copy link
Copy Markdown

An error occurred while submitting your PR to the queue: Only users that are a part of this repo's Trunk organization or have write permissions to the repo can submit a PR to the queue

@time-attack

Copy link
Copy Markdown
Author

@16francej

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.

benchmark-models: GeminiAdapter.parseStreamJson reads obj.text but current gemini CLI emits obj.content — empty runs row as $0 success

1 participant