Skip to content

forge-engine: engine-config.json 初始化后 contacts 字段为空,影响 sender_id 注入 #17

@AmberCXX

Description

@AmberCXX

问题

initDefaultConfig() 生成的 engine-config.json 默认 contacts: {},没有引导用户填写。这会导致两个静默问题:

  1. getPrimarySenderId(contacts) 返回空字符串 → engine 触发任务时,MCP notification 的 meta.sender_id 为空,任务在 session 层面无归属
  2. {contacts} 模板变量渲染结果只有 "可用通道:" 标题,无实际内容 → Claude 无法从模板中获取发送目标

由于这两个问题都是静默失败(任务仍会触发,只要模板里硬编码了 sender_id),很容易被忽略,但会诱导用户在 template 里硬编码 sender_id,导致后期维护成本上升。

建议

  • initDefaultConfig() 生成配置后,在 stderr 输出明确提示:engine-config.json 已生成,请编辑 contacts 字段后再启动 engine
  • 或在 startScheduler() 启动时检测 contacts 为空则 warn
  • README / 配置文档中补充一个 contacts 填写示例

环境
forge-engine v0.1.0

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