This commit is contained in:
Your Name
2026-10-23 10:40:43 +08:00
parent e974d3cfa5
commit a3d2d3170d
14 changed files with 1660 additions and 83 deletions
@@ -288,11 +288,11 @@ $openAiInputSpec = ['protocol' => 'openai'];
expectSame(
true,
callPrivate('isInputRejection', [
['errno' => 0, 'http_code' => 400, 'body' => '{"code":"invalid_param"}'],
['errno' => 0, 'http_code' => 400, 'body' => '{"code":"invalid_param","message":"Unknown input variable: prompt_version"}'],
$difyInputSpec,
['prompt_version' => 'v2'],
]),
'Dify invalid_param retries with query-only input'
'an explicit undeclared Dify input retries with query-only input'
);
expectSame(
false,
@@ -329,12 +329,13 @@ expectSame(
'http_code' => 200,
'upstream_error' => true,
'upstream_code' => 'invalid_param',
'upstream_reason' => 'inputs_invalid',
'emitted' => false,
],
$difyInputSpec,
['prompt_version' => 'v2'],
]),
'a streaming invalid_param before any delta also retries without inputs'
'an explicit streaming inputs error before any delta retries without inputs'
);
expectSame(
false,
@@ -344,6 +345,7 @@ expectSame(
'http_code' => 200,
'upstream_error' => true,
'upstream_code' => 'invalid_param',
'upstream_reason' => 'inputs_invalid',
'emitted' => true,
],
$difyInputSpec,
@@ -358,8 +360,8 @@ expectSame(false, callPrivate('shouldRetryWithoutFiles', [400, []]), 'a text-onl
expectSame(false, callPrivate('shouldRetryWithoutFiles', [401, $capped['kept']]), 'a credential failure is not retried');
expectSame(false, callPrivate('shouldRetryWithoutFiles', [500, $capped['kept']]), 'an upstream outage is not retried here');
// 协议回退会把最初的“附件被拒”换成另一协议的状态码(Dify 400 -> OpenAI 404),
// 降级判断必须按每次响应累计,否则去掉附件的重试永远不会发生。
// Optional legacy files retain their historic text fallback; required clinical
// files use the affirmative-evidence flag tested by DifyRequiredFilesRejectionClassificationTest.
expectSame(
true,
callPrivate('isFileRejection', [['errno' => 0, 'http_code' => 400], $capped['kept']]),