From 8aaa3f5c7be26840c28ddd69f00d39f1989d6d14 Mon Sep 17 00:00:00 2001 From: suzmii Date: Thu, 3 Sep 2026 14:24:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=90=E8=A1=8C=E6=97=B6?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=AF=8A=E6=96=AD=E9=98=BB=E5=A1=9E=E7=AA=97?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 Codex CLI 与 app-server 探测移入 Tokio 阻塞线程池 保持 GameAgent 运行时配置读写流程不变 增加异步 LLM 配置诊断回归测试并补充技术方案约束 --- .../src-tauri/src/commands.rs | 10 +++++-- .../src-tauri/src/tests/configuration.rs | 27 +++++++++++++++++++ ...案】AI游戏创作Agent Runtime V1.1-2026-07-12.md | 1 + 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/commands.rs b/apps/ai-game-creator-shell/src-tauri/src/commands.rs index 3d6744e87..248cb1348 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/commands.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/commands.rs @@ -1832,8 +1832,14 @@ pub(crate) fn schedule_game_creator_agent_ready_tasks( } #[tauri::command] -pub(crate) fn check_game_creator_llm_config() -> GameCreatorLlmConfigStatus { - check_game_creator_llm_config_from_config() +pub(crate) async fn check_game_creator_llm_config() -> Result { + // Configuration reads/writes are short local file operations, but the + // diagnostic status path may synchronously spawn Codex CLI and run + // `app-server --help`. Keep that blocking probe off Tauri's async/window + // thread so opening or saving runtime settings never freezes the shell. + tokio::task::spawn_blocking(check_game_creator_llm_config_from_config) + .await + .map_err(|error| format!("LLM 配置诊断任务意外终止:{error}")) } #[tauri::command] diff --git a/apps/ai-game-creator-shell/src-tauri/src/tests/configuration.rs b/apps/ai-game-creator-shell/src-tauri/src/tests/configuration.rs index 21336885b..b797683fe 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/tests/configuration.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/tests/configuration.rs @@ -1097,6 +1097,33 @@ fn llm_config_check_reports_agent_specific_config_paths() { fs::remove_dir_all(root).ok(); } +#[tokio::test] +async fn llm_config_diagnostic_command_runs_asynchronously() { + let root = unique_project_path(); + fs::create_dir_all(&root).expect("create runtime config dir"); + let _guard = use_test_runtime_config_dir(root.clone()); + fs::write( + root.join(GAME_CREATOR_CONFIG_FILE_NAME), + r#"{ + "agentMode": "provider", + "llm": { + "apiKey": "test-key", + "baseUrl": "https://example.test/v1", + "model": "test-model" + } +} +"#, + ) + .expect("write runtime config"); + + let status = crate::commands::check_game_creator_llm_config() + .await + .expect("run config diagnostic command"); + assert!(status.configured, "{status:?}"); + + fs::remove_dir_all(root).ok(); +} + #[test] fn llm_status_cli_lines_include_agent_errors_without_leaking_keys() { let status = GameCreatorLlmConfigStatus { diff --git a/docs/technical/【技术方案】AI游戏创作Agent Runtime V1.1-2026-07-12.md b/docs/technical/【技术方案】AI游戏创作Agent Runtime V1.1-2026-07-12.md index 39177166c..876086c00 100644 --- a/docs/technical/【技术方案】AI游戏创作Agent Runtime V1.1-2026-07-12.md +++ b/docs/technical/【技术方案】AI游戏创作Agent Runtime V1.1-2026-07-12.md @@ -1617,6 +1617,7 @@ V1.51 在不替换现有 Provider、Runner 和 Runtime 事实源的前提下增 ### 配置与验收 - `check_game_creator_llm_config` 在 CLI 模式只检查固定 Codex 可执行文件可启动并返回受支持版本,不要求 LLM API Key;Provider 模式保持既有检查。配置 UI 显示全局模式,始终保留旧 LLM/逐 Agent/MCP/Editor 配置;切换模式不清空任何旧值。 +- Tauri 配置页触发的 `check_game_creator_llm_config` 必须通过阻塞线程池执行 Codex CLI / app-server 探测,不能在窗口线程同步等待;配置文件读写不得因诊断探测阻塞整个 GameAgent 窗口。 - fake Codex fixture 必须覆盖 argv/stdin、structured calls、final text、非零退出、挂起取消、损坏/超限 JSONL、无 shell/MCP 参数和并发节点;真实 smoke 只复用用户已有 Codex 登录态。旧 Provider smoke 继续作为回退模式门禁,不能被新 CLI smoke 替代。 ## V1.52 Codex app-server 长期节点 Agent 模式