Skip to content

fix(client): explain missing Gemini thought signatures - #6081

Closed
nightt5879 wants to merge 2 commits into
Hmbown:mainfrom
nightt5879:nightt5879/issue-6048-gemini-signature-hint
Closed

fix(client): explain missing Gemini thought signatures#6081
nightt5879 wants to merge 2 commits into
Hmbown:mainfrom
nightt5879:nightt5879/issue-6048-gemini-signature-hint

Conversation

@nightt5879

@nightt5879 nightt5879 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #6048.

When a compatible gateway rejects a Gemini tool-call replay with Function call is missing a thought_signature in functionCall parts, Codewhale now explains how to recover: select the built-in google provider with its default endpoint, or a gateway that preserves signatures, then start a new session.

The existing shared HTTP error formatter applies this guidance to streaming and non-streaming requests only after an explicit missing-signature 400. It retains bounded provider details, preserves quota and HTML handling, and remains safe to format twice. Gateways that manage signatures themselves continue to accept unsigned history.

Thanks to @Hmbown for identifying the missing recovery guidance and the gateway compatibility constraint.

Testing

  • cargo check -p codewhale-tui --lib --locked — passed.
  • cargo fmt --all -- --check, git diff --check, provider registry and dead-code budget checks — passed.
  • Version/changelog synchronization gate and 12 public-copy/changelog tests — passed; changelog edits are reserved for merge time per repository policy.
  • Regression proof with the production change removed: 17 passed, 3 failed, including the real local HTTP request returning the original unhelpful 400.
  • cargo test -p codewhale-tui --lib --all-features --locked -- thought_signature llm_client:: client::chat:: client::tests:: client::responses:: client::anthropic:: --test-threads=1409 passed, 0 failed.
  • Cloud Linux Clippy on Rust 1.98.1 passed. Local full-workspace Clippy on the same toolchain stops on three existing Windows-only warnings in child_env.rs, mcp.rs, and lib.rs; all three files match main. Three-platform CI tests are pending.

The full Linux web CI suite passed all 446 tests. The broader local web suite reached 393 passing tests, with unrelated Windows CRLF/POSIX-path failures. Local Rust tests run with the repository's isolated-home wrapper. Network cases run serially with ambient proxy variables removed from the test subprocess; the unrelated MCP network cases passed under that configuration.

Checklist

  • Preserved report credit under Unreleased; addressed Devin feedback in d585f2d and resolved the review thread. Devin completed its latest-head analysis with no additional threads.
  • Added reproduced-regression coverage, including successful gateway-managed replay.
  • Used existing error handling rather than introducing a new layer.
  • Full workspace Clippy and CI completed.

Devin Review

A compatible gateway can reject unsigned Gemini tool-call history with a
raw missing-thought_signature 400 even though it is allowed through the
official-route preflight guard. Explain the route and new-session recovery
at the shared HTTP error boundary so streaming and non-streaming callers
both receive useful guidance while gateways managing signatures still work.

Keep provider details bounded, preserve quota/HTML handling, and avoid
duplicating guidance when the error is formatted again. Add mocked transport
and error-boundary regressions and record the report in the changelog.

Reported by @Hmbown in Hmbown#6048.

Verified with 409 related tests passing. Removing the production change
fails three recovery regressions, including the mocked HTTP 400 path.

Co-authored-by: Hunter Bown <101357273+Hmbown@users.noreply.github.com>
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
@nightt5879
nightt5879 requested a review from Hmbown as a code owner September 11, 2026 09:13
devin-ai-integration[bot]

This comment was marked as resolved.

Address Devin's review of PR Hmbown#6081 by removing the branch's changelog entry
and generated website mirror. CONTRIBUTING.md reserves those updates for
the merge session on main; all changelog surfaces now match upstream.

Keep the issue Hmbown#6048 report credit under Unreleased in CONTRIBUTORS.md so
the published v0.9.13 contributor list stays in exact website parity.
This also corrects the version-drift and public-copy CI failures.

Verified the 12 changelog/public-copy tests, release version and changelog
sync checks, formatting, and whitespace checks. The implementation and its
409 passing targeted Rust tests are unchanged.

Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
@Hmbown

Hmbown commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix and the transport-level regression coverage. I harvested this into the local 0.9.13 release lane as 157c5e1ea7, preserving your authorship and contributor credit. It replaces the lane's earlier overlapping hint so there is one bounded, idempotent recovery path, including for streaming and non-streaming gateway errors.

The focused run passed all 71 selected tests, including your new transport and sanitization tests. The root npm and web gates also passed. The complete final-head sweep, live terminal verification, and hosted CI still need to finish before publication; this is not yet a released fix.

Hmbown added a commit that referenced this pull request Sep 11, 2026
Adapt the contributor patch onto the existing release fix, retaining one bounded, idempotent recovery hint. Exercise working and rejecting gateways through streaming and non-streaming HTTP transport; preserve quota, HTML, and Google preflight boundaries.

Harvested from PR #6081 by @nightt5879

Validation: 71 focused TUI library tests passed, including gateway transport and error sanitization. npm test passed (66 wrapper, 9 SDK, 446 web); npm run check:web passed with two existing image warnings. Final candidate sweep follows.

Co-authored-by: nightt5879 <87569709+nightt5879@users.noreply.github.com>

Co-authored-by: Hmbown <101357273+Hmbown@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @nightt5879 — your contribution landed in 157c5e1ea736 on main:

fix(client): explain Gemini signature recovery after gateway transport

Closing this PR now that the code is on main. Credit lives in the commit message and (where applicable) the CHANGELOG.md entry for the next release. Apologies for not closing this at the time of the merge — the auto-close workflow is new in v0.8.31.

If you want to land more work and would prefer your future PRs merge cleanly without a harvest step, the CONTRIBUTING.md doc has a short note on what makes a contribution mergeable as-is.

@github-actions github-actions Bot closed this Sep 11, 2026
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.

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

2 participants