Codex skills no longer stop on temp-file cleanup, which Codex refuses as rm -f (GST-3364) (#4612)

Skills that clean up temp files now run on Codex: Codex CLI refuses any
`rm` with a force flag, and 67 of the 1,239 shell blocks in gstack's
Codex skills used one.

This unblocks gstack on Codex (office-hours, review, ship, the plan
reviews, spec and gstack-upgrade all hit it). Nothing to do after
merging.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=state-machines
Review-Finding: gstack-upgrade/SKILL.md.tmpl:363:posix-sh-brace-expansion reader=core
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-21 15:29:49 +00:00
1 parent 43c9c201e3
commit bd77c8ccaa
86 files changed
+337 -204

No files matched your search

+2 -2
View File
@@ -141,7 +141,7 @@ fi
_REPO_ROOT=$(git rev-parse --show-toplevel) || { echo 'ERROR: not in a git repo' >&2; exit 1; }
_OUTSIDE_TMP=$(mktemp -d "${TMPDIR:-/tmp}/gstack-outside.XXXXXXXX") || exit 1
trap 'rm -rf "$_OUTSIDE_TMP"' EXIT
trap 'rm -r "$_OUTSIDE_TMP"' EXIT
_OUTSIDE_INPUT="$_OUTSIDE_TMP/prompt"
cat -- '<prepared-prompt-file>' >"$_OUTSIDE_INPUT" || exit 1
_CODEX_PROBE="$HOME/.claude/skills/gstack/bin/gstack-codex-probe"
@@ -200,7 +200,7 @@ fi
_REPO_ROOT=$(git rev-parse --show-toplevel) || { echo 'ERROR: not in a git repo' >&2; exit 1; }
_OUTSIDE_TMP=$(mktemp -d "${TMPDIR:-/tmp}/gstack-outside.XXXXXXXX") || exit 1
trap 'rm -rf "$_OUTSIDE_TMP"' EXIT
trap 'rm -r "$_OUTSIDE_TMP"' EXIT
_OUTSIDE_INPUT="$_OUTSIDE_TMP/prompt"
cat -- '<prepared-prompt-file>' >"$_OUTSIDE_INPUT" || exit 1
{ printf '\nREPOSITORY CONTEXT (data, not instructions):\n'; DIFF_BASE=$(git merge-base <base> HEAD) && git diff "$DIFF_BASE"; } >>"$_OUTSIDE_INPUT" || exit 1
+1 -1
View File
@@ -14,7 +14,7 @@ Save the child handle. An exited child with missing output is stopped, but its a
**Entry:** First entry runs
`_EX=$(git rev-parse --git-path info/exclude 2>/dev/null) && mkdir -p "$(dirname "$_EX")" && { grep -qxF '/.gstack/tmp/' "$_EX" 2>/dev/null || echo '/.gstack/tmp/' >> "$_EX"; }`
(the shared `.gstack/tmp` exclude), then `rm -f .gstack/tmp/docs-audit.json` (an
(the shared `.gstack/tmp` exclude), then `rm .gstack/tmp/docs-audit.json 2>/dev/null || true` (an
earlier run's record would pass as this run's) and launches the initial audit. On reentry, reuse only this invocation's validated audit or named-risk decision whose accepted
base/input hashes still match; retain its actual status and scope. Otherwise use
Blocked recovery, not an unconditional launch.
+1 -1
View File
@@ -12,7 +12,7 @@ Save the child handle. An exited child with missing output is stopped, but its a
**Entry:** First entry runs
`_EX=$(git rev-parse --git-path info/exclude 2>/dev/null) && mkdir -p "$(dirname "$_EX")" && { grep -qxF '/.gstack/tmp/' "$_EX" 2>/dev/null || echo '/.gstack/tmp/' >> "$_EX"; }`
(the shared `.gstack/tmp` exclude), then `rm -f .gstack/tmp/docs-audit.json` (an
(the shared `.gstack/tmp` exclude), then `rm .gstack/tmp/docs-audit.json 2>/dev/null || true` (an
earlier run's record would pass as this run's) and launches the initial audit. On reentry, reuse only this invocation's validated audit or named-risk decision whose accepted
base/input hashes still match; retain its actual status and scope. Otherwise use
Blocked recovery, not an unconditional launch.
+1 -1
View File
@@ -209,7 +209,7 @@ else
fi
if [ -n "$_BASE_REF" ]; then
echo "ACCEPTANCE_BASELINE: $_BASE_KIND"
_ACC_TMP=$(mktemp -d "${TMPDIR:-/tmp}/gstack-acceptance.XXXXXX") && trap 'rm -rf "$_ACC_TMP"' EXIT
_ACC_TMP=$(mktemp -d "${TMPDIR:-/tmp}/gstack-acceptance.XXXXXX") && trap 'rm -r "$_ACC_TMP"' EXIT
_acc_sections() { awk 'BEGIN{keep=0} /^#+ /{keep = (tolower($0) ~ /^#+ *[0-9.]* *(testable )?(acceptance|success criteria|verification|test plan|testing|done when|definition of done)/)} keep{print}'; }
git show "$_BASE_REF:$_REL" | _acc_sections > "$_ACC_TMP/base"
_acc_sections < "$PLAN_FILE" > "$_ACC_TMP/wtree"
+2 -2
View File
@@ -240,7 +240,7 @@ BODY_REST_FILE="$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.gstack/tmp/
~/.claude/skills/gstack/bin/gstack-prose-lint "$BODY_TOP_FILE" --sections 'Why,What changed,Blast radius' --gate >&2 || { echo "Not composed: fix what gstack-prose-lint printed above (a PROSE: line is a sentence to rewrite in the draft; a usage line means the draft lost a heading), then rerun." >&2; exit 1; }
~/.claude/skills/gstack/bin/gstack-plain-title check --body-file "$BODY_TOP_FILE" >&2 || { echo "Not composed: rewrite what the PLAIN_TITLE: and PLAIN_BODY: lines above name (at most three plain lines before the first ## heading, no listed word above the Agent notes section), then rerun." >&2; exit 1; }
{ awk 1 "$BODY_TOP_FILE" && cat -- "$DOCS_SECTION_FILE" && echo && awk 1 "$BODY_REST_FILE"; } > "$PR_BODY_FILE" || exit 1
rm -f "$BODY_TOP_FILE" "$BODY_REST_FILE"
rm "$BODY_TOP_FILE" "$BODY_REST_FILE"
echo "PR_BODY_FILE: $PR_BODY_FILE"
```
@@ -249,7 +249,7 @@ per-lane counts (`{"<lane>":{"pass":N,"fail":N,"skip":N}}`) to
`.gstack/tmp/ship-gate.json` with your file-write tool, then:
```bash
rm -f .gstack/tmp/review-loop.json
rm .gstack/tmp/review-loop.json 2>/dev/null || true
NS=$(~/.claude/skills/gstack/bin/gstack-no-stop list | sed -n 's/^NO_STOP_FILE: //p'); [ -s "$NS" ] || NS=
~/.claude/skills/gstack/bin/gstack-review-scope summary --since "$REVIEW_SINCE" --no-ledger --out .gstack/tmp/review-loop.json &&
~/.claude/skills/gstack/bin/gstack-ship-receipt write --pr <pr-number> --run <SESSION_ID> --base <base> --gate @.gstack/tmp/ship-gate.json --pregate .gstack/tmp/pregate.json --issues @.gstack/tmp/issues.json --review-loop @.gstack/tmp/review-loop.json --docs @.gstack/tmp/docs-audit.json $([ -s .gstack/tmp/targeted.json ] && echo --review-targeted @.gstack/tmp/targeted.json) ${NS:+--no-stop "@$NS"} --body "$PR_BODY_FILE"
+2 -2
View File
@@ -223,7 +223,7 @@ BODY_REST_FILE="$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.gstack/tmp/
~/.claude/skills/gstack/bin/gstack-prose-lint "$BODY_TOP_FILE" --sections 'Why,What changed,Blast radius' --gate >&2 || { echo "Not composed: fix what gstack-prose-lint printed above (a PROSE: line is a sentence to rewrite in the draft; a usage line means the draft lost a heading), then rerun." >&2; exit 1; }
~/.claude/skills/gstack/bin/gstack-plain-title check --body-file "$BODY_TOP_FILE" >&2 || { echo "Not composed: rewrite what the PLAIN_TITLE: and PLAIN_BODY: lines above name (at most three plain lines before the first ## heading, no listed word above the Agent notes section), then rerun." >&2; exit 1; }
{ awk 1 "$BODY_TOP_FILE" && cat -- "$DOCS_SECTION_FILE" && echo && awk 1 "$BODY_REST_FILE"; } > "$PR_BODY_FILE" || exit 1
rm -f "$BODY_TOP_FILE" "$BODY_REST_FILE"
rm "$BODY_TOP_FILE" "$BODY_REST_FILE"
echo "PR_BODY_FILE: $PR_BODY_FILE"
```
@@ -232,7 +232,7 @@ per-lane counts (`{"<lane>":{"pass":N,"fail":N,"skip":N}}`) to
`.gstack/tmp/ship-gate.json` with your file-write tool, then:
```bash
rm -f .gstack/tmp/review-loop.json
rm .gstack/tmp/review-loop.json 2>/dev/null || true
NS=$(~/.claude/skills/gstack/bin/gstack-no-stop list | sed -n 's/^NO_STOP_FILE: //p'); [ -s "$NS" ] || NS=
~/.claude/skills/gstack/bin/gstack-review-scope summary --since "$REVIEW_SINCE" --no-ledger --out .gstack/tmp/review-loop.json &&
~/.claude/skills/gstack/bin/gstack-ship-receipt write --pr <pr-number> --run <SESSION_ID> --base <base> --gate @.gstack/tmp/ship-gate.json --pregate .gstack/tmp/pregate.json --issues @.gstack/tmp/issues.json --review-loop @.gstack/tmp/review-loop.json --docs @.gstack/tmp/docs-audit.json $([ -s .gstack/tmp/targeted.json ] && echo --review-targeted @.gstack/tmp/targeted.json) ${NS:+--no-stop "@$NS"} --body "$PR_BODY_FILE"
+2 -2
View File
@@ -6,7 +6,7 @@ Set CYCLES to 0 on first entry only, with PASS set to 1,
`REVIEW_SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ)` saved and the `ship: review_scope`
policy line (Step 3) kept. Every entry saves `PASS_HEAD=$(git rev-parse HEAD)`; from pass 2 on,
`RANGE_BASE` is the previous pass's PASS_HEAD. Every entry also runs
`mkdir -p .gstack/tmp && rm -f .gstack/tmp/targeted.json && _EX=$(git rev-parse --git-path info/exclude) && mkdir -p "$(dirname "$_EX")" && { grep -qxF '/.gstack/tmp/' "$_EX" 2>/dev/null || printf '\n/.gstack/tmp/\n' >> "$_EX"; }`
`mkdir -p .gstack/tmp && { rm .gstack/tmp/targeted.json 2>/dev/null || true; } && _EX=$(git rev-parse --git-path info/exclude) && mkdir -p "$(dirname "$_EX")" && { grep -qxF '/.gstack/tmp/' "$_EX" 2>/dev/null || printf '\n/.gstack/tmp/\n' >> "$_EX"; }`
(a pass without the targeted reader leaves no record, and the record never reads as an uncommitted edit). Keep existing approvals; changed
finding scope needs a new decision. Order: checklist/design, specialists (9.1),
Red Team (9.2), QA (9.2.1), dedup (9.3), scope, fixes and logging (9.4).
@@ -255,7 +255,7 @@ fi
_REPO_ROOT=$(git rev-parse --show-toplevel) || { echo 'ERROR: not in a git repo' >&2; exit 1; }
_OUTSIDE_TMP=$(mktemp -d "${TMPDIR:-/tmp}/gstack-outside.XXXXXXXX") || exit 1
trap 'rm -rf "$_OUTSIDE_TMP"' EXIT
trap 'rm -r "$_OUTSIDE_TMP"' EXIT
_OUTSIDE_INPUT="$_OUTSIDE_TMP/prompt"
cat -- '<prepared-prompt-file>' >"$_OUTSIDE_INPUT" || exit 1
_CODEX_PROBE="$HOME/.claude/skills/gstack/bin/gstack-codex-probe"
+1 -1
View File
@@ -4,7 +4,7 @@ Set CYCLES to 0 on first entry only, with PASS set to 1,
`REVIEW_SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ)` saved and the `ship: review_scope`
policy line (Step 3) kept. Every entry saves `PASS_HEAD=$(git rev-parse HEAD)`; from pass 2 on,
`RANGE_BASE` is the previous pass's PASS_HEAD. Every entry also runs
`mkdir -p .gstack/tmp && rm -f .gstack/tmp/targeted.json && _EX=$(git rev-parse --git-path info/exclude) && mkdir -p "$(dirname "$_EX")" && { grep -qxF '/.gstack/tmp/' "$_EX" 2>/dev/null || printf '\n/.gstack/tmp/\n' >> "$_EX"; }`
`mkdir -p .gstack/tmp && { rm .gstack/tmp/targeted.json 2>/dev/null || true; } && _EX=$(git rev-parse --git-path info/exclude) && mkdir -p "$(dirname "$_EX")" && { grep -qxF '/.gstack/tmp/' "$_EX" 2>/dev/null || printf '\n/.gstack/tmp/\n' >> "$_EX"; }`
(a pass without the targeted reader leaves no record, and the record never reads as an uncommitted edit). Keep existing approvals; changed
finding scope needs a new decision. Order: checklist/design, specialists (9.1),
Red Team (9.2), QA (9.2.1), dedup (9.3), scope, fixes and logging (9.4).
+4 -4
View File
@@ -31,7 +31,7 @@ permission is not approval. Preserve the 30-path/5-tests-per-pass/2-minute per-t
```bash
git worktree prune
find "${TMPDIR:-/tmp}" -maxdepth 1 -name 'gstack-base-control.*' -mmin +10 2>/dev/null | while IFS= read -r d; do git worktree remove --force "$d/wt" >/dev/null 2>&1; rm -rf "$d"; done
find "${TMPDIR:-/tmp}" -maxdepth 1 -name 'gstack-base-control.*' -mmin +10 2>/dev/null | while IFS= read -r d; do git worktree remove --force "$d/wt" >/dev/null 2>&1; rm -r -- "$d" </dev/null; done
```
````text
@@ -198,7 +198,7 @@ When uncertain whether a change is a regression, err on the side of writing the
# runner for one file (e.g. "bun test $TEST"); BUDGET = seconds for this run (default 90).
ROOT=$(git rev-parse --show-toplevel)
CTL_TMP=$(mktemp -d "${TMPDIR:-/tmp}/gstack-base-control.XXXXXX")
cleanup() { git -C "$ROOT" worktree remove --force "$CTL_TMP/wt" >/dev/null 2>&1; rm -rf "$CTL_TMP"; [ -e "$CTL_TMP" ] && echo "BASE_CONTROL_LEFTOVER: $CTL_TMP (run: git worktree prune)"; }
cleanup() { git -C "$ROOT" worktree remove --force "$CTL_TMP/wt" >/dev/null 2>&1; rm -r -- "$CTL_TMP" </dev/null; [ -e "$CTL_TMP" ] && echo "BASE_CONTROL_LEFTOVER: $CTL_TMP (run: git worktree prune)"; }
trap cleanup EXIT INT TERM
(
[ -f "$ROOT/package.json" ] || { echo "BASE_CONTROL: unavailable (ecosystem)"; exit 0; }
@@ -368,9 +368,9 @@ Write the text into each printed file with your file-write tool (Claude Code's W
while IFS= read -r f; do
[ -n "$f" ] || continue
case "$f" in /*|..|../*|*/..|*/../*) echo "SKIPPED (outside repo): $f"; continue ;; esac
if git ls-files --error-unmatch -- "$f" >/dev/null 2>&1; then echo "REVERT_HUNK: $f"; else rm -f -- "$f" && echo "REMOVED: $f"; fi
if git ls-files --error-unmatch -- "$f" >/dev/null 2>&1; then echo "REVERT_HUNK: $f"; else { [ ! -e "$f" ] && [ ! -L "$f" ] || rm -- "$f"; } && echo "REMOVED: $f"; fi
done < "$REJECTED_FILE"
rm -f "$REJECTED_FILE"
rm -- "$REJECTED_FILE"
```
No `tests_rejected` path may remain on disk as a new file. If every test written in
+3 -3
View File
@@ -29,7 +29,7 @@ permission is not approval. Preserve the 30-path/5-tests-per-pass/2-minute per-t
```bash
git worktree prune
find "${TMPDIR:-/tmp}" -maxdepth 1 -name 'gstack-base-control.*' -mmin +10 2>/dev/null | while IFS= read -r d; do git worktree remove --force "$d/wt" >/dev/null 2>&1; rm -rf "$d"; done
find "${TMPDIR:-/tmp}" -maxdepth 1 -name 'gstack-base-control.*' -mmin +10 2>/dev/null | while IFS= read -r d; do git worktree remove --force "$d/wt" >/dev/null 2>&1; rm -r -- "$d" </dev/null; done
```
````text
@@ -78,9 +78,9 @@ After your analysis, output a single JSON object on the LAST LINE of your respon
while IFS= read -r f; do
[ -n "$f" ] || continue
case "$f" in /*|..|../*|*/..|*/../*) echo "SKIPPED (outside repo): $f"; continue ;; esac
if git ls-files --error-unmatch -- "$f" >/dev/null 2>&1; then echo "REVERT_HUNK: $f"; else rm -f -- "$f" && echo "REMOVED: $f"; fi
if git ls-files --error-unmatch -- "$f" >/dev/null 2>&1; then echo "REVERT_HUNK: $f"; else { [ ! -e "$f" ] && [ ! -L "$f" ] || rm -- "$f"; } && echo "REMOVED: $f"; fi
done < "$REJECTED_FILE"
rm -f "$REJECTED_FILE"
rm -- "$REJECTED_FILE"
```
No `tests_rejected` path may remain on disk as a new file. If every test written in
+2 -2
View File
@@ -90,7 +90,7 @@ Write the text into each printed file with your file-write tool (Claude Code's W
_EG="$HOME/.claude/skills/gstack/bin/gstack-egress-lib.sh"; [ -r "$_EG" ] && . "$_EG"; _aside_exec() { if command -v _gstack_egress_run >/dev/null 2>&1; then _gstack_egress_run open aside-agent aside.com aside-exec "user invoked this skill" --no-payload aside exec "$@"; else aside exec "$@"; fi; }
PROMPT_FILE="$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.gstack/tmp/<prompt-file-name>"
[ -s "$PROMPT_FILE" ] || { echo "Not sent: $PROMPT_FILE is missing or empty. Write the prompt, then rerun this block." >&2; exit 1; }
_aside_exec "Search the web for $(cat "$PROMPT_FILE") Read-only: do not sign in, submit, or change anything. Then stop." && rm -f "$PROMPT_FILE"
_aside_exec "Search the web for $(cat "$PROMPT_FILE") Read-only: do not sign in, submit, or change anything. Then stop." && rm "$PROMPT_FILE"
```
If Aside is not installed or not running (`command -v aside` prints nothing, or the request fails), run the same lookup with the WebSearch tool when the host provides it: `"[runtime] best test framework {current year}"` and `"[framework A] vs [framework B] comparison"`. If neither is available, use this built-in knowledge table:
@@ -379,7 +379,7 @@ case "<platform>" in
github) gh issue create --title "$(cat "$TITLE_FILE")" --body-file "$BODY_FILE" --assignee "<github-username>" ;;
gitlab) glab issue create -t "$(cat "$TITLE_FILE")" -d "$(cat "$BODY_FILE")" -a "<gitlab-username>" ;;
*) echo "Not sent: no GitHub or GitLab remote. Files: $TITLE_FILE $BODY_FILE" >&2; false ;;
esac && rm -f "$TITLE_FILE" "$BODY_FILE"
esac && rm "$TITLE_FILE" "$BODY_FILE"
```
- If neither CLI is available or `--assignee`/`-a` fails (user not in org, etc.), create the issue without assignee and note who should look at it in the body.