A test, no code change. plugins#734 says the plugin path (gcp-ai,
@ai-sdk/google) skips the gateway's Gemini history rules. It doesn't: a
plugin's @ai-sdk/google model is spoken to on CodeAssist
(pluginProtocol), built by buildCodeAssistSent and unwrapped by
pluginFetch, so the trailing-model user turn and the
functionResponse/text split reach it. TestPluginGeminiNeverAskedEndingWithModel
holds that end to end through the fake plugin with FAKE-style
@ai-sdk/google model fake-gemini and a vendor answering as Vertex does
(vertexTurnsAway): Codex compaction after the model's reply, a Codex
turn ending with the assistant's message, and #1533's request on
Codex's path and /v1/responses, each asked once and never refused.
Run on mote (mote-run): go vet ./internal/gateway; go test -run
'EndingWithModel|NeverEndWithModel|ToolResponseTurnHoldsNoText|LocalModelIDAtAPlugin'
./internal/gateway ok.
Broken by hand: with the trailing-model guard in buildCodeAssistSent
turned off the test fails (vendor refused, a retry got past it); with the
functionResponse/text split turned off it fails on both #1533 cases.
Not run: the full suite (test-only change in one package).
The plugin side got the same rules as defense in depth in
magpie-community/plugins 5112465c (gcp-ai 0.2.1).