Skip to content

main 当前无法构建:4d63d75 删除资源与 catalog 条目但未更新引用 #15

Description

@yujiezhang-ops

main(当前 f457204)在三道门上都是红的。与任何在飞的 PR 无关——在 maimory/main 上单独复现过。

根因是 4d63d75("chore: remove unused files",PR #13):删掉了文件,但留下了引用它们的代码和测试。

1. 前端构建失败

[UNRESOLVED_IMPORT] Could not resolve './assets/cursor.svg'   in src/components/icons/agents.tsx
[UNRESOLVED_IMPORT] Could not resolve './assets/hermes.png'   in src/components/icons/agents.tsx
[UNRESOLVED_IMPORT] Could not resolve './assets/openclaw.svg' in src/components/icons/agents.tsx

三个资源被删(agents.lock.json 同批删掉对应条目),但 frontend/src/components/icons/agents.tsx:25,26,28 的 import 还在。assets/ 现在只剩 5 个文件。

pnpm run build 直接失败,所以 Wails 发行构建也出不来

2. 七个前端测试文件无法加载

同一批 import 导致这些文件根本加载不了(不是断言失败,是模块解析失败):

src/App.test.tsx
src/components/AgentManageRow.test.tsx
src/components/icons/agents.test.tsx
src/pages/AgentDetailPage.test.tsx
src/pages/AgentSelectionPage.test.tsx
src/pages/EnvironmentOverviewPage.test.tsx
src/pages/ProfilesPage.test.tsx

3. 三个 Go 测试失败

--- FAIL: TestProtocolsForAgentsRejectsUnknownAndIgnoresGuideOnly
    provider_test.go:81: guide protocols = [], err=Unknown Agent: openclaw
--- FAIL: TestFlatInstallCLIEmitsStructuredGuideResult
--- FAIL: TestStatusMatchesEmptyLinuxARM64Fixture
    status_test.go:338: status diverged from the frozen fixture

前两个硬编码了被删的 openclawinternal/app/provider_test.go:79cmd/oneagent/main_test.go:20),第三个是 golden fixture 没随 catalog 变化更新。

注意 go vet ./...干净的——这三个只有跑测试才暴露。

关于那 9 个被删的条目

4d63d75 删除的是全部 guide-only 条目:clinecontinuecursorgemini-clihermeskilo-vscodekiroopenclawqwen-code

但 guide-only 机制在 Go 侧仍然完整保留internal/catalog/types.goGuideGuideOnly 字段,以及依赖它们的两个测试)。所以看起来是清理无用资源时把 catalog 条目一起带走了,而不是有意废弃这个机制。修的时候需要先明确意图:

  • 要保留 guide-only:把条目加回来,补回图标资源。
  • 要废弃 guide-only:那就得连带删掉 GuideOnly 相关的字段、代码路径和那两个测试,并更新 fixture——目前是删一半的中间状态。

这个选择会影响 #12(它想把 qwen-code 从 guide 提升为 auto,而该条目已被删)。

顺带:仓库没有 CI

这次断裂能进 main 是因为仓库没有任何 PR 检查(gh pr checks 报 "no checks reported"),也没有 branch protection。已有 .github/workflows/build-artifacts.yml,但它是 workflow_dispatch 手动触发、且只跑构建不跑测试。加一个 on: [push, pull_request]go test ./... + pnpm run build + pnpm run test 就能拦住这类问题。

另一个既有问题(独立,可一起修)

.gitignore 的注释说 !frontend/dist/.keep 是为了让 manifest_embed.gogo:embed all:frontend/dist 在全新克隆上工作,但那个 .keep 实际并未被跟踪git ls-files frontend/dist 为空)。新克隆或新 worktree 里 go vet ./... 会先失败于 pattern all:frontend/dist: no matching files found,必须先跑一次前端构建。注释描述的修复没有生效。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions