Skip to content

Commit 2b3f5b9

Browse files
committed
fix: clean up temp files after Codex invocations in resolver templates
8 mktemp calls in review.ts and design.ts create temp files in /tmp/ for Codex prompt and stderr capture, but never clean them up. Over time these accumulate (~5KB each, per /autoplan or /review run). Fix: add rm -f after each cat of the temp file. Files cleaned up immediately after reading, even on error (|| true).
1 parent 7e0b879 commit 2b3f5b9

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

scripts/resolvers/design.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ codex exec "Review the git diff on this branch. Run 7 litmus checks (YES/NO each
2323
Use a 5-minute timeout (\`timeout: 300000\`). After the command completes, read stderr:
2424
\`\`\`bash
2525
cat "$TMPERR_DRL" && rm -f "$TMPERR_DRL"
26-
\`\`\`
26+
rm -f "$TMPERR_DRL" 2>/dev/null || true\`\`\`
2727
2828
**Error handling:** All errors are non-blocking. On auth failure, timeout, or empty response — skip with a brief note and continue.
2929
@@ -470,7 +470,7 @@ TMPERR_SKETCH=$(mktemp /tmp/codex-sketch-XXXXXXXX)
470470
codex exec "For this product approach, provide: a visual thesis (one sentence — mood, material, energy), a content plan (hero → support → detail → CTA), and 2 interaction ideas that change page feel. Apply beautiful defaults: composition-first, brand-first, cardless, poster not document. Be opinionated." -s read-only -c 'model_reasoning_effort="medium"' --enable web_search_cached 2>"$TMPERR_SKETCH"
471471
\`\`\`
472472
Use a 5-minute timeout (\`timeout: 300000\`). After completion: \`cat "$TMPERR_SKETCH" && rm -f "$TMPERR_SKETCH"\`
473-
473+
rm -f "$TMPERR_SKETCH" 2>/dev/null || true
474474
2. **Claude subagent** (via Agent tool):
475475
"For this product approach, what design direction would you recommend? What aesthetic, typography, and interaction patterns fit? What would make this approach feel inevitable to the user? Be specific — font names, hex colors, spacing values."
476476
@@ -641,7 +641,7 @@ codex exec "${escapedCodexPrompt}" -s read-only -c 'model_reasoning_effort="${re
641641
Use a 5-minute timeout (\`timeout: 300000\`). After the command completes, read stderr:
642642
\`\`\`bash
643643
cat "$TMPERR_DESIGN" && rm -f "$TMPERR_DESIGN"
644-
\`\`\`
644+
rm -f "$TMPERR_DESIGN" 2>/dev/null || true\`\`\`
645645
646646
2. **Claude design subagent** (via Agent tool):
647647
Dispatch a subagent with this prompt:

scripts/resolvers/review.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ Write the full prompt (context block + instructions) to this file. Use the mode-
287287
\`\`\`bash
288288
TMPERR_OH=$(mktemp /tmp/codex-oh-err-XXXXXXXX)
289289
codex exec "$(cat "$CODEX_PROMPT_FILE")" -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached 2>"$TMPERR_OH"
290-
\`\`\`
290+
rm -f "$CODEX_PROMPT_FILE" 2>/dev/null || true\`\`\`
291291
292292
Use a 5-minute timeout (\`timeout: 300000\`). After the command completes, read stderr:
293293
\`\`\`bash
294294
cat "$TMPERR_OH"
295-
rm -f "$TMPERR_OH" "$CODEX_PROMPT_FILE"
295+
rm -f "$TMPERR_OH" 2>/dev/null || truerm -f "$TMPERR_OH" "$CODEX_PROMPT_FILE"
296296
\`\`\`
297297
298298
**Error handling:** All errors are non-blocking — Codex second opinion is a quality enhancement, not a prerequisite.
@@ -376,7 +376,7 @@ codex exec "Review the changes on this branch against the base branch. Run git d
376376
Set the Bash tool's \`timeout\` parameter to \`300000\` (5 minutes). Do NOT use the \`timeout\` shell command — it doesn't exist on macOS. After the command completes, read stderr:
377377
\`\`\`bash
378378
cat "$TMPERR_ADV"
379-
\`\`\`
379+
rm -f "$TMPERR_ADV" 2>/dev/null || true\`\`\`
380380
381381
Present the full output verbatim. This is informational — it never blocks shipping.
382382
@@ -531,7 +531,7 @@ codex exec "<prompt>" -s read-only -c 'model_reasoning_effort="xhigh"' --enable
531531
Use a 5-minute timeout (\`timeout: 300000\`). After the command completes, read stderr:
532532
\`\`\`bash
533533
cat "$TMPERR_PV"
534-
\`\`\`
534+
rm -f "$TMPERR_PV" 2>/dev/null || true\`\`\`
535535
536536
Present the full output verbatim:
537537

0 commit comments

Comments
 (0)