Skip to content

feat(rollout): persist canonical items for paginated threads#30188

Draft
owenlin0 wants to merge 1 commit into
owen/emit_canonical_turn_item_lifecyclefrom
owen/update_rollout_items2
Draft

feat(rollout): persist canonical items for paginated threads#30188
owenlin0 wants to merge 1 commit into
owen/emit_canonical_turn_item_lifecyclefrom
owen/update_rollout_items2

Conversation

@owenlin0

@owenlin0 owenlin0 commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR is the final CA-629 persistence layer on top of #30283.

Paginated rollouts now persist completed canonical TurnItem snapshots instead of the parallel legacy item-shaped events. Legacy rollouts keep the existing persistence behavior.

Why

The later SQLite projector needs to read the JSONL suffix and materialize paginated ThreadItems without reconstructing the whole thread first. That only works if new paginated rollouts already contain stable turn/item IDs and completed item snapshots.

I left legacy rollout persistence alone because old binaries and historical rollouts still understand the old event shapes. The new storage contract is selected per thread with historyMode = "paginated".

What changed

  • Made rollout persistence history-mode aware: paginated threads keep completed canonical ItemCompleted snapshots and drop redundant persisted legacy item-shaped events; legacy threads keep current behavior.
  • Moved rollout canonicalization into LiveThread, so ThreadStore::append_items receives the already-filtered durable batch.
  • Made paginated threads force stable response item IDs even when Feature::ItemIds is off.
  • Added persisted turn/item IDs for review enter/exit events so replay can use the same IDs the live app-server path saw.
  • Updated metadata/list/search paths to understand completed canonical user-message items.
  • Switched synthetic replay/backfill turn/item IDs to globally unique values needed by the later SQLite schema.

Validation

  • cargo check -p codex-protocol -p codex-app-server-protocol -p codex-rollout -p codex-thread-store -p codex-core -p codex-app-server -p codex-state

I did not run the full codex-core suite.

Follow-up

The later SQLite projection work can now consume completed canonical item snapshots from paginated rollout JSONL without reconstructing the full thread first.

@owenlin0 owenlin0 changed the base branch from main to owen/add_thread_history_mode June 26, 2026 05:47
@owenlin0 owenlin0 force-pushed the owen/add_thread_history_mode branch from 4d6ed79 to c80f9bc Compare June 26, 2026 15:49
Base automatically changed from owen/add_thread_history_mode to main June 26, 2026 16:12
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch 2 times, most recently from ea6d2f0 to 909898e Compare June 26, 2026 19:45
@owenlin0 owenlin0 changed the title Owen/update rollout items2 feat(rollout): persist canonical items for paginated threads Jun 26, 2026
@owenlin0 owenlin0 changed the base branch from main to owen/emit_canonical_turn_item_lifecycle June 26, 2026 19:46
@owenlin0 owenlin0 force-pushed the owen/emit_canonical_turn_item_lifecycle branch from 35c6ad7 to ee54284 Compare June 26, 2026 20:50
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch from 909898e to aab46a2 Compare June 26, 2026 20:50
@owenlin0 owenlin0 force-pushed the owen/emit_canonical_turn_item_lifecycle branch from ee54284 to d581108 Compare June 26, 2026 21:13
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch 2 times, most recently from 30f1e4e to 334ca60 Compare June 26, 2026 21:18
@owenlin0 owenlin0 force-pushed the owen/emit_canonical_turn_item_lifecycle branch from d581108 to e9d6a09 Compare June 26, 2026 21:18
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch from 334ca60 to dbb8f8f Compare June 26, 2026 21:22
@owenlin0 owenlin0 force-pushed the owen/emit_canonical_turn_item_lifecycle branch 2 times, most recently from 232e33c to a6f98df Compare June 26, 2026 21:43
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch 3 times, most recently from 84244e6 to 9400737 Compare June 26, 2026 22:32
@owenlin0 owenlin0 force-pushed the owen/emit_canonical_turn_item_lifecycle branch 2 times, most recently from acec956 to f691f27 Compare June 26, 2026 22:50
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch from 9400737 to 22e61fc Compare June 26, 2026 22:50
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch from 22e61fc to 5d24df7 Compare June 26, 2026 23:19
@owenlin0 owenlin0 force-pushed the owen/emit_canonical_turn_item_lifecycle branch from 9fd1ae2 to 9f2d003 Compare June 26, 2026 23:19
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch from 5d24df7 to ae5828a Compare June 26, 2026 23:29
@owenlin0 owenlin0 force-pushed the owen/emit_canonical_turn_item_lifecycle branch from d3204c7 to 3041d21 Compare June 26, 2026 23:32
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch from ae5828a to f3fdff2 Compare June 26, 2026 23:32
@owenlin0 owenlin0 force-pushed the owen/emit_canonical_turn_item_lifecycle branch from 3041d21 to 5d4da6f Compare June 26, 2026 23:47
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch from f3fdff2 to 20eca18 Compare June 26, 2026 23:47
@owenlin0 owenlin0 force-pushed the owen/update_rollout_items2 branch from 20eca18 to aa40462 Compare June 27, 2026 00:01
@owenlin0 owenlin0 force-pushed the owen/emit_canonical_turn_item_lifecycle branch from 3a6d87b to 0c3b191 Compare June 27, 2026 00:16
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