mirror of https://github.com/garrytan/gstack.git
On macOS, /codex (all three modes) failed before Codex ever ran: the mktemp calls that create the stderr/prompt/response temp files errored out, the bash block exited 1, and the user got no review. Two compounding, independent bugs. 1. Suffix after the placeholder. The codex skill used templates like `mktemp "$TMP_ROOT/codex-err-XXXXXX.txt"` (also codex-prompt / codex-resp). GNU mktemp tolerates a suffix after the X run, but BSD mktemp (macOS) does not substitute the X's at all when the placeholder isn't at the end — so call #1 creates a LITERAL `codex-err-XXXXXX.txt` (exit 0) and a later call (a second /codex run, a stale leftover, or a concurrent worktree) fails with `mkstemp failed: File exists` and aborts. The failure is state-dependent, which is why some macOS users saw /codex "work." Fix: move the placeholder to the end of every codex mktemp template (drop the `.txt` suffix) in codex/SKILL.md.tmpl, regenerate codex/SKILL.md. 2. Trailing slash in TMP_ROOT. bin/gstack-paths emitted TMP_ROOT straight from $TMPDIR, which on macOS ends in `/` (e.g. /var/folders/.../T/), so "$TMP_ROOT/codex-err-..." expanded with a double slash. Fix: strip the trailing slash at the source so every consumer benefits, not just /codex (a bare "/" is preserved, not collapsed to empty). Both fixes are needed; the suffix bug is independent of the slash bug. Adds test/regression-issue2091-codex-bsd-mktemp.test.ts: a static invariant that no codex mktemp template carries a suffix after XXXXXX (asserted across both the .tmpl and the generated SKILL.md so regen drift can't reopen it), plus runtime checks that gstack-paths normalizes the trailing slash. Reported-by: Scott Hardin (@scotthardin) Refs #2091 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| SKILL.md | ||
| SKILL.md.tmpl | ||