Skip to content

core: reconcile legacy WorldState sections#29997

Merged
sayan-oai merged 2 commits into
mainfrom
codex/world-state-legacy-reconciliation
Jun 25, 2026
Merged

core: reconcile legacy WorldState sections#29997
sayan-oai merged 2 commits into
mainfrom
codex/world-state-legacy-reconciliation

Conversation

@sayan-oai

@sayan-oai sayan-oai commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Why

Older rollouts can retain model-visible context for a WorldState section without having a persisted snapshot for that section. Treating the missing snapshot as definitely absent can duplicate old context or fail to tell the model that it was replaced or removed.

This provides a generic migration path for sections moving into WorldState, beginning with AGENTS.md.

Builds on #29810.

What changed

  • distinguish section state that is absent, known from a persisted snapshot, or unknown because matching legacy context remains in history
  • let WorldState sections identify their own legacy fragments while ContextManager owns history reconciliation and baseline persistence
  • make AGENTS.md emit one conservative replacement or removal update for legacy history, then deduplicate from the newly persisted baseline
  • preserve existing environment rendering when persisted section data is missing or malformed

Testing

  • just test -p codex-core world_state
  • just test -p codex-core cold_resume_invalidates_deleted_legacy_agents_md_once -- --exact

@sayan-oai sayan-oai requested a review from a team as a code owner June 25, 2026 05:44

@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: d485e3af6d

ℹ️ 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/context/world_state/mod.rs
Comment thread codex-rs/core/src/context/world_state/mod.rs
@sayan-oai sayan-oai changed the base branch from codex/reactive-agents-md-world-state to codex/dynamic-environment-agents-md June 25, 2026 05:50
Base automatically changed from codex/dynamic-environment-agents-md to main June 25, 2026 05:57
@sayan-oai sayan-oai force-pushed the codex/world-state-legacy-reconciliation branch from d485e3a to 933f926 Compare June 25, 2026 05:59
Comment thread codex-rs/core/src/context/world_state/mod.rs Outdated
Comment thread codex-rs/core/src/context/world_state/mod.rs Outdated
Comment thread codex-rs/core/src/context/world_state/mod.rs Outdated
Comment thread codex-rs/core/tests/suite/agents_md.rs Outdated
@sayan-oai sayan-oai enabled auto-merge (squash) June 25, 2026 06:49
@sayan-oai sayan-oai merged commit ab80d4d into main Jun 25, 2026
31 checks passed
@sayan-oai sayan-oai deleted the codex/world-state-legacy-reconciliation branch June 25, 2026 07:03
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 25, 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