C:/Program Files/Git/codex challenge and consult trip destructive_guard on every run (unguarded $PROMPT_FILE in rm)

Aperta Adatta ai principianti
#4,841 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bash
Ambito
tooling

Direzione di ricerca

Leggi codex/sections/challenge-mode.md.tmpl e codex/sections/consult-mode.md.tmpl, poi verifica come vengono mantenuti i relativi file .md generati. L’issue fornisce le righe di pulizia e le sostituzioni protette; verifica che entrambi i comandi superino check-careful.sh, quindi rigenera i file .md. Il lavoro è completato quando nessuno dei due comandi attiva più l’hook e i file generati rispecchiano i template.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What happens

Every /codex challenge and /codex consult run stops at the gstack destructive-command hook:

[careful] Destructive: deletes files outside this session's folder, or through a variable that may be empty.

The trigger is the cleanup line at the end of the bash block:

  • codex/sections/challenge-mode.md.tmpl: rm -f "$TMPRESP" "$TMPRESP.events" "$PROMPT_FILE"
  • codex/sections/consult-mode.md.tmpl: rm -f "$PROMPT_FILE"

$TMPRESP comes from mktemp, so check-careful.sh already treats it as scratch. PROMPT_FILE="$_REPO_ROOT/.gstack/tmp/..." has a $ in its value, so _careful_resolve can't resolve it and flags it as an unguarded variable. The hook is right to be careful here; the skill's own command is what trips it.

Fix

Guard the variable, so an empty value makes the shell abort instead of running rm:

-rm -f "$TMPRESP" "$TMPRESP.events" "$PROMPT_FILE"
+rm -f "$TMPRESP" "$TMPRESP.events" "${PROMPT_FILE:?}"
-rm -f "$PROMPT_FILE"
+rm -f "${PROMPT_FILE:?}"

(plus the regenerated .md files)

Checked

Feeding check-careful.sh the challenge-mode command:

rm -f "$TMPRESP" "$TMPRESP.events" "$PROMPT_FILE"        → permissionDecision: ask
rm -f "$TMPRESP" "$TMPRESP.events" "${PROMPT_FILE:?}"    → {}

Same result for the consult-mode line. Seen at 1145e80a.

Lingua principale
TypeScript
Stelle
143k
Fork
21k
Merge medio
7h 19m
PR unite (30g)
781

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di garrytan/gstack

Tutte le issue di garrytan/gstack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.