Repository navigation
Keep bundled and reviewed-checkout skills out of Codex runs - #2107
Merged
Merged
Conversation
The pinned Codex 0.142.2 installs five skills of its own under CODEX_HOME/skills/.system on every start (skill-installer, which fetches from GitHub, skill-creator, plugin-creator, openai-docs and imagegen) and lists them to the model. A $name anywhere in the goal makes the CLI read that SKILL.md into the turn as a user message before the model acts: at the start of a line, mid-sentence, glued to a word, after a backslash, in backticks, or as [$name](path). Goals carry text the platform does not author (webhook bodies, fork pull requests, other models' output), so untrusted text could put an unsanctioned skill's instructions in front of the model. The scan cannot be avoided. exec hands its prompt over as one text input with no structured channel, the CLI scans every text input, and no setting or feature flag turns the scan off. skills.include_instructions and --disable mentions_v2 leave it running. Escaping is no fix: a backslash does not stop it, and only changing the character after the $ does, which changes what the model reads. What a mention can resolve can be narrowed. Every Codex invocation, exec and exec resume, now carries -c skills.bundled.enabled=false. The CLI then lists none of its own skills, injects none, and removes the .system cache from the run's config home. The persona's skills still load and still resolve a mention, as before. 0.147.0 behaves the same. An output reviewer needs more. Its cwd is the branch under review, and its goal holds the producer's goal and the names of the files the producer changed, so "notes/$approve-all.md" in that list injected a skill the reviewed party wrote under .agents/skills, or under .codex/skills, which the CLI reads even with the workspace untrusted. A task that loads no repository instructions now also switches off every skill its checkout holds with -c skills.config path rules. The harness finds them the way the CLI does: both roots in the cwd, breadth first, six levels down, dot-named entries skipped, linked directories followed. Each path is keyed as given and as the kernel resolves it. Path rules rather than name rules keep a persona skill of the same name, which a checkout could otherwise use to make the reviewer's own skill ambiguous. A checkout whose skill folder holds more directories than the CLI reads under one root is refused with codex_skill_scan_truncated: past that limit what the CLI loads depends on read order. TOML quoting now escapes every control character, so a directory name cannot make the rules unparseable. Every other run's argv is unchanged. A real-CLI E2E arm, fresh and resumed, names each bundled skill once, each in a spelling of its own. Its positive control drops the override and must list and inject every bundled skill the CLI installed, and it fails if the CLI bundles a skill the goal does not name. A reviewer arm runs the production output-reviewer task over a checkout with a skill in each root, one behind a link and one named like the persona's skill. Its control drops the path rules and must list and inject each one and leave the persona ambiguous; as built none is listed or injected and the persona is. A pin bump fails the arms until they are re-measured, and the sandbox lane requires their markers on the Dockerfile's Codex version.
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
execandexec resume) now carries-c skills.bundled.enabled=false. The pinned 0.142.2 installs five skills of its own underCODEX_HOME/skills/.systemon every start and lists them to the model. A$nameanywhere in the goal injects that skill'sSKILL.mdinto the turn before the model acts: mid-word, after a backslash, in backticks, or as[$name](path).exechas no structured input and no setting turns the mention scan off, so the fix narrows which skills a mention can reach.AgentTask.ExcludeRepositoryInstructions) also switches off every skill its reviewed checkout holds, using-c skills.configpath rules (CodexHarness.AppendRepositorySkillExclusion)..agents/skillsand.codex/skills. The CLI reads.codex/skillseven when the workspace is marked untrusted.notes/$approve-all.mdin the reviewer's goal injected a skill the reviewed party wrote.CodexRepositorySkillsfinds the files the way codex-rs 0.142.2 does: breadth first, six levels down, dot-named entries skipped, linked directories followed. It keys each path both as given and as the kernel resolves it.codex_skill_scan_truncated. Past that limit, which skills the CLI loads depends on the order it reads them; an output review then falls back to the model critic.McpDeclarationWriter.TomlStringnow escapes every control character, so a directory name cannot make the rules unparseable.Test plan
CodexRepositorySkillsTests(9 tests):CodexHarnessTestsshape theoriesGoalChannelE2ETestsfresh and resumed arms, each with its positive controlsandbox-isolation.ymlexpects ≥111 tests and requires theskill-mentions codex-cli review Confined … codex=<pin>marker