Files
CLIProxyAPI/sdk/cliproxy/auth/issue7513_completion_flags_test.go
Luis Pater cf07c78abd fix(gemini/antigravity): fail zero-output abnormal terminations before HTTP 200 commit
- Detect MALFORMED_FUNCTION_CALL, UNEXPECTED_TOOL_CALL, and MALFORMED_RESPONSE with zero visible output before bootstrap commit, reasoning replay caching, or usage finalization across Antigravity, Gemini, Vertex, and AI Studio executors.
- Withhold only contentless leading shell frames while keeping thought chunks unbuffered for TTFT, and align Claude response error handling and stream completion flags while preserving valid partial outputs.
- Add unit, executor, bootstrap failover, and cross-module HTTP regression tests covering credential rotation and HTTP 502 exhaustion.

Closes: #7513
Co-authored-by: Dylan <1990016@gmail.com>
Co-authored-by: lzt404 <2596933790@qq.com>
2026-11-14 00:50:21 +08:00

19 lines
745 B
Go

package auth
import "testing"
func TestIssue7513_JSONObjectCompletionFlagsRejectsGeminiAbnormalFinishes(t *testing.T) {
for _, reason := range []string{"MALFORMED_FUNCTION_CALL", "UNEXPECTED_TOOL_CALL", "MALFORMED_RESPONSE"} {
t.Run(reason, func(t *testing.T) {
payload := []byte(`{"candidates":[{"content":{"role":"model","parts":[]},"finishReason":"` + reason + `"}]}`)
completed, incomplete := jsonObjectCompletionFlags(payload)
if completed || !incomplete {
t.Fatalf("jsonObjectCompletionFlags(%s) = (completed=%v, incomplete=%v), want (false, true)", reason, completed, incomplete)
}
if isCompletedExecutionPayload(payload) {
t.Fatalf("isCompletedExecutionPayload(%s) = true, want false", reason)
}
})
}
}