mirror of
https://github.com/openai/codex.git
synced 2026-11-12 21:20:34 +00:00
Track parent turns for nested Codex requests (#35835)
## What changed - Propagate the initiating turn ID through agent spawns, follow-up tasks, reviews, and delegated Codex sessions. - Add `parent_turn_id` to Responses client and turn metadata while keeping it out of external MCP metadata. - Preserve parent-turn provenance across queued agent messages when their triggering parent is unambiguous. ## Testing - Cover spawned, resumed, nested, reviewed, delegated, and WebSocket request metadata. - Verify queued messages do not claim ambiguous or queue-only parent turns. GitOrigin-RevId: 481fdebbe7df2031880fe259509273cce50b20a8
This commit is contained in:
@@ -275,7 +275,9 @@ impl CodexThread {
|
||||
op: Op,
|
||||
trace: Option<W3cTraceContext>,
|
||||
) -> CodexResult<String> {
|
||||
self.io.submit_with_trace(op, trace).await
|
||||
self.io
|
||||
.submit_with_trace(op, trace, /*parent_turn_id*/ None)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn submit_user_input_with_client_user_message_id(
|
||||
@@ -427,7 +429,8 @@ impl CodexThread {
|
||||
}
|
||||
|
||||
/// Use sparingly: this is intended to be removed soon.
|
||||
pub async fn submit_with_id(&self, sub: Submission) -> CodexResult<()> {
|
||||
pub async fn submit_with_id(&self, mut sub: Submission) -> CodexResult<()> {
|
||||
sub.parent_turn_id = None;
|
||||
self.io.submit_with_id(sub).await
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user