🐛 fix(mcp): 日程 MCP 工具按职责拆分并改为结构化返回 - #387
Conversation
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #387 +/- ##
==========================================
+ Coverage 90.42% 90.48% +0.06%
==========================================
Files 213 216 +3
Lines 25707 26124 +417
Branches 6800 6847 +47
==========================================
+ Hits 23246 23639 +393
- Misses 1128 1148 +20
- Partials 1333 1337 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 17 files with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
本次审查覆盖了日程 MCP 工具拆分、周期规则参数解析、查询结构化输出、提醒同步以及音频运行时音量配置。当前实现有几处会造成状态或下游数据不一致的问题,详见行内评论。
已验证:与日程 MCP 相关的 8 个 host 测试目标全部通过(包括 schedule_mcp_tools_test、提醒、失败恢复、操作记录和输入解析覆盖)。完整 host 构建还会在未改动的 display/audio 头文件中因 [[maybe_unused]] 的 -Werror=attributes 失败。
Additional findings
components/voicelife_mcp/src/tools/schedule_mcp_tools.cc:?: [P1] 校验跳过 occurrence 的确认事件: 工具描述和SkipOccurrenceProperties都要求调用方回传expected_event以确认目标,但这里既没有读取也没有比较该字段,缺少它或传入其他事件名称都会直接写入 skip exception。模型在使用过期的rule_id + original_start_time定位数据时,因缺少这道确认保护可能跳过错误的 occurrence;请像schedule.delete一样要求并校验查询结果中的event。components/voicelife_mcp/src/tools/schedule_mcp_tools.cc:?: [P1] 提醒撤销失败时不要先取消规则:cancel_schedule_rule在这里先执行并成功修改数据库,随后SuspendRuleReminders才可能失败;此时工具返回“旧提醒撤销失败”,但周期规则及其已物化实例已经被取消,且重试无法恢复这次被报告为失败的操作。旧实现是在取消规则前先暂停提醒,失败时不会改变规则状态。请恢复先暂停/确保可恢复的顺序,或在提醒失败时补偿恢复规则状态并明确报告结果。
| intent.endDate = properties.value<std::string>("end_date"); | ||
| intent.resultCount = result_count; | ||
| intent.schedules = *schedules_json; | ||
| intent.schedules = *one_time_json; |
There was a problem hiding this comment.
[P1] 保留周期实例到 IM 查询上报
这里把 intent.schedules 改为只序列化 one_time_json,但 service.query_schedule 返回的已物化周期实例已经被放入 recurring_schedules。因此一次同时包含一次性日程和已物化周期实例的查询,模型响应仍有周期实例,而 ScheduleQueryResultIntent 上报会静默丢失这些实例,导致下游 IM 查询结果与工具结果不一致。请让上报的 schedules 包含两类已物化日程,或为上报契约增加并填充周期实例字段。
结论
Refs #388
变更
明确未包含:
架构与兼容
验证
证据:
(待补充本地/CI 输出链接)
TDD 记录
风险与回退
Review 清单