Skip to content

Commit bfbaf84

Browse files
committed
Merge branch 'codex-dev-no-race'
2 parents 45e1742 + 642d306 commit bfbaf84

13 files changed

Lines changed: 604 additions & 24 deletions

codex-rs/core/src/session/turn.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,6 +2218,7 @@ async fn try_run_sampling_request(
22182218
if let Some(active) = active_item.as_ref() {
22192219
let event =
22202220
EventMsg::AgentReasoningSectionBreak(AgentReasoningSectionBreakEvent {
2221+
turn_id: Some(turn_context.sub_id.clone()),
22212222
item_id: active.id(),
22222223
summary_index,
22232224
});

codex-rs/protocol/src/protocol.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,6 +2074,7 @@ pub struct AgentMessageContentDeltaEvent {
20742074
impl HasLegacyEvent for AgentMessageContentDeltaEvent {
20752075
fn as_legacy_events(&self, _: bool) -> Vec<EventMsg> {
20762076
vec![EventMsg::AgentMessageDelta(AgentMessageDeltaEvent {
2077+
turn_id: Some(self.turn_id.clone()),
20772078
delta: self.delta.clone(),
20782079
})]
20792080
}
@@ -2101,6 +2102,7 @@ pub struct ReasoningContentDeltaEvent {
21012102
impl HasLegacyEvent for ReasoningContentDeltaEvent {
21022103
fn as_legacy_events(&self, _: bool) -> Vec<EventMsg> {
21032104
vec![EventMsg::AgentReasoningDelta(AgentReasoningDeltaEvent {
2105+
turn_id: Some(self.turn_id.clone()),
21042106
delta: self.delta.clone(),
21052107
})]
21062108
}
@@ -2121,6 +2123,7 @@ impl HasLegacyEvent for ReasoningRawContentDeltaEvent {
21212123
fn as_legacy_events(&self, _: bool) -> Vec<EventMsg> {
21222124
vec![EventMsg::AgentReasoningRawContentDelta(
21232125
AgentReasoningRawContentDeltaEvent {
2126+
turn_id: Some(self.turn_id.clone()),
21242127
delta: self.delta.clone(),
21252128
},
21262129
)]
@@ -2490,6 +2493,8 @@ pub struct UserMessageEvent {
24902493

24912494
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
24922495
pub struct AgentMessageDeltaEvent {
2496+
#[serde(default)]
2497+
pub turn_id: Option<String>,
24932498
pub delta: String,
24942499
}
24952500

@@ -2505,11 +2510,15 @@ pub struct AgentReasoningRawContentEvent {
25052510

25062511
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
25072512
pub struct AgentReasoningRawContentDeltaEvent {
2513+
#[serde(default)]
2514+
pub turn_id: Option<String>,
25082515
pub delta: String,
25092516
}
25102517

25112518
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
25122519
pub struct AgentReasoningSectionBreakEvent {
2520+
#[serde(default)]
2521+
pub turn_id: Option<String>,
25132522
// load with default value so it's backward compatible with the old format.
25142523
#[serde(default)]
25152524
pub item_id: String,
@@ -2519,6 +2528,8 @@ pub struct AgentReasoningSectionBreakEvent {
25192528

25202529
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
25212530
pub struct AgentReasoningDeltaEvent {
2531+
#[serde(default)]
2532+
pub turn_id: Option<String>,
25222533
pub delta: String,
25232534
}
25242535

codex-rs/tui/src/app/app_server_adapter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ fn server_notification_thread_events(
596596
vec![Event {
597597
id: String::new(),
598598
msg: EventMsg::AgentMessageDelta(AgentMessageDeltaEvent {
599+
turn_id: Some(notification.turn_id),
599600
delta: notification.delta,
600601
}),
601602
}],
@@ -617,6 +618,7 @@ fn server_notification_thread_events(
617618
vec![Event {
618619
id: String::new(),
619620
msg: EventMsg::AgentReasoningDelta(AgentReasoningDeltaEvent {
621+
turn_id: Some(notification.turn_id),
620622
delta: notification.delta,
621623
}),
622624
}],
@@ -626,6 +628,7 @@ fn server_notification_thread_events(
626628
vec![Event {
627629
id: String::new(),
628630
msg: EventMsg::AgentReasoningRawContentDelta(AgentReasoningRawContentDeltaEvent {
631+
turn_id: Some(notification.turn_id),
629632
delta: notification.delta,
630633
}),
631634
}],
@@ -1463,6 +1466,7 @@ mod tests {
14631466
let EventMsg::AgentMessageDelta(delta) = &agent_event.msg else {
14641467
panic!("expected bridged agent message delta");
14651468
};
1469+
assert_eq!(delta.turn_id.as_deref(), Some("turn"));
14661470
assert_eq!(delta.delta, "Hello");
14671471

14681472
let (_, reasoning_events) = server_notification_thread_events(

codex-rs/tui/src/bottom_pane/chat_composer.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ use ratatui::style::Stylize;
142142
use ratatui::text::Line;
143143
use ratatui::text::Span;
144144
use ratatui::widgets::Block;
145+
use ratatui::widgets::Borders;
145146
use ratatui::widgets::Paragraph;
146147
use ratatui::widgets::StatefulWidgetRef;
147148
use ratatui::widgets::WidgetRef;
@@ -4129,7 +4130,11 @@ impl ChatComposer {
41294130
let is_zellij = self.is_zellij;
41304131
let style = user_message_style();
41314132
let textarea_style = style.fg(ratatui::style::Color::Reset);
4132-
Block::default().style(style).render_ref(composer_rect, buf);
4133+
Block::default()
4134+
.borders(Borders::TOP | Borders::BOTTOM)
4135+
.style(style)
4136+
.border_style(Style::default().fg(ratatui::style::Color::White))
4137+
.render_ref(composer_rect, buf);
41334138
if !remote_images_rect.is_empty() {
41344139
Paragraph::new(self.remote_images_lines(remote_images_rect.width))
41354140
.style(style)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
source: tui/src/bottom_pane/chat_composer.rs
3-
assertion_line: 4001
3+
assertion_line: 4498
44
expression: terminal.backend()
55
---
6-
" "
6+
"────────────────────────────────────────────────────────────────────────────────────────────────────"
77
"› Ask Codex to do anything "
88
" "
99
" "
1010
" "
1111
" "
1212
" "
13-
" "
13+
"────────────────────────────────────────────────────────────────────────────────────────────────────"
1414
" ? for shortcuts 100% context left "

0 commit comments

Comments
 (0)