Skip to content

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

Closed

Description

@WillTaylor3698

Symptom

gstack-model-benchmark --models gemini returns output: "", tokens 0/0, costUsd 0 with NO error field — the row looks like a successful $0 run, silently mis-ranking gemini in any comparison table.

Root cause

test/helpers/providers/gemini.ts parseStreamJson reads assistant text via:

if (obj.type === 'message' && typeof obj.text === 'string') { output += obj.text; }

but current gemini CLI --output-format stream-json emits content (with role), not text:

{"type":"message","role":"assistant","content":"PONG","delta":true}
{"type":"result","status":"success","stats":{"input_tokens":19920,"output_tokens":32,...}}

Tokens are likewise under result.stats (input_tokens/output_tokens), not result.usage.input_token_count; the model name arrives on the init event.

Note test/helpers/gemini-session-runner.ts was already updated to read event.content (with the role === 'assistant' guard) — the benchmark provider adapter was missed.

Repro

gstack-model-benchmark --prompt 'Reply with exactly the word: PONG' --models gemini --output json on gemini CLI ≥ 0.x current (emits content-shape events). Verified on v1.58.5.0.

Suggested fix (verified locally)

Additive fallbacks in parseStreamJson: accept obj.content when obj.role === 'assistant' (the role guard matters — the CLI echoes the user prompt as a role:'user' message event, which would otherwise concat into output); obj.usage ?? obj.stats with input_tokens/output_tokens fallbacks; read modelUsed from init. With that patch the same probe returns output: 'PONG', tokens 24946/32.

Hardening ask

Independent of the field fix: an adapter run that produces EMPTY output with exit 0 should surface as an error row (or a loud flag), never a $0-success row — empty-success is indistinguishable from a healthy cheap run in the table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions