Skip to content

[bug] idd-issue Step 1 does not immediately persist Claude Code image-cache → cache evicted before Step 4 upload (pasted-image source) #112

Description

@kiki830621

Problem

Incident verbatim (2026-05-20 session, downstream caller kiki830621/ai_martech_global_scripts):
User pasted a screenshot into a /idd-issue invocation. The prompt contained a [Image: source: /Users/che/.claude/image-cache/<session-id>/1.png] annotation. I read the path in Step 1, did Step 2 AskUserQuestion (priority + clarification), Step 3 created the issue (#788 in caller repo), then in Step 4 tried to cp and gh release upload the screenshot — and the entire ~/.claude/image-cache/ was empty. Cache evicted between turns. The data-preservation hard rule was then unfulfillable without asking the user to re-provide.

The current idd-issue SKILL.md Step 1 / Step 4 split assumes the file at [Image: source: <path>] persists from Step 1 (read source) through Step 4 (upload to release). For Claude Code's ~/.claude/image-cache/<session-id>/ this assumption is fragile:

  • The cache directory is per-session (path includes session id).
  • It can be cleared by context compaction, session lifecycle housekeeping, or session-id rollover (e.g., when a session is continued from a previous compacted session and the new agent loop runs under a fresh id).
  • Skill flow has at least one AskUserQuestion turn + several Bash calls between Step 1 and Step 4 — easily long enough for the cache to be evicted by Claude Code internals.

When this hits, the user sees: skill happily created the issue body referencing an attachment in Step 1, then later Step 4 fails to upload because ls of the staged path returns nothing. The fallback is "ask user to re-provide", which violates the spirit of Step 1's data-preservation hard rule (the user's intent was "attach this image", not "attach if cache happens to survive").

Type

bug — Step 1 → Step 4 lifecycle gap for the "pasted image" source type

Expected

When the source is a pasted image (Claude Code [Image: source: <path>] annotation), Step 1 immediately persists the image to a stable staging path (/tmp/idd-issue-attachments/issue_pending_<n>.png or similar) — within the same tool turn that read the annotation. Step 4's gh release upload then references the staged path, not the image-cache path.

In other words: Step 1's "read source" already includes "persist to /tmp", same way docx Step 1 already does export_image(image_id, output_path) instead of relying on the docx file staying mounted in some volatile location.

Actual

Step 1 just notes the image-cache path in conversation and moves on. Step 4's gh release upload <image-cache path> is the first time the file is touched after Step 1, by which point the cache may be gone. The "Pasted image" / "Mixed (text + pasted images)" rows of the Source Type Adapter table in SKILL.md don't mention immediate persistence; they only describe the upload at Step 4.

Suggested fix (incremental, low-risk)

In idd-issue/SKILL.md Step 1 → Source Type Adapter table:

  1. Either replace, or add a new row, for the pasted image source type with an explicit cp [image-cache path] /tmp/idd-issue-attachments/issue_pending_<idx>.png (or equivalent Read-then-Write via tools, since Bash cp is the obvious choice) — done in the same tool turn that first sees the [Image: source: ...] annotation, NOT deferred to Step 4.
  2. The "Mixed (text + pasted images)" row gets the same treatment — every pasted image gets cp'd to staging immediately.
  3. Optional: add an explicit Bash snippet to the SKILL.md (similar to the Telegram fallback template at the bottom of Step 1) showing:
    mkdir -p /tmp/idd-issue-attachments
    for src in "${PASTED_IMAGES[@]}"; do
      cp "$src" "/tmp/idd-issue-attachments/issue_pending_$(date +%s)_$RANDOM.png"
    done
  4. Step 4's gh release upload then reads from /tmp/idd-issue-attachments/, not from ~/.claude/image-cache/.

The fallback (image-cache already gone before Step 1 even runs — rare, but possible if there's a long pre-Step-1 turn for some reason) keeps the existing "ask user to re-provide / re-paste / give path" template, just like Telegram MCP no-download fallback.

Impact

  • Severity: P3 — the fallback (ask user) works, just costs a re-paste turn and breaks the "every attachment is preserved without nag" feel the data-preservation hard rule was reaching for.
  • Frequency: Anytime a session spans multiple turns between Step 1 and Step 4 (which is almost always: AskUserQuestion in Step 2 + Step 2.5/2.6 mention resolve + Step 3 gh issue create + Step 4 upload). The compaction-resumed-session scenario (this incident) is the highest-risk variant.
  • Workaround: Eyeball — the user re-pastes. But that's exactly what Step 1's hard rule was supposed to make unnecessary.

Repro outline (for someone with the plugin source repo open)

  1. Run /idd-issue with a pasted screenshot from a Claude Code session whose ~/.claude/image-cache/ is fresh.
  2. Let Step 1 read the [Image: source: ~/.claude/image-cache/<session-id>/1.png] annotation.
  3. Run AskUserQuestion (e.g., priority clarification) — answer it.
  4. Run a couple more Bash tool calls (anything).
  5. In Step 4, try cp or gh release upload from the original image-cache path.

In a compaction-resumed session (/compact ran since the image was pasted) the cache directory is gone before Step 4 even tries.

Source

In-session incident 2026-05-20 during /idd-issue invocation from kiki830621/ai_martech_global_scripts l4_enterprise workspace. Caller-side issue (the BrandEdge zig-zag bug that triggered this invocation) is kiki830621/ai_martech_global_scripts#788, currently paused pending re-upload of the same screenshot — the upload step is exactly the place where this bug surfaces.

Not cross-referencing #788 directly here (different repo, the cross-repo link wouldn't auto-render anyway); the link is in this body for plugin-author context.


Current Status

  • Phase: closed
  • Complexity: Plan
  • Diagnosed at: 2026-05-20

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions