Skip to content

[codex] Load user instructions through an injected provider - #27101

Merged
anp-oai merged 15 commits into
mainfrom
codex/global-instructions-provider
Jun 11, 2026
Merged

[codex] Load user instructions through an injected provider#27101
anp-oai merged 15 commits into
mainfrom
codex/global-instructions-provider

Conversation

@anp-oai

@anp-oai anp-oai commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Why

We want to remove implicit use of $CODEX_HOME from codex-core and make embedders responsible for supplying user-level instructions. This also ensures user instructions load when no primary environment is selected.

What changed

Stacked on #27415, which makes codex exec surface thread-scoped runtime warnings.

  • Added UserInstructionsProvider to codex-extension-api, with absolute source attribution and recoverable loading warnings.
  • Added codex-home with the filesystem-backed provider for AGENTS.override.md and AGENTS.md, preserving precedence, fallback, trimming, lossy UTF-8 handling, and the existing uncapped global instruction size.
  • Removed global instruction loading from Config and require ThreadManager callers to inject a provider.
  • Load provider instructions once for each fresh root runtime, including runtimes without a primary environment. Running sessions retain their snapshot, while child agents inherit the parent snapshot without invoking the provider.
  • Keep provider instructions separate while loading project AGENTS.md, then assemble the model-visible instructions with the existing ordering, source attribution, warning, and turn-context behavior.
  • Wired the Codex home provider through the CLI, app server, MCP server, core facade, and thread-manager sample.

Validation

  • just test -p codex-home -p codex-extension-api
  • just test -p codex-core agents_md
  • just test -p codex-core guardian
  • just test -p codex-app-server thread_start_without_selected_environment_includes_only_global_instruction_source
  • just test -p codex-exec warning
  • just bazel-lock-check

@anp-oai anp-oai changed the title [codex] Load user instructions through an extension provider [codex] Load user instructions through a embedding-injected provider Jun 9, 2026
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from 229d76f to 93fd86b Compare June 9, 2026 01:38
anp-oai added a commit that referenced this pull request Jun 9, 2026
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from 79a26f1 to a36d084 Compare June 9, 2026 01:45
Comment thread codex-rs/core/src/guardian/review_session.rs
Comment thread codex-rs/core/src/session/mod.rs Outdated
Comment thread codex-rs/core/src/session/mod.rs Outdated
Comment thread codex-rs/core/src/session/session.rs Outdated
Comment thread codex-rs/core/src/agents_md_tests.rs
Comment thread codex-rs/ext/extension-api/src/user_instructions.rs Outdated
Comment thread codex-rs/core/src/thread_manager.rs
@anp-oai anp-oai changed the title [codex] Load user instructions through a embedding-injected provider [codex] Load user instructions through an injected provider Jun 9, 2026
Comment thread codex-rs/core/src/session/mod.rs
Comment thread codex-rs/core/src/session/mod.rs
Comment thread codex-rs/core/src/session/mod.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs
Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/thread_manager.rs Outdated
Comment thread codex-rs/core/src/thread_manager.rs Outdated
Comment thread codex-rs/core/src/thread_manager.rs Outdated
Comment thread codex-rs/core/src/session/mod.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/thread_manager.rs Outdated
Comment thread codex-rs/core/src/thread_manager.rs Outdated
Comment thread codex-rs/core/src/thread_manager.rs
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from 419a8f4 to 4024ec7 Compare June 9, 2026 18:20
anp-oai added a commit that referenced this pull request Jun 9, 2026
anp-oai added a commit that referenced this pull request Jun 9, 2026
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from 13364fd to ba87e81 Compare June 9, 2026 18:36
anp-oai added a commit that referenced this pull request Jun 9, 2026
anp-oai added a commit that referenced this pull request Jun 9, 2026
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from ba87e81 to 295bcb2 Compare June 9, 2026 21:21
@anp-oai
anp-oai marked this pull request as ready for review June 9, 2026 21:40
@anp-oai
anp-oai requested a review from a team as a code owner June 9, 2026 21:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 667e8e9a05

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/Cargo.toml
Comment thread codex-rs/core/src/agents_md.rs
Comment thread codex-rs/core/src/session/mod.rs
anp-oai added a commit that referenced this pull request Jun 10, 2026
anp-oai added a commit that referenced this pull request Jun 10, 2026
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from 7394680 to 384770f Compare June 10, 2026 16:32
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from a1214a2 to 57dd9b8 Compare June 11, 2026 17:20
Base automatically changed from codex/exec-runtime-warnings to main June 11, 2026 18:01
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from 57dd9b8 to 85c1dec Compare June 11, 2026 18:16
@anp-oai
anp-oai enabled auto-merge (squash) June 11, 2026 18:20
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from 85c1dec to 1097deb Compare June 11, 2026 18:44
@anp-oai
anp-oai force-pushed the codex/global-instructions-provider branch from 1097deb to 8aca78f Compare June 11, 2026 18:57
@anp-oai
anp-oai disabled auto-merge June 11, 2026 19:18
@anp-oai
anp-oai enabled auto-merge (squash) June 11, 2026 19:27
@anp-oai
anp-oai merged commit 236b501 into main Jun 11, 2026
46 checks passed
@anp-oai
anp-oai deleted the codex/global-instructions-provider branch June 11, 2026 19:28
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants