core: make AGENTS.md react to environment changes - #29977
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bfe2a3af2
ℹ️ 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".
| directory: instructions.directory.clone(), | ||
| text: format!("{REPLACEMENT_NOTICE}\n\n{}", instructions.text), | ||
| }, | ||
| (Some(instructions), None) => instructions.clone(), |
There was a problem hiding this comment.
Seed AGENTS.md baselines when resuming legacy rollouts
When resuming a rollout written before this change, the prompt history already contains the old AGENTS.md contextual user message, but the persisted WorldState has no agents_md section. On the first resumed turn previous is therefore None for this section, so this branch emits another full AGENTS.md item instead of treating the legacy history as the baseline, duplicating instructions for existing saved threads. Please migrate/seed the agents_md snapshot during reconstruction or suppress this first diff for legacy rollouts.
AGENTS.md reference: AGENTS.md:L102-L110
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
coming in stacked pr
Why
With deferred executors, a turn can begin before a remote environment attaches. AGENTS.md discovery previously ran only during session setup, so instructions from a later environment never reached the model or the session's instruction sources.
WorldState persistence has now landed, so this can use the durable model-visible baseline directly instead of carrying the temporary resume/fork compatibility path from #29810.
What
AgentsMdManagerinSessionServicesto own host instructions, loaded state, and refresh caching.DeferredExecutoris enabled, refresh AGENTS.md when attached environment selections change and freeze the result in that request'sStepContext.SessionConfigurationandTurnContext.Supersedes #29810 and builds on #29833, #29835, and #29837.
Tests
codex-coreAGENTS.md, WorldState, and context-update test suites.