Skip to content

bug(process-attachments.sh): 零 attachment issue 觸發 set -e 早退 — exit 1 且不寫 empty manifest,違反自身 exit-code 契約 (sister concern from che-apple-mail-mcp#173) #187

@kiki830621

Description

@kiki830621

Problem

scripts/process-attachments.sh download <N>issue 完全沒有 attachment 時,detect_urls 內的 grep -oE '...' 零 match 回傳 exit 1,在 set -e 下讓整個 script 於 URLS=$(detect_urls) 處早退 — exit 1、不寫 empty _manifest.json、無任何 stderr 輸出。

實證(2026-06-10,plugin cache 2.85.0,target repo PsychQuant/che-apple-mail-mcp issue #173 — 純文字 issue、零 attachment):

$ IDD_CALLER=idd-diagnose bash scripts/process-attachments.sh download 173
$ echo $?
1
# .claude/.idd/attachments/issue-173/ 目錄已建立但完全空(無 _manifest.json)

bash -x 追蹤確認死點在 URLS=$(detect_urls),detect_urls pipeline 尾端的 grep 零 match exit 1。

Type

bug

Expected

rules/process-attachments.md 與 idd-diagnose SKILL.md Step 1.5 的契約:

Exit code:

  • 0 — 下載完成(或 issue 無 attachment,empty manifest 已寫

零 attachment 是合法且常見的狀態,應 exit 0 並寫 empty manifest。

Actual

零 attachment → exit 1、無 manifest、無輸出。Caller(idd-diagnose Step 1.5)契約把 exit 1 解讀為「部分檔案下載失敗(error 條目已寫進 manifest)」— 但 manifest 根本不存在,兩邊矛盾,AI caller 需要人工介入判斷。

可能修法

detect_urls 的 grep 尾端加 || true(或 grep ... || :),讓零 match 回空字串而非 exit 1;後續以 [ -z "$URLS" ] 分支寫 empty manifest + exit 0(該分支可能已存在、只是永遠到不了)。

Impact

每個對「純文字 issue」跑 idd-diagnose / idd-implement / idd-verify 的 session 都會在 Step 1.5 撞到非預期 exit 1,需 AI 或人工 workaround(手寫 empty manifest)。純文字 issue 是大宗,命中率高。

Source: surfaced during /idd-diagnose PsychQuant/che-apple-mail-mcp#173 sister concern surfacing (Step 3.6) — cross-repo filing

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions