fix(codex): restore filesystem boundary on /codex review bare path#1522
Open
genisis0x wants to merge 1 commit into
Open
fix(codex): restore filesystem boundary on /codex review bare path#1522genisis0x wants to merge 1 commit into
genisis0x wants to merge 1 commit into
Conversation
…arrytan#1503) v1.34.2.0 (garrytan#1478, fixing garrytan#1428) shipped a dual-path approach for /codex review on Codex CLI >=0.130.0 because --base <branch> and a custom prompt are now mutually exclusive at argv level. The default (bare) path calls codex review --base directly with no custom prompt — which means the previously-prefixed filesystem boundary instruction ("do not read files under ~/.claude/, .claude/skills/, agents/, ~/.agents/") is no longer in front of the model when the diff touches those paths. On large diffs that include skill templates (which gstack itself does regularly) codex can spend a meaningful fraction of its token budget reading gstack's own skill definitions, which are meant for a different AI. Apply the issue's suggested option C: detect skill-file paths in the diff and bail out of the bare path into the exec path with a temp-prompt that carries the boundary. The detection is a single git diff --name-only + grep alternation; falling through to the existing exec route reuses all of the boundary scaffolding (DIFF_START/DIFF_END delimiters, exec read-only sandbox, [P1]/[P2] gate marker contract). The exec branch now also makes the Custom focus: line conditional so the synthetic no-instructions fallthrough doesn't print an empty focus. Regen codex/SKILL.md via bun run gen:skill-docs. Skill validation + gen-skill-docs tests still pass (712 ok). Behavior on diffs that don't touch .claude/, .claude/skills/, agents/, or .agents/ is unchanged — the bare review path keeps Codex's internal review-prompt tuning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1503.
v1.34.2.0 (#1478, fixing #1428) shipped a dual-path approach for
/codex reviewon Codex CLI ≥0.130.0 because--base <branch>and a custom prompt are now mutually exclusive at argv level. The default (bare) path callscodex review --basedirectly with no custom prompt, which means the previously-prefixed filesystem-boundary instruction ("do not read files under~/.claude/,.claude/skills/,agents/,~/.agents/") is no longer in front of the model when the diff touches those paths. On large diffs that include skill templates (which gstack itself does regularly) codex can spend a meaningful fraction of its token budget reading skill definitions meant for a different AI system.This PR applies the issue's option C: detect skill-file paths in the diff and bail out of the bare path into the existing exec path, which already carries the boundary.
Implementation
codex/SKILL.md.tmplStep 2A picks up a single new precondition before path selection:Path selection becomes:
_DIFF_TOUCHES_SKILLScodex review --basebarecodex execwith boundarycodex execwith boundary + custom focusThe exec branch's prompt build now makes the
Custom focus:line conditional on$_USER_INSTRUCTIONSso the synthetic boundary-only fallthrough doesn't render an empty focus line.Why not the other two options from the issue
~/.codex/AGENTS.mdopt-in. Cross-machine config that lives outside the gstack tree, so users on fresh installs would still see the leak. The in-skill detection covers everyone running gstack regardless of their codex config.Option C reuses every boundary-related construct already in the exec route (DIFF_START/DIFF_END delimiters, exec read-only sandbox,
[P1]/[P2]gate marker contract), so the gate verdict in step 4 still works without any change.Verification
Behavior on diffs that don't touch
.claude/,.claude/skills/,agents/, or.agents/is unchanged — the bare review path keeps Codex's internal review-prompt tuning, which is exactly what v1.34.2.0 went after.Both
codex/SKILL.md.tmpl(source of truth) and the regeneratedcodex/SKILL.mdare in the diff per the SKILL.md workflow rule in CLAUDE.md.No newsfragment
Per CLAUDE.md ("Contributor PR authors should not edit CHANGELOG.md; maintainer/AI adds entries during landing/merge").