Skip to content

[codex] Persist structured instruction snapshots#26833

Closed
anp-oai wants to merge 4 commits into
codex/global-instructions-homefrom
codex/global-instructions-snapshots
Closed

[codex] Persist structured instruction snapshots#26833
anp-oai wants to merge 4 commits into
codex/global-instructions-homefrom
codex/global-instructions-snapshots

Conversation

@anp-oai

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

Copy link
Copy Markdown
Contributor

Why

History-sharing threads must retain the instructions that were active when their history was produced. That persistence and inheritance behavior should be established before changing where fresh global instructions are resolved, so resume, forks, truncated subagents, and compaction do not accidentally reload or lose instructions.

What changed

  • Adds structured instruction snapshots with global, project, and internal provenance.
  • Stores the current snapshot in session state separately from rendered history.
  • Persists snapshots in durable turn-context items, including source paths.
  • Restores snapshots during resume and fork reconstruction with rollback-aware behavior.
  • Carries metadata-only snapshots through truncated-history subagent forks without claiming a full context baseline.
  • Refreshes only the global portion during full-context rebuilding while retaining the existing Config.user_instructions source for compatibility.
  • Leaves legacy histories without a structured snapshot empty until a later full-context rebuild.
  • Removes the redundant rendered instruction copy from TurnContext.
  • Bounds persisted and model-visible instruction content.

Stack

  1. [codex] Characterize global instruction lifecycle #26830: lifecycle characterization tests
  2. [codex] Add global instructions contributor API #26831: extension API primitives
  3. [codex] Add CODEX_HOME instructions contributor #26832: CODEX_HOME contributor crate
  4. [codex] Persist structured instruction snapshots #26833: structured snapshot and history machinery
  5. [codex] Adopt global instructions contributors #26834: contributor adoption and compatibility removal

Test plan

  • Core instruction composition and bounding tests
  • Rollout reconstruction and rollback tests
  • Cold resume and fork source inheritance tests
  • Truncated-history subagent fork coverage
  • Local, legacy remote, and remote-v2 compaction paths
  • App-server fork instructionSources coverage

@anp-oai
anp-oai force-pushed the codex/global-instructions-home branch from 7755e57 to c3df12e Compare June 6, 2026 22:42
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from 6dae8e0 to 33ae45b Compare June 6, 2026 22:42
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from 81f505c to b394621 Compare June 6, 2026 23:29
@anp-oai
anp-oai force-pushed the codex/global-instructions-home branch 3 times, most recently from 928c7ca to dbb73cc Compare June 6, 2026 23:55
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from b394621 to b2f10a1 Compare June 7, 2026 00:00
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from b2f10a1 to 76b526b Compare June 7, 2026 00:13
@anp-oai
anp-oai force-pushed the codex/global-instructions-home branch from 6357493 to 346915c Compare June 7, 2026 00:16
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from 76b526b to 66e4dcc Compare June 7, 2026 00:17
@anp-oai
anp-oai force-pushed the codex/global-instructions-home branch from 346915c to ff93380 Compare June 7, 2026 00:22
anp-oai added a commit that referenced this pull request Jun 7, 2026
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from 66e4dcc to 421a743 Compare June 7, 2026 00:25
@anp-oai
anp-oai force-pushed the codex/global-instructions-home branch from ff93380 to 5a5f942 Compare June 7, 2026 00:30
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from 421a743 to c7d7742 Compare June 7, 2026 00:31
@anp-oai
anp-oai force-pushed the codex/global-instructions-home branch from 5a5f942 to 1387a82 Compare June 7, 2026 00:38
anp-oai added a commit that referenced this pull request Jun 7, 2026
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from c7d7742 to 1b4f2bf Compare June 7, 2026 00:41
@anp-oai
anp-oai force-pushed the codex/global-instructions-home branch from 1387a82 to 161abd3 Compare June 8, 2026 15:21
anp-oai added a commit that referenced this pull request Jun 8, 2026
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from 1b4f2bf to c3a04a9 Compare June 8, 2026 15:46
@anp-oai
anp-oai force-pushed the codex/global-instructions-home branch from 161abd3 to 67bb15a Compare June 8, 2026 18:29
@anp-oai
anp-oai force-pushed the codex/global-instructions-snapshots branch from 5df5f8b to 4c16e36 Compare June 8, 2026 19:06
@anp-oai anp-oai closed this Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant