fix: clear stale claude-prompts dir before each write by kyungilpark · Pull Request #1288 · anthropics/claude-code-action (original) (raw)
Previously, prompt files at ${RUNNER_TEMP}/claude-prompts/ from a prior
invocation could persist on non-ephemeral self-hosted runners (where the
documented RUNNER_TEMP cleanup contract is not reliably honored). In
particular, claude-user-request.txt is only written by create-prompt
when a user request exists; an agent-mode invocation does not overwrite
it, so a stale value left by an earlier mention-mode job in another repo
would leak into a later agent-mode job's effective context on the same
runner agent.
Fix: rm -rf the directory before mkdir in both write sites
(src/create-prompt/index.ts, src/modes/agent/index.ts). Idempotent,
safe on hosted runners (where the dir is already empty), and self-heals
on self-hosted runners.
Closes anthropics#1287