Skip to content

Commit 157a16c

Browse files
authored
[app-server] feat: add thread_id and turn_id to item and error notifications (#7124)
Add `thread_id` and `turn_id` to `item/started`, `item/completed`, and `error` notifications. Otherwise the client will have a hard time knowing which thread & turn (if multiple threads are running in parallel) a new item/error is for. Also add `thread_id` to `turn/started` and `turn/completed`.
1 parent 37d83e0 commit 157a16c

File tree

5 files changed

+149
-22
lines changed

5 files changed

+149
-22
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,8 @@ pub struct TurnError {
807807
#[ts(export_to = "v2/")]
808808
pub struct ErrorNotification {
809809
pub error: TurnError,
810+
pub thread_id: String,
811+
pub turn_id: String,
810812
}
811813

812814
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
@@ -1118,6 +1120,7 @@ pub struct ThreadStartedNotification {
11181120
#[serde(rename_all = "camelCase")]
11191121
#[ts(export_to = "v2/")]
11201122
pub struct TurnStartedNotification {
1123+
pub thread_id: String,
11211124
pub turn: Turn,
11221125
}
11231126

@@ -1134,6 +1137,7 @@ pub struct Usage {
11341137
#[serde(rename_all = "camelCase")]
11351138
#[ts(export_to = "v2/")]
11361139
pub struct TurnCompletedNotification {
1140+
pub thread_id: String,
11371141
pub turn: Turn,
11381142
}
11391143

@@ -1142,13 +1146,17 @@ pub struct TurnCompletedNotification {
11421146
#[ts(export_to = "v2/")]
11431147
pub struct ItemStartedNotification {
11441148
pub item: ThreadItem,
1149+
pub thread_id: String,
1150+
pub turn_id: String,
11451151
}
11461152

11471153
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
11481154
#[serde(rename_all = "camelCase")]
11491155
#[ts(export_to = "v2/")]
11501156
pub struct ItemCompletedNotification {
11511157
pub item: ThreadItem,
1158+
pub thread_id: String,
1159+
pub turn_id: String,
11521160
}
11531161

11541162
// Item-specific progress notifications

0 commit comments

Comments
 (0)