-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Add text element metadata to protocol, app server, and core #9331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
aibrahim-oai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I'd also add tests in app-server
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.