From 29c18e75ed16f8c89162d5311847501622465f6f Mon Sep 17 00:00:00 2001 From: Jayesh Betala Date: Wed, 29 Apr 2026 11:43:17 +0530 Subject: [PATCH] fix(codex): use resume-compatible flags --- codex/SKILL.md | 5 +++-- codex/SKILL.md.tmpl | 5 +++-- test/skill-validation.test.ts | 10 ++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/codex/SKILL.md b/codex/SKILL.md index e90ec7e89..31b7462ac 100644 --- a/codex/SKILL.md +++ b/codex/SKILL.md @@ -1108,7 +1108,7 @@ If no project-scoped match, fall back to `ls -t ~/.claude/plans/*.md 2>/dev/null but warn: "Note: this plan may be from a different project — verify before sending to Codex." **IMPORTANT — embed content, don't reference path:** Codex runs sandboxed to the repo -root (`-C`) and cannot access `~/.claude/plans/` or any files outside the repo. You MUST +root and cannot access `~/.claude/plans/` or any files outside the repo. You MUST read the plan file yourself and embed its FULL CONTENT in the prompt below. Do NOT tell Codex the file path or ask it to read the plan file — it will waste 10+ tool calls searching and fail. @@ -1187,8 +1187,9 @@ fi For a **resumed session** (user chose "Continue"): ```bash _REPO_ROOT=$(git rev-parse --show-toplevel) || { echo "ERROR: not in a git repo" >&2; exit 1; } +cd "$_REPO_ROOT" || exit 1 # Fix 1: wrap with timeout (gtimeout/timeout fallback chain via probe helper) -_gstack_codex_timeout_wrapper 600 codex exec resume "" -C "$_REPO_ROOT" -s read-only -c 'model_reasoning_effort="medium"' --enable web_search_cached --json < /dev/null 2>"$TMPERR" | PYTHONUNBUFFERED=1 python3 -u -c " +_gstack_codex_timeout_wrapper 600 codex exec resume "" -c 'sandbox_mode="read-only"' -c 'model_reasoning_effort="medium"' --enable web_search_cached --json < /dev/null 2>"$TMPERR" | PYTHONUNBUFFERED=1 python3 -u -c " " # Fix 1: same hang detection pattern as new-session block diff --git a/codex/SKILL.md.tmpl b/codex/SKILL.md.tmpl index c311fc80b..5b7a3dd57 100644 --- a/codex/SKILL.md.tmpl +++ b/codex/SKILL.md.tmpl @@ -347,7 +347,7 @@ If no project-scoped match, fall back to `ls -t ~/.claude/plans/*.md 2>/dev/null but warn: "Note: this plan may be from a different project — verify before sending to Codex." **IMPORTANT — embed content, don't reference path:** Codex runs sandboxed to the repo -root (`-C`) and cannot access `~/.claude/plans/` or any files outside the repo. You MUST +root and cannot access `~/.claude/plans/` or any files outside the repo. You MUST read the plan file yourself and embed its FULL CONTENT in the prompt below. Do NOT tell Codex the file path or ask it to read the plan file — it will waste 10+ tool calls searching and fail. @@ -426,8 +426,9 @@ fi For a **resumed session** (user chose "Continue"): ```bash _REPO_ROOT=$(git rev-parse --show-toplevel) || { echo "ERROR: not in a git repo" >&2; exit 1; } +cd "$_REPO_ROOT" || exit 1 # Fix 1: wrap with timeout (gtimeout/timeout fallback chain via probe helper) -_gstack_codex_timeout_wrapper 600 codex exec resume "" -C "$_REPO_ROOT" -s read-only -c 'model_reasoning_effort="medium"' --enable web_search_cached --json < /dev/null 2>"$TMPERR" | PYTHONUNBUFFERED=1 python3 -u -c " +_gstack_codex_timeout_wrapper 600 codex exec resume "" -c 'sandbox_mode="read-only"' -c 'model_reasoning_effort="medium"' --enable web_search_cached --json < /dev/null 2>"$TMPERR" | PYTHONUNBUFFERED=1 python3 -u -c " " # Fix 1: same hang detection pattern as new-session block diff --git a/test/skill-validation.test.ts b/test/skill-validation.test.ts index 24e5e8bad..1c2ab9cc9 100644 --- a/test/skill-validation.test.ts +++ b/test/skill-validation.test.ts @@ -1297,6 +1297,16 @@ describe('Codex skill', () => { expect(content).toContain('codex exec resume'); }); + test('codex/SKILL.md resume command only uses resume-supported flags', () => { + const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8'); + const match = content.match(/codex exec resume[^\n]+/); + expect(match).not.toBeNull(); + const resumeCommand = match![0]; + expect(resumeCommand).not.toContain(' -C '); + expect(resumeCommand).not.toContain(' -s read-only'); + expect(resumeCommand).toContain("-c 'sandbox_mode=\"read-only\"'"); + }); + test('codex/SKILL.md contains cost tracking', () => { const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8'); expect(content).toContain('tokens used');