mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-11-16 22:57:53 +08:00
- 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>
19 lines
745 B
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|