Skip to content

fix: 在收集测试前解析生成清单中的 draftHash #183

Description

@liuli195

🔎 Existing issue check

  • I have searched the existing issues.

🎯 Affected area

Factory (domains/factory)

📦 Comet version

0.4.0-beta.3

💥 Current behavior

/comet-any 生成的 comet/eval.yaml 包含:

metadata:
  draftHash: <current-bundle-hash>

官方流程会直接把该文件传给 comet eval,但 Python 清单解析器要求 draftHash 必须是 64 个小写十六进制字符,因此收集阶段失败:

ValueError: Expected metadata.draftHash to be 64 lowercase hex characters

将占位符替换为当前 Bundle hash 后,同一个清单成功收集 23 个测试。

✅ Expected behavior

/comet-any 生成的 comet/eval.yaml 应能直接用于:

comet eval <generated-skill>\comet\eval.yaml --collect

用户不应手工修改生成清单或内部 Bundle 状态。

🔁 Steps to reproduce

  1. 使用 /comet-any 生成一个工作流 Skill。
  2. 打开生成的 comet/eval.yaml
  3. 确认 metadata.draftHash<current-bundle-hash>
  4. 使用有效的 Comet 验证环境执行:
    comet eval <generated-skill>\comet\eval.yaml `
      --project <comet-source-root> `
      --collect
  5. 观察 draftHash 格式错误。
  6. 将占位符替换为当前 Bundle hash。
  7. 再次运行后,测试收集成功(本次复现为 23 个测试)。

🖥️ Environment

- OS: Windows 11 10.0.26200
- Shell: PowerShell 7.6.3
- Node: v24.15.0
- Package manager: npm 11.12.1
- Install scope: global
- Skill language: zh
- Target AI platform(s): Codex
- uv: 0.11.7

📋 Logs or output

ValueError: Expected metadata.draftHash to be 64 lowercase hex characters

🧩 Additional context

相关源码:

  • 生成器写入固定占位符:
    );
    return {
    apiVersion: 'comet.eval/v1alpha1',
    kind: 'SkillEvalManifest',
    metadata: {
    name: plan.name,
    description: factoryEntryDescription(plan),
    draftHash: '<current-bundle-hash>',
    },
    skill: { name: plan.name, source: '..', profile: 'authoring-skill' },
    evaluation: {
  • Python 清单解析器要求 SHA-256:
    def _optional_draft_hash(metadata: dict) -> str | None:
    value = metadata.get("draftHash") or metadata.get("draft_hash")
    if value is None:
    return None
    if not isinstance(value, str) or not SHA256_HEX_RE.match(value):
    raise ValueError("Expected metadata.draftHash to be 64 lowercase hex characters")
    return value

建议在调用验证环境前将占位符解析到临时运行清单,同时保留用于稳定 Bundle hash 的占位符规范化;并增加“生成后立即 collect”的端到端测试。

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions