Skip to content

Commit 231ff19

Browse files
authored
[app-server] fix: add thread_id to turn/plan/updated (#7553)
Realized we're missing this while migrating VSCE.
1 parent de08c73 commit 231ff19

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

codex-rs/app-server-protocol/src/protocol/v2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,7 @@ pub struct TurnDiffUpdatedNotification {
12941294
#[serde(rename_all = "camelCase")]
12951295
#[ts(export_to = "v2/")]
12961296
pub struct TurnPlanUpdatedNotification {
1297+
pub thread_id: String,
12971298
pub turn_id: String,
12981299
pub explanation: Option<String>,
12991300
pub plan: Vec<TurnPlanStep>,

codex-rs/app-server/src/bespoke_event_handling.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ pub(crate) async fn apply_bespoke_event_handling(
661661
}
662662
EventMsg::PlanUpdate(plan_update_event) => {
663663
handle_turn_plan_update(
664+
conversation_id,
664665
&event_turn_id,
665666
plan_update_event,
666667
api_version,
@@ -693,13 +694,15 @@ async fn handle_turn_diff(
693694
}
694695

695696
async fn handle_turn_plan_update(
697+
conversation_id: ConversationId,
696698
event_turn_id: &str,
697699
plan_update_event: UpdatePlanArgs,
698700
api_version: ApiVersion,
699701
outgoing: &OutgoingMessageSender,
700702
) {
701703
if let ApiVersion::V2 = api_version {
702704
let notification = TurnPlanUpdatedNotification {
705+
thread_id: conversation_id.to_string(),
703706
turn_id: event_turn_id.to_string(),
704707
explanation: plan_update_event.explanation,
705708
plan: plan_update_event
@@ -1422,14 +1425,24 @@ mod tests {
14221425
],
14231426
};
14241427

1425-
handle_turn_plan_update("turn-123", update, ApiVersion::V2, &outgoing).await;
1428+
let conversation_id = ConversationId::new();
1429+
1430+
handle_turn_plan_update(
1431+
conversation_id,
1432+
"turn-123",
1433+
update,
1434+
ApiVersion::V2,
1435+
&outgoing,
1436+
)
1437+
.await;
14261438

14271439
let msg = rx
14281440
.recv()
14291441
.await
14301442
.ok_or_else(|| anyhow!("should send one notification"))?;
14311443
match msg {
14321444
OutgoingMessage::AppServerNotification(ServerNotification::TurnPlanUpdated(n)) => {
1445+
assert_eq!(n.thread_id, conversation_id.to_string());
14331446
assert_eq!(n.turn_id, "turn-123");
14341447
assert_eq!(n.explanation.as_deref(), Some("need plan"));
14351448
assert_eq!(n.plan.len(), 2);

0 commit comments

Comments
 (0)