From cc8c03a40d02f9e3295a0970c3f77227581e41b3 Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Mon, 21 Sep 2026 19:08:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=B8=B8=E6=88=8F=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E5=BE=80=E8=81=8A=E5=A4=A9=E5=86=99"=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E9=80=9A=E8=BF=87"=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删掉 AGC 播放/运行本地游戏成功后的聊天提示:它每次播放都会堆在对话底部遮挡运行画面,成功与否由客户端运行视图本身体现,失败仍照原样回报 - appSurface 三处用例改为断言 start_local_game_preview 真被调用且聊天里不再出现该提示 - 补排障记录:本地 node_modules 内置 Codex 原生包过旧会让 AGC build script panic,需在仓库根目录 npm ci --- apps/ai-game-creator-shell/src/App.tsx | 11 ++------ .../appSurface/project-commands.suite.ts | 12 ++++---- .../appSurface/project-development.suite.ts | 28 +++++++++++-------- .../assert-project-tools-and-preview.ts | 13 +++++---- docs/project-memory/shared-memory/pitfalls.md | 8 ++++++ 5 files changed, 41 insertions(+), 31 deletions(-) diff --git a/apps/ai-game-creator-shell/src/App.tsx b/apps/ai-game-creator-shell/src/App.tsx index 4d28f041a..354a502f4 100644 --- a/apps/ai-game-creator-shell/src/App.tsx +++ b/apps/ai-game-creator-shell/src/App.tsx @@ -9531,15 +9531,8 @@ export function App({ if (!directCodexProductRuntime) { void refreshAgentRunTrace(nextProjectPath); } - if (announceToChat) { - setMessages((current) => [ - ...current, - { - role: 'assistant', - text: `运行通过,已载入客户端运行视图:${previewResult.url}`, - }, - ]); - } + // 运行成功的提示不再写进聊天:它会一直堆在对话底部遮挡视野,而客户端运行视图 + // 本身就是这条动作的可见反馈。失败仍按下面的分支回报,用户需要知道为什么没跑起来。 } catch (error) { const message = error instanceof Error ? error.message : String(error); setLimitedCommandStatus(message); diff --git a/apps/ai-game-creator-shell/tests/appSurface/project-commands.suite.ts b/apps/ai-game-creator-shell/tests/appSurface/project-commands.suite.ts index fa54a42e3..3671dbdf8 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/project-commands.suite.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/project-commands.suite.ts @@ -3025,11 +3025,13 @@ export function registerProjectCommandTests() { ).not.toBeNull(); fireEvent.click(screen.getByRole('button', { name: '确认' })); - expect( - await screen.findByText( - /运行通过,已载入客户端运行视图:http:\/\/127\.0\.0\.1:3210\//, - ), - ).not.toBeNull(); + // /run 成功只切换客户端运行视图,不再往聊天里追加“运行通过”提示。 + await waitFor(() => + expect(invoke).toHaveBeenCalledWith('start_local_game_preview', { + projectPath: '/tmp/authorized-game', + }), + ); + expect(screen.queryByText(/运行通过/)).toBeNull(); expect(invoke).toHaveBeenCalledWith('run_limited_local_command', { projectPath: '/tmp/authorized-game', commandId: 'game.static_smoke', diff --git a/apps/ai-game-creator-shell/tests/appSurface/project-development.suite.ts b/apps/ai-game-creator-shell/tests/appSurface/project-development.suite.ts index ed2ba1494..ec74c9aa7 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/project-development.suite.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/project-development.suite.ts @@ -7199,13 +7199,16 @@ export function registerProjectSupervisorSurfaceTests() { }), ); - expect( - await screen.findByText( - /运行通过,已载入客户端运行视图/, - {}, - { timeout: 3_000 }, - ), - ).not.toBeNull(); + // 顶部播放请求只负责把游戏起在运行视图里;聊天里不再新增“运行通过”提示, + // 否则每次播放都会在对话底部堆一条遮挡运行画面。 + await waitFor( + () => + expect(invoke).toHaveBeenCalledWith('start_local_game_preview', { + projectPath, + }), + { timeout: 3_000 }, + ); + expect(screen.queryByText(/运行通过/)).toBeNull(); expect(handled).toHaveBeenCalledWith(7); expect(invoke).toHaveBeenCalledWith('start_local_game_preview', { projectPath, @@ -7251,11 +7254,12 @@ export function registerProjectSupervisorSurfaceTests() { }), ); - expect( - await screen.findByText( - '运行通过,已载入客户端运行视图:http://127.0.0.1:43126/', - ), - ).not.toBeNull(); + await waitFor(() => + expect(invoke).toHaveBeenCalledWith('start_local_game_preview', { + projectPath, + }), + ); + expect(screen.queryByText(/运行通过/)).toBeNull(); expect(invoke).toHaveBeenCalledWith('start_local_game_preview', { projectPath, }); diff --git a/apps/ai-game-creator-shell/tests/appSurface/project-preview/preview-shortcuts/assert-project-tools-and-preview.ts b/apps/ai-game-creator-shell/tests/appSurface/project-preview/preview-shortcuts/assert-project-tools-and-preview.ts index 22fe7f8e6..80b3fc4c7 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/project-preview/preview-shortcuts/assert-project-tools-and-preview.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/project-preview/preview-shortcuts/assert-project-tools-and-preview.ts @@ -822,11 +822,14 @@ export function registerProjectToolsAndPreviewTests() { fireEvent.click(screen.getByRole('button', { name: '运行' })); expect(await screen.findByText('game.run_local')).not.toBeNull(); fireEvent.click(screen.getByRole('button', { name: '确认' })); - expect( - await screen.findByText( - /运行通过,已载入客户端运行视图:http:\/\/127\.0\.0\.1:3210\//, - ), - ).not.toBeNull(); + // 运行成功不再写聊天提示(会一直堆在对话底部遮挡运行画面),改成断言预览真的起来了 + // 且聊天里不再出现那条提示。 + await waitFor(() => + expect(invoke).toHaveBeenCalledWith('start_local_game_preview', { + projectPath: '/tmp/authorized-game', + }), + ); + expect(screen.queryByText(/运行通过/)).toBeNull(); expect(invoke).toHaveBeenCalledWith('run_limited_local_command', { projectPath: '/tmp/authorized-game', diff --git a/docs/project-memory/shared-memory/pitfalls.md b/docs/project-memory/shared-memory/pitfalls.md index 0205590b1..795ca71f6 100644 --- a/docs/project-memory/shared-memory/pitfalls.md +++ b/docs/project-memory/shared-memory/pitfalls.md @@ -5874,3 +5874,11 @@ Cocos Creator 根目录由 `package.json.creator.version` 与普通 `assets/` - **原因**:校验器对每个 `input_text` 单独执行 `trim().is_empty()` 并立即拒绝,混淆了结构化片段合法性和整条消息是否有实际内容。 - **处理(现行口径)**:`input_text` 允许空字符串、空格和换行,校验过程保持全部片段的原文、分段与顺序,不做合并或删除;遍历完整条消息后,只在既没有非空白文字、也没有合法 `agc_resource_reference` / `agc_runtime_region_reference` 时返回“聊天内容不能为空”。两类引用仍逐个执行原有校验,消息带正文也不能绕过非法引用。 - **关联**:`apps/ai-game-creator-shell/src-tauri/src/agent/direct_codex_user_item/validation.rs`、`docs/【功能说明】AGC聊天素材引用-2026-09-08.md`。 + +## 2026-09-21 本地 node_modules 里的内置 Codex 原生包过旧会让 AGC build script panic + +- **现象**:`npm run agc` 编到壳 crate 的 build script 时中止,stderr 是 `panicked at build.rs:103: Codex 原生包版本、布局或架构不匹配目标 x86_64-pc-windows-msvc`,stdout 只打印了 `cargo:rustc-env=AGC_BUILD_TARGET=...`。 +- **原因**:`build_support/codex_bundle.rs` 把随包 Codex CLI 钉在 `0.155.1`(随 #439 升级),而本地 `node_modules/@openai/codex-win32-x64/vendor/x86_64-pc-windows-msvc/codex-package.json` 仍是 `0.147.0`。`package-lock.json` 早就是 `0.155.1`,缺的只是本地安装;这条判据只看版本元数据,文件齐全、架构正确也照样拦。 +- **处理(现行口径)**:在仓库根目录执行 `npm ci`(不要改成子目录或单包安装),随后 `node_modules/@openai/codex/package.json` 与 vendor 的 `codex-package.json` 都应为 `0.155.1`。Windows 上 `npm ci` 会先 unlink 整个 `node_modules`:RustRover 的 Tailwind language server / `oxide-helper` 进程会占住 `@tailwindcss/oxide-*.node`,报 `EPERM: operation not permitted, unlink ...` 时先结束这些 helper 再重试,否则会停在半装状态。 +- **验证**:`npm ci` 后 `cargo build --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml` 输出 `Finished dev profile ... in 1m 26s`,不再触发该 panic。 +- **关联**:`apps/ai-game-creator-shell/src-tauri/build.rs`、`apps/ai-game-creator-shell/src-tauri/build_support/codex_bundle.rs`、`package-lock.json`。