Skip to content

s03 中 todo 工具契约与 TodoManager 校验不一致 #2

@lixiang-coder

Description

@lixiang-coder

Summary

StageConfig.s03() 中,todo 工具的 schema 定义过于宽松,而 TodoManager.update() 又执行了更严格的隐式校验,导致模型返回看起来合理的结果时,运行时却直接失败。

Repro Cases

情况 1:当用户要求“先规划再执行”时,模型可能返回只包含 reasonitems,随后报错:

IllegalArgumentException: Todo text/content required

情况 2:当用户要求一次创建多个文件时,模型可能把多个 item 都标记为 in_progress,随后报错:

IllegalArgumentException: Only one task can be in_progress at a time

Root Cause

当前 todo schema 没有清楚定义:

  • item 允许或要求哪些字段
  • 是否接受 reason
  • 是否只允许一个 item 处于 in_progress

因此模型是按照工具的自然语义在输出,但运行时又额外施加了 schema 中未声明的约束,最终造成契约不一致。

Expected

todo 工具定义与 TodoManager.update() 的校验逻辑应保持一致,避免模型正常调用工具时在运行时失败。

Suggested Fix

  • 收紧 todo item 的 schema 定义
  • 在 schema 或 prompt 中明确“最多只能有一个 in_progress
  • reason 这类常见 checklist 风格字段做兼容,或在 schema 层直接拒绝
  • 为上述两种失败场景补充回归测试
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions