feat(protocol): define missing rollout turn items#30282
Merged
Conversation
owenlin0
added a commit
that referenced
this pull request
Jun 26, 2026
883f6f7 to
2d0b556
Compare
Contributor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d0b5567ff
ℹ️ 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".
wiltzius-openai
approved these changes
Jun 26, 2026
Contributor
|
Need to consider how to modify the rollout persistence policy for these new types |
4304fa3 to
d2d5882
Compare
anp-oai
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds canonical core
TurnItemshapes for command execution, dynamic tool calls, collab agent tool calls, and sub-agent activity, to be stored in the rollout file soon.It also teaches app-server protocol /
ThreadHistoryBuilderhow to render those items, and adds the small legacy fanout helpers needed for existing event-based consumers. No core producer or rollout persistence behavior changes here, that will be done in a followup.Making ThreadHistoryBuilder stateless
This is the first PR in a stack to make
ThreadHistoryBuilderstateless enough that we can materialize app-serverThreadItems from only a given slice ofRolloutItemhistory, without ever needing to replay the whole thread from the beginning.The persisted legacy
RolloutItem::EventMsgrecords are mostly shaped like live UI events, not like materializedThreadItems. They work if we replay the full rollout in order, but they often do not contain enough stable identity or complete item state to project an arbitrary suffix on its own.A few examples:
UserMessageEventandAgentMessageEventhave content, but historically do not carry the persisted app-server item ID that should become the SQLite primary key.AgentReasoningEventandAgentReasoningRawContentEventare fragments.ThreadHistoryBuildercurrently merges them into the last reasoning item, which means a slice starting in the middle of reasoning cannot know whether to append to an earlier item or create a new one.WebSearchEndEvent,McpToolCallEndEvent, collab end events, and similar legacy events can often render a final-looking item, but they usually rely on prior replay state to know which turn owns the item.call_idand mutates prior state to synthesize the finalThreadItem.That is the problem this direction fixes. A persisted canonical lifecycle record looks much closer to the read model we actually want later:
Once rollout has explicit
turn_id, stableitem.id, and a canonical completed item snapshot, the future SQLite projector can reduce only the new rollout suffix and upsert the affectedthread_itemsrows. It no longer needs to synthesizeitem-N, infer item ownership from the active turn, or replay earlier events just to reconstruct the current item snapshot.What changed
TurnItemvariants and item structs for command execution, dynamic tool calls, collab agent tool calls, and sub-agent activity.ThreadItemconversion for the new core item variants.ThreadHistoryBuilderand rollout persistence metrics to recognize the new item variants.Follow-up
The next PR #30283 switches the live core producers for these item families onto canonical
ItemStarted/ItemCompletedevents.