Add text element metadata to protocol, app server, and core#9331
Merged
charley-oai merged 8 commits intomainfrom Jan 16, 2026
Merged
Add text element metadata to protocol, app server, and core#9331charley-oai merged 8 commits intomainfrom
charley-oai merged 8 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the protocol, app-server, and core to support text element metadata (UI-defined spans with placeholders) in user inputs and message events, enabling rich text features while keeping model history clean.
Changes:
- Added
TextElementandByteRangestructures to protocol user inputs and events with backward-compatible defaults - Threaded
text_elementsthrough app-server v1/v2 request handling and history rebuild logic - Modified core to preserve UI metadata in user events while excluding it from model history
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| codex-rs/protocol/src/items.rs | Added methods to extract and rebase text elements and local image paths from UserMessageItem |
| codex-rs/core/src/codex.rs | Split user message recording to preserve text_elements in emitted events while keeping model history clean |
| codex-rs/app-server/tests/suite/*.rs | Updated test cases to include empty text_elements vectors in InputItem::Text |
| codex-rs/app-server/src/codex_message_processor.rs | Updated input mapping to thread text_elements through v1/v2 request handling |
| codex-rs/app-server-test-client/src/main.rs | Added empty text_elements to test client InputItem::Text |
| codex-rs/app-server-protocol/src/protocol/v2.rs | Added From implementations for ByteRange and TextElement conversions |
| codex-rs/app-server-protocol/src/protocol/v1.rs | Defined V1TextElement and V1ByteRange with camelCase serialization and conversions |
| codex-rs/app-server-protocol/src/protocol/thread_history.rs | Updated history builder to preserve text_elements and local_images from events |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
aibrahim-oai
left a comment
There was a problem hiding this comment.
Very clean! Let's add integration tests testing that we send turn item and event msgs and also we keep them on resume.
aibrahim-oai
approved these changes
Jan 16, 2026
Collaborator
aibrahim-oai
left a comment
There was a problem hiding this comment.
Awesome! I'd also add tests in app-server
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.
The second part of breaking up PR #9116
Summary:
TextElement/ByteRangeto protocol user inputs and user message events with defaults.text_elementsthrough app-server v1/v2 request handling and history rebuild.ContentItem) while keeping local image attachments in user events for rehydration.Details:
UserInput::Textcarriestext_elements;UserMessageEventcarriestext_elements+local_images. Serialization includes empty vectors for backward compatibility.V1TextElement/V1ByteRangein camelCase with conversions; v2 uses its own camelCase wrapper.text_elements; thread history rebuilds include them.