Skip to content

Google: thought-signature replay on a non-official route fails with Google's raw 400 instead of an actionable error #6048

Description

@Hmbown

Split out of #6018, where the founder named this gap: "Tracking that separately rather than widening the guard here, since some gateways do handle signatures themselves."

The gap. Thought signatures are captured and replayed only on the exact official Google route (generativelanguage.googleapis.com/v1beta/openai). A Gemini model reached through a hand-configured generic OpenAI-compatible row has the field stripped, so signatures are guaranteed absent there — and that is exactly the case validate_google_thought_signature_replay (crates/tui/src/client/chat.rs:665) skips with an early return Ok(()) for non-official routes. The turn then dies on Google's raw Function call is missing a thought_signature in functionCall parts 400 instead of CodeWhale's actionable error (which on the official route names the model, the tool call, and the recovery: start a new session).

Why not just widen the guard. Some gateways handle signatures themselves, so fail-closed on every non-official route would break working setups. The fix needs to distinguish "this route requires signatures and none exist" from "this gateway manages signatures itself" — e.g. only warn/fail for Gemini model ids on routes that look like Google's endpoint, or surface the hint when Google's 400 arrives rather than pre-flight.

Repro shape. Configure a Gemini thinking model via the generic OpenAI-compatible provider, make a tool call, continue the turn: Google 400s on the missing thought_signature with no CodeWhale-authored guidance. No reasoning setting avoids it — the signature is not a reasoning feature.

Workaround (from #6018). Use the built-in google provider for Gemini, not a hand-configured OpenAI-compatible row.

Activity

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

    bugSomething isn't working

    Projects

    • Status
      In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions