From a6c0775fb709c0e3ed8f67ce165413630e6367a3 Mon Sep 17 00:00:00 2001 From: Linghong Date: Mon, 27 Jul 2026 03:57:59 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=8E=9F=E7=94=9F=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=20repair=20=E7=94=A8=E4=BE=8B=E4=B8=AD=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84=E6=8F=90=E7=A4=BA=E8=AF=8D=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除 legacy text JSON schema 后,断言「提供原生函数时不得输出这段 JSON」必然失败 改为断言现行原生协议约束,并新增否定断言防止该段 schema 回流 tool_choice=required、arguments.input 嵌套、禁止扁平化和 respond_to_user 断言保持不变 Co-Authored-By: Claude Opus 5 --- apps/ai-game-creator-shell/src-tauri/src/tests/provider.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/tests/provider.rs b/apps/ai-game-creator-shell/src-tauri/src/tests/provider.rs index 237894153..0f6304dae 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/tests/provider.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/tests/provider.rs @@ -5505,7 +5505,10 @@ async fn background_agent_runtime_repairs_malformed_native_function_arguments() .recv_timeout(Duration::from_secs(2)) .expect("initial native tool plan request"); assert!(initial_request.contains("\"tool_choice\":\"required\"")); - assert!(initial_request.contains("提供原生函数时不得输出这段 JSON")); + // 三种协议统一使用原生工具后,legacy text JSON schema 已从 planning 请求中移除; + // 这里既断言现行原生协议约束,也防止那段失效 schema 回流。 + assert!(initial_request.contains("必须直接调用当前请求提供的原生函数")); + assert!(!initial_request.contains("Legacy text JSON schema")); assert!(initial_request.contains("arguments.input")); assert!(initial_request.contains("禁止把 input 字段扁平到 arguments 顶层")); assert!(initial_request.contains("必须调用 respond_to_user"));