Skip to content

[3/3] core: replay persisted world state - #29837

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

[3/3] core: replay persisted world state#29837
sayan-oai merged 2 commits into
mainfrom
codex/replay-world-state

Conversation

@sayan-oai

Copy link
Copy Markdown
Contributor

Why

Persisting WorldState snapshots and patches is only useful if resume and fork restore that exact comparison baseline. Rebuilding it from TurnContextItem loses section state and can either repeat or suppress model-visible updates.

This is the third PR in the WorldState persistence stack, built on #29835.

What

  • Replay full WorldState snapshots and RFC 7386 patches through the existing rollout reconstruction segments.
  • Discard state from rolled-back turns and treat compaction as a baseline reset.
  • Hydrate ContextManager from the reconstructed snapshot on resume and fork.
  • Remove the synthetic TurnContextItem to WorldState conversion path.
  • Leave legacy or malformed rollouts without a baseline so the next update safely emits a full snapshot.

Testing

  • just test -p codex-core world_state
  • just test -p codex-core rollout_reconstruction_tests
  • just fix -p codex-core
  • just test -p codex-core (the changed tests passed; the full run also hit unrelated existing/test-environment failures, primarily a missing test_stdio_server binary)

@sayan-oai sayan-oai changed the title core: replay persisted world state [3/3] core: replay persisted world state Jun 24, 2026
@sayan-oai
sayan-oai force-pushed the codex/replay-world-state branch from ef893b8 to 8b3962c Compare June 24, 2026 19:48
@sayan-oai
sayan-oai marked this pull request as ready for review June 24, 2026 20:34
@sayan-oai
sayan-oai requested a review from a team as a code owner June 24, 2026 20:34

@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

if let Some(world_state) = world_state_baseline {
state.history.set_world_state_baseline(world_state);

P2 Badge Add integration coverage for world-state resume replay

This resume/fork hydration path changes the agent's first model request after reconstructing a rollout, but the commit only adds session/rollout_reconstruction_tests.rs unit-level coverage; I don't see a core/tests/suite TestCodex resume/fork test that verifies the actual resumed request doesn't duplicate or suppress environment context. The repo guidance requires integration tests for agent-logic changes, so please add one around replaying persisted world state on resume or fork.

AGENTS.md reference: AGENTS.md:L115-L119

ℹ️ 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".

@sayan-oai
sayan-oai force-pushed the codex/persist-world-state branch from 7af2b6f to f2750c1 Compare June 25, 2026 00:36
@sayan-oai
sayan-oai force-pushed the codex/replay-world-state branch from 8b3962c to 62bfddb Compare June 25, 2026 00:36
@sayan-oai
sayan-oai force-pushed the codex/persist-world-state branch from f2750c1 to 922aac2 Compare June 25, 2026 01:11
@sayan-oai
sayan-oai force-pushed the codex/replay-world-state branch from 62bfddb to cb8dfc1 Compare June 25, 2026 01:11
@sayan-oai
sayan-oai force-pushed the codex/persist-world-state branch 2 times, most recently from 8218445 to 7667ec5 Compare June 25, 2026 02:58
Base automatically changed from codex/persist-world-state to main June 25, 2026 03:13
@sayan-oai
sayan-oai force-pushed the codex/replay-world-state branch from cb8dfc1 to 44c2b60 Compare June 25, 2026 03:14
@sayan-oai
sayan-oai enabled auto-merge (squash) June 25, 2026 03:30
@sayan-oai
sayan-oai merged commit a747713 into main Jun 25, 2026
46 of 47 checks passed
@sayan-oai
sayan-oai deleted the codex/replay-world-state branch June 25, 2026 03:32
@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