From 8789b398a2efe383db774a0229f57a1b40dd774e Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Tue, 6 Oct 2026 19:45:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(agc):=20=E8=AE=A9=20run=5Fturn=20=E5=9C=A8?= =?UTF-8?q?=20unix=20=E6=B5=8B=E8=AF=95=E6=9E=84=E5=BB=BA=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=EF=BC=8C=E4=BF=AE=20Linux=20harness=20=E7=9A=84=20E05?= =?UTF-8?q?99=EF=BC=88CI=20=E7=BA=A2=E5=9B=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因(CI run 3609 的 21864/21865/21866 日志):`cargo test --bin genarrative-ai-game-creator-shell --no-run` 在 Linux 上 `could not compile ... (bin ... test) due to 3 previous errors`,逐条是 `error[E0599]: no method named run_turn found for struct CodexAppServerConnection`(src/agent/codex_app_server/mod.rs:8284/8337/8423)。 来历:lane C 的 86478e8a5(清 dead_code 那批)给 `CodexAppServerConnection::run_turn` 与 `RunFailure::into_llm_error` 加了 `#[cfg(not(test))]` 来消除测试构建里的未用告警;但这三个调用点所在用例是 `#[cfg(unix)]`(用 chmod/权限位与假 app-server 脚本),在 Linux 的测试构建里存在并需要该方法,在 Windows 测试构建里整段不存在,所以本地/Windows 口径看不到。 修法:两个方法由 `#[cfg(not(test))]` 改为 `#[cfg(any(not(test), unix))]`(生产全平台可用 + unix 测试构建可用;Windows 测试构建仍排除,保持既有 zero-warning 口径),并加注释写清为何不能再收窄。不新增 allow、不删测试、不改实现。 验证(本地 Windows):bin 口径 0 warning / EXIT=0;--all-targets EXIT=0(test harness 实例 336 条不变);定向用例 `cargo test --bin ... -- agent::codex_app_server` 118 passed / 0 failed;cargo fmt --all --check、npm run check:encoding(5406 文件)、git diff --check 全 rc=0。 说明:AGC 壳的 Linux test 构建无法在本机复现(tauri/webkit 依赖需要 Linux 系统库,pkg-config 交叉不可用),该口径以下一轮 CI 为准;修复本身只涉及“方法缺失”这一类错误(编译器在同一次编译里报了全部 3 条,已全部覆盖)。 --- .../src-tauri/src/agent/codex_app_server/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/mod.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/mod.rs index 5bfaa2ca6..39bae9267 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/mod.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/mod.rs @@ -3102,7 +3102,10 @@ impl CodexAppServerConnection { } } - #[cfg(not(test))] + // 生产入口(非 Direct 的 app-server 回合)。`#[cfg(unix)]` 的三个 app-server 用例在**测试构建**里也会 + // 直接调用它(见下方 read-only protocol / cancel / terminal-unknown 三个用例),因此测试态只在 unix 保留; + // Windows 测试构建用不到它,继续排除以维持 zero-warning 口径。 + #[cfg(any(not(test), unix))] async fn run_turn( &self, snapshot: &AgentRuntimeProviderRequestSnapshot, @@ -3996,7 +3999,9 @@ impl From for RunFailure { impl RunFailure { /// 压回 `LlmError`:只给拿不到"继续返修批次"这条控制流的入口用(非 Direct 的 `run_turn`)。 - #[cfg(not(test))] + /// + /// cfg 与 `run_turn` 保持一致:unix 的测试构建会经由 `run_turn` 调用到它。 + #[cfg(any(not(test), unix))] fn into_llm_error(self) -> platform_llm::LlmError { match self { Self::Failed(error) => error,