Skip to content

[codex] Load AGENTS.md from all bound environments - #27696

Merged
anp-oai merged 17 commits into
mainfrom
codex/agents-md-multiple-environments
Jun 12, 2026
Merged

[codex] Load AGENTS.md from all bound environments#27696
anp-oai merged 17 commits into
mainfrom
codex/agents-md-multiple-environments

Conversation

@anp-oai

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

Copy link
Copy Markdown
Contributor

Why

We already have the machinery to support multiple environments on a single thread, but we only show the model the contents of AGENTS.md files in the primary environment.

We should show the model all of the relevant project instructions when we know there's more than one environment.

Known Gaps

As discussed in the RFC, this implementation:

  1. doesn't handle environments being added/removed to/from the thread after its creation
  2. it doesn't enforce an aggregate context budget across environments, and instead applies the configured project maximum independently to each environment

Implementation

  • Discover project instructions in environment order with an independent byte budget per environment and preserve source provenance/order.
  • Keep the legacy fragment byte-for-byte when exactly one environment contributes project instructions; use environment-labeled sections when two or more environments contribute.
  • Freeze the complete rendered fragment in LoadedAgentsMd, insert it directly into requests, and recognize both layouts in contextual and memory filtering.
  • Add exact rendering, independent-budget, source-order, creation-snapshot, and consumer coverage without changing app-server schemas.

Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
anp-oai added a commit that referenced this pull request Jun 11, 2026
anp-oai added a commit that referenced this pull request Jun 11, 2026
Comment thread codex-rs/core/src/session/turn_context.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs
Comment thread codex-rs/core/src/agents_md_tests.rs Outdated
anp-oai added a commit that referenced this pull request Jun 11, 2026
Comment thread codex-rs/core/src/session/turn_context.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
anp-oai added a commit that referenced this pull request Jun 11, 2026
Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
anp-oai added a commit that referenced this pull request Jun 12, 2026
Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
@anp-oai
anp-oai force-pushed the codex/agents-md-multiple-environments branch from 8eaeb77 to a1acbe0 Compare June 12, 2026 01:32
Comment thread codex-rs/core/src/agents_md.rs Outdated
Comment thread codex-rs/core/src/agents_md_tests.rs
Comment thread codex-rs/core/src/agents_md_tests.rs Outdated
@anp-oai
anp-oai marked this pull request as ready for review June 12, 2026 04:58
@anp-oai
anp-oai requested a review from a team as a code owner June 12, 2026 04:58

@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: 04393ff90d

ℹ️ 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/core/src/agents_md.rs
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/agents_md.rs Outdated
Comment thread codex-rs/core/src/agents_md.rs Outdated
@anp-oai
anp-oai merged commit bf667c7 into main Jun 12, 2026
31 checks passed
@anp-oai
anp-oai deleted the codex/agents-md-multiple-environments branch June 12, 2026 07:10
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 12, 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