Skip to content

[telemetry] surface projection for user message type#14374

Draft
rhan-oai wants to merge 39 commits intomainfrom
rhan/surface-updates
Draft

[telemetry] surface projection for user message type#14374
rhan-oai wants to merge 39 commits intomainfrom
rhan/surface-updates

Conversation

@rhan-oai
Copy link
Copy Markdown
Collaborator

@rhan-oai rhan-oai commented Mar 11, 2026

  • surface projection for user message type
  • introduce item metadata feature flag
  • introduce and emit item uuid as metadata, behind feature flag

@rhan-oai rhan-oai force-pushed the rhan/surface-updates branch from 20497de to 9e058f1 Compare March 11, 2026 20:27
@rhan-oai rhan-oai changed the title [telemetry] surface projection for sandbox [telemetry] surface projection for user message type Mar 12, 2026
@etraut-openai etraut-openai added the oai PRs contributed by OpenAI employees label Mar 13, 2026
@dylan-hurd-oai dylan-hurd-oai marked this pull request as ready for review March 19, 2026 17:23
@rhan-oai rhan-oai requested a review from dylan-hurd-oai March 19, 2026 23:28
}

#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema, TS)]
pub struct ResponseItemMetadata {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we define a unique type per ResponseItem variant? So ResponseItemMessageMetadata / ResponseItemFunctionCallOutputMetadata/ etc.?

I expect we'll have specific metadata fields for each variant (i.e. user_message_type only makes sense on Messages)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and looking at the response item types, I think uuid is only necessary on user messages since everything else has a unique call_id

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg on the variants, for id's uuid will be needed on tools since call_id refers to each invocation and collapses call/output which opposes item level identification

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, can you explain more why call_id does not work for function calls? a call_id is 1:1 with a function call

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we only need to care about what codex (as a client of responsesapi) sends, not receives, so it only makes sense to attach metadata on function call outputs (not inputs/arguments, which is what responsesapi sends back to codex when the model decides to trigger a tool)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looping in Mark to clarify deduping needs

/// Client-visible UUID generated by Codex for this item.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub uuid: Option<String>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we define unique metadata types, I think we could also make user_message_type and uuid non-optional


impl ResponseItem {
/// Ensures message metadata includes a generated UUID.
pub fn with_generated_metadata_uuid(self) -> Self {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of introducing this helper, can we just maintain this invariant when we construct a ResponseItemMessageMetadata struct? This would naturally be required once we make uuid non-optional


impl ResponseItem {
/// Ensures message metadata includes a generated UUID.
pub fn with_generated_metadata_uuid(self) -> Self {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make more sense to populate this when we create the ResponseItemMetadata object, e.g. with default macro/impl or a ResponseItemMetadata::new method

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was considering this, sgtm

/// Client-visible UUID generated by Codex for this item.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub uuid: Option<String>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's just call this metadata_id instead of uuid - it might be slightly repetitive but we have many IDs floating around with ReponseItem

@rhan-oai rhan-oai requested a review from dylan-hurd-oai March 22, 2026 23:23
Copy link
Copy Markdown
Collaborator

@owenlin0 owenlin0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good overall! just some small comments

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "snake_case")]
#[ts(rename_all = "snake_case")]
pub enum UserMessageType {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is it worth calling this something like UserMessageSubmissionType and having these values?

Regular
Steering
Queued

seems more precise than Type

#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
pub user_message_type: Option<UserMessageType>,
/// Client-visible metadata ID generated by Codex for this item.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth documenting this field allows us to de-dupe

Copy link
Copy Markdown
Collaborator

@owenlin0 owenlin0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preapproving

@rhan-oai rhan-oai marked this pull request as draft March 23, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants