Skip to content

fix(test): resolve 5 pre-existing test failures#911

Draft
yanyihan-xiaomi wants to merge 2 commits into
XiaomiMiMo:mainfrom
yanyihan-xiaomi:fix/test-failures
Draft

fix(test): resolve 5 pre-existing test failures#911
yanyihan-xiaomi wants to merge 2 commits into
XiaomiMiMo:mainfrom
yanyihan-xiaomi:fix/test-failures

Conversation

@yanyihan-xiaomi

@yanyihan-xiaomi yanyihan-xiaomi commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary / 概述

修复 CI 启用后暴露的 9 个 pre-existing 测试失败(从 17 个中修复了可安全修复的)。

Fixes 9 of the 17 pre-existing test failures exposed after CI was enabled in #907.

Changes / 改动

1. test/skill/compose-review.test.ts — compose dispatch 正则修复

问题: 测试期望 prompt 模板包含 subagent_type: "general" 参数语法,但实际 prompt 用自然语言 `general` subagent

原因: prompt 模板经过重写,从嵌入参数语法改为自然语言描述(避免 LLM 生成格式错误的 actor 调用),但测试正则没跟上。

修复: 正则从 /subagent_type[:=]?\s*"?general"?/ 改为 /`general`\s*subagent/


2. src/tool/actor.ts — actor 术语规范

问题: test/actor/terminology.test.ts 检测到 src/tool/actor.ts 包含 legacy 术语 taskRegistry

原因: 项目有过一次 "task → actor" 术语迁移。TaskRegistry 是用户待办任务的 service(与 actor 无关),但局部变量名 taskRegistry 触发了检测正则。

修复: 变量名 taskRegistrytasks,纯重命名,逻辑不变。


3. test/agent/agent.test.ts — 删除 todowrite 测试

问题: 测试断言 general agent deny todowrite,但实际返回 allow。

原因: 上游有 todowrite: "deny",我们 fork 移除了该配置。更关键的是 todowrite 工具本身已在我们 fork 中完全删除(为 MiMo 评测提分),测试一个不存在工具的权限毫无意义。

修复: 删除整个测试。


4. test/provider/provider.test.ts — DEFAULT_CONTEXT_WINDOW 1M

问题: 测试断言 model.limit.context === 200_000,实际为 1_000_000

原因: 源码 DEFAULT_CONTEXT_WINDOW = 1_000_000,初始开源发布即此值。大部分现代模型支持 1M+ 上下文。

修复: 断言更新为 1_000_000


5. test/provider/provider.test.ts — mimo free provider 条件化

问题: 断言 providers["mimo"] 存在,但在开源构建中不存在。

原因: mimo provider 由 src/private/ 私有插件注册,仅内部构建存在。开源构建无此目录。

修复: 相关断言改为 if (mimo) { ... } 条件判断。


6. test/session/structured-output-retry.test.ts — 重试次数修正

问题: 期望 LLM 调用次数 retryCount + 1 = 3,实际为 4。

原因: 代码新增了 invalid-output continuation 路径,在 structured retry 之外额外触发一次调用。

修复: 断言改为 retryCount + 2,注释更新。


7. test/session/prompt-effect.test.ts — 超时扩大

问题: 2 个测试在 CI 中超时(5s polling + 5s/10s test timeout)。

原因: CI 环境(GitHub Actions ubuntu-latest)启动和执行比本地慢,5s 不够等待 actor spawn + message persist 完成。

修复: polling 和 test timeout 统一改为 30s。同时修复了 "1 error"(超时导致 promise rejection 泄漏到下一个测试)。


8. test/session/llm.test.ts — cache_control 位置更新

问题: 测试期望 cache_control 在 last tool_use 和 last tool_result 上,实际在 first user text 上。

原因: 缓存策略变更 — ephemeral 标记从 "标记最后一条消息末尾" 改为 "标记第一条 user 消息"(更早建立缓存断点,减少 prompt 重新处理)。

修复: 更新 snapshot 匹配新的 cache_control 位置。


Remaining failures (8) / 剩余失败

以下 8 个需要更深入代码调查,留后续 PR:

  • Checkpoint refactor (5): checkpoint writer skip 逻辑、rebuild context 格式、insertRebuildBoundary 语义均有重构
  • Tool whitelist (1): 拒绝方式从 completed + rejected metadata 变为其他形式
  • Actor spawn return-format (1): 消息持久化逻辑变更导致 user message 找不到
  • prompt-effect subtask metadata (1): 即使 30s 超时可能仍有竞态(需确认 actor spawn 是否正确 persist metadata)

Test plan / 测试计划

  • bun typecheck passes
  • All 9 fixed tests pass locally
  • CI verification

- compose-review: fix regex to match prose form (`general` subagent)
  instead of parameter syntax (subagent_type: "general")
- actor terminology: rename local var taskRegistry → tasks in actor.ts
- agent: general agent now allows todowrite (matches current config)
- provider: DEFAULT_CONTEXT_WINDOW is now 1M, update assertion
- provider: mimo free provider assertions conditional on private plugin
@yanyihan-xiaomi yanyihan-xiaomi self-assigned this Jun 17, 2026
@yanyihan-xiaomi yanyihan-xiaomi marked this pull request as draft June 17, 2026 15:36
- agent: remove obsolete todowrite test (tool was deleted)
- llm: update cache_control placement (now on first user text)
- prompt-effect: increase polling timeout 5s/10s → 30s for CI
- structured-output-retry: fix expected call count (retryCount + 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant