Skip to content

Keep the reviewed head's instruction files and skills away from Codex reviewers - #1432

Merged
mergify[bot] merged 6 commits into
mainfrom
lean178/1107-codex-repo-instructions-2
Nov 26, 2026
Merged

mergify[bot] merged 6 commits into
mainfrom
lean178/1107-codex-repo-instructions-2

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Keep the reviewed head's instruction files and skills away from Codex reviewers

Context and goal

  • Goal: A Codex review follows only loop-zero's fixed review policy; a PR can no longer address its own reviewer through the instruction files or skills it changes.
  • Problem: The Codex reviewer runs inside the PR's checkout, and Codex loads that checkout's AGENTS.md (or AGENTS.override.md) as instructions and lists the skills under .agents/skills and .codex/skills; a $name mention in the prompt, which carries PR text, also injects a skill's full body. The PR controls all of these files.
  • Context: Codex reads project instruction files ("project docs") and repository skills from the working directory. project_doc_max_bytes=0 turns project docs off. Codex has no switch that turns repository skills off as a group: its skills.config list disables individual skills by exact SKILL.md path or name. The Claude reviewer already runs with --setting-sources "", which keeps project settings and CLAUDE.md out.

Closes #1107

Acceptance

  • A Codex review of a head that adds instruction text to AGENTS.md, AGENTS.override.md, .agents/skills/*/SKILL.md and .codex/skills/*/SKILL.md leaves none of that text in the session rollout, including when the prompt mentions those skills by name (verified against the pinned Codex 0.167.0 and the current 0.170.0).
  • The Codex runner argv carries project_doc_max_bytes=0 and a skills.config entry disabling every SKILL.md under the checkout's .agents/skills and .codex/skills, including nested and symlinked skills. A skill directory linking outside the checkout fails the attempt before anything behind the link is scanned and before Codex starts, and so does a disable list too large for one process argument; both fail as an ordinary runner failure, so the next reviewer family is tried. The runner argv test asserts this; the existing Claude argv test still asserts --setting-sources "".
  • ARCHITECTURE.md states which repository instruction surfaces each reviewer family loads and from which revision; CONTRACT.md no longer calls repository instructions an instruction surface.

Notes

  • Replaces PR Keep the reviewed head's instruction files and skills away from Codex reviewers #1187: its repair commits after the second (delta) review need review coverage, and the contract puts a head that needs another review in a new PR. This PR carries the same change plus those repairs, merged with current main; Keep the reviewed head's instruction files and skills away from Codex reviewers #1187's threads record the earlier findings and dispositions.
  • Design pass (trust boundary): the reviewed head is untrusted; the review policy and the pinned base configuration are trusted. Invariant: no file from the reviewed head reaches the reviewer as an instruction (system, developer, project-doc or skill text); head files reach it only as evidence. Chosen approach: Codex's own config options at launch, no sandbox mount changes.
  • Evidence (local probes on throwaway repositories, codex debug prompt-input and live codex exec session rollouts): without options, AGENTS.override.md text and both skill descriptions appear; project_doc_max_bytes=0 removes the project doc only; skills.include_instructions=false hides the skill list but a $name mention still injected the skill body into the rollout; per-path skills.config entries (link path or target path both match) removed every planted string from a live 0.167.0 rollout even with mentions. Codex ignored the head's .codex/config.toml (untrusted project) and did not discover skills under .claude/skills, .github/skills, skills/ or nested .agents/skills below the root.
  • Regression proof: tests/test_runners.py::test_codex_ignores_repository_instructions_and_skills fails on pre-fix source (no project_doc_max_bytes=0) and passes after.
  • Earlier review round one on Keep the reviewed head's instruction files and skills away from Codex reviewers #1187 (Codex): fail closed on skill directories linking outside the checkout (checked before scanning), and on an override list over 100 KB (Linux rejects one argument over 128 KiB). Regression tests fail at the reviewed head.
  • Earlier review round two on Keep the reviewed head's instruction files and skills away from Codex reviewers #1187 (Codex delta): the skill list is computed before either Codex probe (--version, exec --help) runs; enumeration errors such as a symlink loop, and skill paths that cannot be encoded as UTF-8, now fail as runner errors (family fallback) instead of escaping. Tests log every fake Codex call and fail at the delta-reviewed head. This was the last review round under the budget.
  • Review round one on this PR (Codex): every skill link is now resolved strictly, roots included, so a looping or dangling link fails the attempt instead of being skipped (Codex could resolve it differently), and a symlinked SKILL.md is disabled by its target; a DEL character in a path is escaped for TOML. Tests fail at the reviewed head.
  • Limit: the skill roots are Codex's current discovery locations; a Codex release that adds roots needs this list updated. Codex versions are already reviewed before the reviewer allowlist moves.

