Skip to content

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

Closed
eowca wants to merge 3 commits into
mainfrom
lean178/1107-codex-repo-instructions
Closed

eowca wants to merge 3 commits into
mainfrom
lean178/1107-codex-repo-instructions

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

  • 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.
  • Review round one (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.
  • Review round two (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.
  • 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 @ 5137bf0
Base: 5137bf0

Validation

Recorded for dcffe163a90a

  • 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, c3d060d, request_changes
  • delta, codex, 6b8e883, request_changes

…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>

@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 c3d060d8995fc41bbb6fcb442f7066a8cca3fac4, 51.7s: request_changes (1 critical, 2 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: 3ef17a40309408ea82c4d14cd06331bd789de013736630b3b280d8f9f8818b71

Comment thread src/loopzero/runners.py Resolved
Comment thread src/loopzero/runners.py Resolved
Comment thread src/loopzero/runners.py Resolved
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>

@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 6b8e883296ce764aa7c7f4061e52ae7d1df0740e, 31.7s: request_changes (0 critical, 3 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: fdebc324cab3727901a6e7beb98283f808aa2a11c87d95b340df5d56fbfc8405

Comment thread src/loopzero/runners.py Resolved
Comment thread src/loopzero/runners.py Resolved
Comment thread tests/test_runners.py Resolved
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>
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Parked. Head dcffe16 carries repair commits after the second (delta) review, so it has no covering review; the contract puts it in a new PR. It also needs a merge of current main, and its tests add lines against the 13,500 test-line cap that main has nearly reached. Next: once the test cap is raised, create a replacement branch from dcffe16, merge origin/main, loopzero check, loopzero pr, review, land, then close this PR.

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #1432, which carries this change plus the repairs made after this PR's second (delta) review, merged with current main, for a fresh review. Findings and dispositions stay recorded in this PR's threads.

@eowca eowca closed this Nov 26, 2026
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