mirror of
https://github.com/openai/codex.git
synced 2026-11-02 19:43:24 +00:00
remove redundant stamping
This commit is contained in:
@@ -3819,40 +3819,7 @@ impl Session {
|
||||
turn_context: &TurnContext,
|
||||
input: &[UserInput],
|
||||
response_item: ResponseItem,
|
||||
user_message_type: Option<UserMessageType>,
|
||||
) {
|
||||
let user_message_type = if self.enabled(Feature::ItemMetadata) {
|
||||
user_message_type
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let response_item = match (response_item, user_message_type.clone()) {
|
||||
(
|
||||
ResponseItem::Message {
|
||||
id,
|
||||
role,
|
||||
content,
|
||||
metadata,
|
||||
end_turn,
|
||||
phase,
|
||||
},
|
||||
Some(kind),
|
||||
) if role == "user" => {
|
||||
let mut metadata = metadata.unwrap_or_default();
|
||||
metadata.user_message_type = Some(kind);
|
||||
ResponseItem::Message {
|
||||
id,
|
||||
role,
|
||||
content,
|
||||
metadata: Some(metadata),
|
||||
end_turn,
|
||||
phase,
|
||||
}
|
||||
}
|
||||
(response_item, _) => response_item,
|
||||
};
|
||||
|
||||
// Persist the user message to history, but emit the turn item from `UserInput` so
|
||||
// UI-only `text_elements` are preserved. `ResponseItem::Message` does not carry
|
||||
// those spans, and `record_response_item_and_emit_turn_item` would drop them.
|
||||
@@ -5697,13 +5664,8 @@ pub(crate) async fn run_turn(
|
||||
stamp_user_message_type_on_input_item(&mut initial_input_for_turn, UserMessageType::Prompt);
|
||||
}
|
||||
let response_item: ResponseItem = initial_input_for_turn.clone().into();
|
||||
sess.record_user_prompt_and_emit_turn_item(
|
||||
turn_context.as_ref(),
|
||||
&input,
|
||||
response_item,
|
||||
Some(UserMessageType::Prompt),
|
||||
)
|
||||
.await;
|
||||
sess.record_user_prompt_and_emit_turn_item(turn_context.as_ref(), &input, response_item)
|
||||
.await;
|
||||
record_additional_contexts(&sess, &turn_context, additional_contexts).await;
|
||||
// Track the previous-turn baseline from the regular user-turn path only so
|
||||
// standalone tasks (compact/shell/review/undo) cannot suppress future
|
||||
@@ -5775,8 +5737,8 @@ pub(crate) async fn run_turn(
|
||||
}
|
||||
|
||||
let has_accepted_pending_input = !accepted_pending_input.is_empty();
|
||||
for (pending_input, user_message_type) in accepted_pending_input {
|
||||
record_pending_input(&sess, &turn_context, pending_input, user_message_type).await;
|
||||
for (pending_input, _user_message_type) in accepted_pending_input {
|
||||
record_pending_input(&sess, &turn_context, pending_input).await;
|
||||
}
|
||||
record_additional_contexts(&sess, &turn_context, blocked_pending_input_contexts).await;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ use codex_protocol::items::TurnItem;
|
||||
use codex_protocol::models::DeveloperInstructions;
|
||||
use codex_protocol::models::ResponseInputItem;
|
||||
use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::models::UserMessageType;
|
||||
use codex_protocol::protocol::AskForApproval;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
use codex_protocol::protocol::HookCompletedEvent;
|
||||
@@ -165,7 +164,6 @@ pub(crate) async fn record_pending_input(
|
||||
sess: &Arc<Session>,
|
||||
turn_context: &Arc<TurnContext>,
|
||||
pending_input: PendingInputRecord,
|
||||
user_message_type: Option<UserMessageType>,
|
||||
) {
|
||||
match pending_input {
|
||||
PendingInputRecord::UserMessage {
|
||||
@@ -177,7 +175,6 @@ pub(crate) async fn record_pending_input(
|
||||
turn_context.as_ref(),
|
||||
content.as_slice(),
|
||||
response_item,
|
||||
user_message_type,
|
||||
)
|
||||
.await;
|
||||
record_additional_contexts(sess, turn_context, additional_contexts).await;
|
||||
|
||||
@@ -265,13 +265,7 @@ impl Session {
|
||||
for pending_input_item in pending_input {
|
||||
match inspect_pending_input(self, &turn_context, pending_input_item.input).await {
|
||||
PendingInputHookDisposition::Accepted(pending_input) => {
|
||||
record_pending_input(
|
||||
self,
|
||||
&turn_context,
|
||||
*pending_input,
|
||||
pending_input_item.user_message_type,
|
||||
)
|
||||
.await;
|
||||
record_pending_input(self, &turn_context, *pending_input).await;
|
||||
}
|
||||
PendingInputHookDisposition::Blocked {
|
||||
additional_contexts,
|
||||
|
||||
Reference in New Issue
Block a user