Base

main @ c5232bb
Base: c5232bb

Validation

Recorded for 062029ee2874

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

  • primary, codex, c3c3216, request_changes
  • delta, codex, 15469fa, request_changes

eowca and others added 4 commits November 26, 2026 00:55
…ewers

The Codex reviewer now launches with project_doc_max_bytes=0, so the
reviewed head's AGENTS.md and AGENTS.override.md are not loaded, and with
a skills.config entry disabling every skill under the checkout's
.agents/skills and .codex/skills. The PR controls both surfaces; they
now reach the reviewer only as evidence. ARCHITECTURE.md and CONTRACT.md
state which instruction surfaces each reviewer loads.

Closes #1107

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A skill directory under the reviewed checkout that links outside it is
now rejected before anything behind the link is scanned, and a disable
list too large for one process argument fails as a runner error, so
neither can leave a PR-selected skill enabled or crash the launch.

Refs #1107

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The repository skill list is now computed before the Codex version and
help probes run, and any error while listing skills, including symlink
loops and paths that cannot be encoded as UTF-8, fails the attempt as a
runner error so the next reviewer family is tried.

Refs #1107

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero primary review by codex on c3c32168e8ffce639e63f71a1f2601e11ba89a4c, 87.6s: request_changes (1 critical, 1 important, 0 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model gpt-6.2-astra (effort medium); CLI-reported model gpt-6.2-astra (effort medium); configured model gpt-6.2-astra (effort medium)
Raw reviewer output
Native Codex transcript retained in the restricted local review receipt; public evidence is publisher-derived, not backend attestation. Exact raw SHA256: 0e9c888e170aef627dd7871d78a9f089c609f4c2ac1459c7da8760de38250356

Comment thread src/loopzero/runners.py Resolved
Comment thread src/loopzero/runners.py Resolved
A looping or dangling link at or under either skill root now fails the
Codex attempt instead of being skipped, a symlinked SKILL.md is disabled
by its target, and a DEL character in a skill path is escaped so the
skills.config override stays valid TOML.

Refs #1107

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero delta review by codex on 15469fa011cbc136e64b16392ce0e1e1d0f90c41, 28.7s: request_changes (0 critical, 1 important, 1 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model gpt-6.2-astra (effort medium); CLI-reported model gpt-6.2-astra (effort medium); configured model gpt-6.2-astra (effort medium)
Raw reviewer output
Native Codex transcript retained in the restricted local review receipt; public evidence is publisher-derived, not backend attestation. Exact raw SHA256: 6e9071690fe7e5c2eb6276d18d8f87c0fb5d233ae0bd08a26eec6884a985dda8

Comment thread src/loopzero/runners.py Resolved
Comment thread tests/test_runners.py


def _plant_skills(repo: Path) -> None:
for skill in (repo / ".agents/skills/a/b", repo / ".agents/skills/e\x7f", repo / ".codex/skills/c", repo / "docs/d"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Cover a symlink on SKILL.md itself

The argv test covers a symlinked directory, but every SKILL.md in the fixture is a regular file. Add a SKILL.md symlink to an in-checkout file with a different basename and assert that the disable entry contains the resolved target. This exercises the file-link behavior independently of directory traversal.

@eowca
eowca marked this pull request as ready for review November 26, 2026 06:51
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 89788a4 at 06:58 UTC

5 min in the queue, 3 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 06:52 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1574
  • ✅ Merged 06:58 · 89788a4 · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 89788a4 into main Nov 26, 2026
15 checks passed
@eowca
eowca deleted the lean178/1107-codex-repo-instructions-2 branch November 26, 2026 06:58
@mergify mergify Bot removed the queued label Nov 26, 2026
eowca added a commit that referenced this pull request Nov 26, 2026
Architecture-Review: unchanged; the merge retains the landed review policy and validates the skill parent paths at the existing pre-launch boundary.
Co-Authored-By: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: Codex reviewer loads the PR head's AGENTS.md and .codex/skills as instructions

1 participant