Skip to content

bug: gh-egress.sh edit 接受空 body → 靜默清空 issue body(資料遺失) #275

Description

@kiki830621

Problem

實際事故(2026-07-22,PsychQuant/bestOCR#1):上游組 body 的 python 步驟失敗(env var 未 export)→ 產出空檔 → gh-egress.sh edit 1 --body "$(cat empty-file)" --scrub-attested warn 照常派送,把 issue body 整個清空。所幸本機留有前一版 body 檔案,40 秒內還原;若無備份,diagnosis 前的完整 audit trail(verbatim 原文引用、Clarity Surface 狀態)將不可逆遺失。

Type

bug

Expected

gh-egress.shedit(與 create/comment)對空或近乎空的 body 應拒絕派送(exit non-zero + 明確訊息),理由與既有 zero-tolerance 機械項(literal /Users/<name>~/.claude.json)同構:這是 caller 端 shell 組字串失敗的典型症狀,不是合法意圖。建議:

  • edit:body 長度 < 某個下限(如 10 chars strip 後)→ refuse(exit 5?),訊息提示「upstream composition 可能失敗;若真要清空 body 請加 --allow-empty-body
  • create/comment 同理(空 comment/issue 幾乎必是 bug)

Impact

  • edit覆寫語意,空 body = 資料遺失;所有經 egress 的 IDD skills(idd-issue Step 4.6/4.7 PATCH、idd-update body sync、idd-clarify Step 6…)都在這條路徑上
  • Caller 端 "$(cat file)" + 上游 silent failure 是 bash 慣用組合,防線應在 choke-point(egress 正是為此存在)

重現

: > /tmp/empty.md
bash scripts/gh-egress.sh edit <N> --repo <own-test-repo> --body "$(cat /tmp/empty.md)" --scrub-attested warn
# → issue body 被清空,exit 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions