Skip to content

setup: post-edit 默认关闭,只有用户明确 opt-in 才能启用 #136

Description

@tt-a1i

现场

本机出现了持续的黄色警告:

Warning: post-edit command failed (exit 127):
xxxxxxxx...

检查后确认,保存的 postEdit.command 是一长串无效字符。OpenPI 在发生成功 Write/Edit 的回合结束后,把它作为 shell 命令执行,因此每次都以 127(command not found)失败。

当前事实

源码的新配置默认值已经是关闭:

{
  "postEdit": {
    "command": ""
  }
}

因此本 Issue 不是把默认值从“开”改为“关”,而是把 default-off + explicit opt-in 固化为完整的 setup 契约,避免普通 setup、误输入或模型推断意外启用一条每回合自动执行的 shell 命令。

产品决定

  • post-edit 保持默认关闭;
  • 缺失、首次安装和普通无参数 /openpi-setup 都不得主动启用或推荐某条命令;
  • 只有用户明确要求配置 post-edit 时,setup episode 才能写入非空 post_edit_command
  • 关闭应使用空字符串作为唯一 canonical 状态;
  • 已保存的非空命令属于用户配置,不在升级时静默删除。

建议范围

  • 在 setup prompt/tool contract 中明确:没有直接的 post-edit 配置意图时,保留现值;首次配置保持空值。
  • no-argument setup 状态明确显示 Post-edit command: off
  • 为首次配置、普通配置其他区域、明确启用、明确关闭、现值保留增加回归测试。
  • 对异常长命令的失败提示保持有界,避免终端被大段命令和 stderr 淹没。
  • README/SETUP 说明它是可选的固定收尾命令,而不是每个项目都应开启的默认 workflow。

不做什么

  • 不增加关键词路由器或自然语言解析器。
  • 不让 OpenPI 自动猜测应该运行 format/lint/test 中的哪一个。
  • 不在升级时改写已有用户偏好。
  • 不把单命令机制扩展成通用 hook framework。

验收标准

  • 全新或缺失配置读取为 postEdit.command === ""
  • 配置 footer、suggestions、Workflow 等其他区域不会启用或改写 post-edit。
  • 只有明确的用户请求才能持久化非空 post-edit command。
  • 明确关闭后持久化为空字符串,并停止后续自动运行。
  • 无参数 /openpi-setup 显示 post-edit 为 off。
  • 失败通知中的命令与输出均有独立、终端安全的显示预算。
  • bun run checkbun run test 通过。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions