mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
Cover child parent turn analytics emitters
This commit is contained in:
@@ -2910,6 +2910,92 @@ async fn subagent_events_use_inherited_connection_unless_turn_connection_is_expl
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn subagent_turn_lifecycle_emits_parent_turn_id() {
|
||||
let mut reducer = AnalyticsReducer::default();
|
||||
let mut events = Vec::new();
|
||||
|
||||
ingest_review_prerequisites(&mut reducer, &mut events).await;
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Custom(CustomAnalyticsFact::SubAgentThreadStarted(
|
||||
SubAgentThreadStartedInput {
|
||||
session_id: "session-root".to_string(),
|
||||
thread_id: "thread-subagent".to_string(),
|
||||
parent_thread_id: Some("thread-1".to_string()),
|
||||
forked_from_thread_id: None,
|
||||
product_client_id: "codex-tui".to_string(),
|
||||
client_name: "codex-tui".to_string(),
|
||||
client_version: "1.0.0".to_string(),
|
||||
model: "gpt-5".to_string(),
|
||||
ephemeral: false,
|
||||
subagent_source: SubAgentSource::Review,
|
||||
created_at: 130,
|
||||
},
|
||||
)),
|
||||
&mut events,
|
||||
)
|
||||
.await;
|
||||
events.clear();
|
||||
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Notification(Box::new(sample_turn_started_notification(
|
||||
"thread-subagent",
|
||||
"turn-subagent",
|
||||
))),
|
||||
&mut events,
|
||||
)
|
||||
.await;
|
||||
let mut resolved_config = sample_turn_resolved_config("thread-subagent", "turn-subagent");
|
||||
resolved_config.parent_turn_id = Some("parent-turn-1".to_string());
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Custom(CustomAnalyticsFact::TurnResolvedConfig(Box::new(
|
||||
resolved_config,
|
||||
))),
|
||||
&mut events,
|
||||
)
|
||||
.await;
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Custom(CustomAnalyticsFact::TurnTokenUsage(Box::new(
|
||||
sample_turn_token_usage_fact("thread-subagent", "turn-subagent"),
|
||||
))),
|
||||
&mut events,
|
||||
)
|
||||
.await;
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Custom(CustomAnalyticsFact::TurnProfile(Box::new(
|
||||
TurnProfileFact {
|
||||
turn_id: "turn-subagent".to_string(),
|
||||
profile: sample_turn_profile(),
|
||||
},
|
||||
))),
|
||||
&mut events,
|
||||
)
|
||||
.await;
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Notification(Box::new(sample_turn_completed_notification(
|
||||
"thread-subagent",
|
||||
"turn-subagent",
|
||||
AppServerTurnStatus::Completed,
|
||||
/*codex_error_info*/ None,
|
||||
))),
|
||||
&mut events,
|
||||
)
|
||||
.await;
|
||||
|
||||
assert_eq!(events.len(), 1);
|
||||
let payload = serde_json::to_value(&events[0]).expect("serialize subagent turn event");
|
||||
assert_eq!(payload["event_params"]["thread_id"], "thread-subagent");
|
||||
assert_eq!(payload["event_params"]["turn_id"], "turn-subagent");
|
||||
assert_eq!(payload["event_params"]["parent_thread_id"], "thread-1");
|
||||
assert_eq!(payload["event_params"]["parent_turn_id"], "parent-turn-1");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn subagent_tool_items_inherit_parent_connection_metadata() {
|
||||
let mut reducer = AnalyticsReducer::default();
|
||||
@@ -3879,50 +3965,6 @@ async fn turn_lifecycle_emits_turn_event() {
|
||||
assert_eq!(payload["event_params"]["total_tokens"], json!(321));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn turn_lifecycle_emits_parent_turn_id() {
|
||||
let mut reducer = AnalyticsReducer::default();
|
||||
let mut out = Vec::new();
|
||||
|
||||
ingest_turn_prerequisites(
|
||||
&mut reducer,
|
||||
&mut out,
|
||||
/*include_initialize*/ true,
|
||||
/*include_resolved_config*/ false,
|
||||
/*include_started*/ true,
|
||||
/*include_token_usage*/ true,
|
||||
)
|
||||
.await;
|
||||
let mut resolved_config = sample_turn_resolved_config("thread-2", "turn-2");
|
||||
resolved_config.parent_turn_id = Some("parent-turn-1".to_string());
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Custom(CustomAnalyticsFact::TurnResolvedConfig(Box::new(
|
||||
resolved_config,
|
||||
))),
|
||||
&mut out,
|
||||
)
|
||||
.await;
|
||||
reducer
|
||||
.ingest(
|
||||
AnalyticsFact::Notification(Box::new(sample_turn_completed_notification(
|
||||
"thread-2",
|
||||
"turn-2",
|
||||
AppServerTurnStatus::Completed,
|
||||
/*codex_error_info*/ None,
|
||||
))),
|
||||
&mut out,
|
||||
)
|
||||
.await;
|
||||
|
||||
assert_eq!(out.len(), 1);
|
||||
let payload = serde_json::to_value(&out[0]).expect("serialize turn event");
|
||||
assert_eq!(
|
||||
payload["event_params"]["parent_turn_id"],
|
||||
json!("parent-turn-1")
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn turn_event_counts_completed_tool_items() {
|
||||
let mut reducer = AnalyticsReducer::default();
|
||||
|
||||
@@ -630,7 +630,14 @@ impl AnalyticsReducer {
|
||||
let turn_id = input.turn_id.clone();
|
||||
let thread_id = input.thread_id.clone();
|
||||
let num_input_images = input.num_input_images;
|
||||
let connection_id = self
|
||||
.threads
|
||||
.get(thread_id.as_str())
|
||||
.and_then(|thread| thread.connection_id);
|
||||
let turn_state = self.turns.entry(turn_id.clone()).or_default();
|
||||
if turn_state.connection_id.is_none() {
|
||||
turn_state.connection_id = connection_id;
|
||||
}
|
||||
turn_state.thread_id = Some(thread_id);
|
||||
turn_state.num_input_images = Some(num_input_images);
|
||||
turn_state.resolved_config = Some(input);
|
||||
|
||||
@@ -156,6 +156,7 @@ async fn wait_for_matching_analytics_event(
|
||||
tokio::time::sleep(Duration::from_millis(25)).await;
|
||||
continue;
|
||||
};
|
||||
let mut matching_events = Vec::new();
|
||||
for request in &requests {
|
||||
if request.method != "POST"
|
||||
|| request.url.path() != "/codex/analytics-events/events"
|
||||
@@ -177,6 +178,46 @@ async fn wait_for_matching_analytics_event(
|
||||
.await?
|
||||
}
|
||||
|
||||
pub(crate) async fn wait_for_analytics_events(
|
||||
server: &MockServer,
|
||||
read_timeout: Duration,
|
||||
event_type: &str,
|
||||
expected_len: usize,
|
||||
) -> Result<Vec<Value>> {
|
||||
timeout(read_timeout, async {
|
||||
loop {
|
||||
let Some(requests) = server.received_requests().await else {
|
||||
tokio::time::sleep(Duration::from_millis(25)).await;
|
||||
continue;
|
||||
};
|
||||
let mut matching_events = Vec::new();
|
||||
for request in &requests {
|
||||
if request.method != "POST"
|
||||
|| request.url.path() != "/codex/analytics-events/events"
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let payload: Value = serde_json::from_slice(&request.body)
|
||||
.map_err(|err| anyhow::anyhow!("invalid analytics payload: {err}"))?;
|
||||
let Some(events) = payload["events"].as_array() else {
|
||||
continue;
|
||||
};
|
||||
matching_events.extend(
|
||||
events
|
||||
.iter()
|
||||
.filter(|event| event["event_type"] == event_type)
|
||||
.cloned(),
|
||||
);
|
||||
}
|
||||
if matching_events.len() >= expected_len {
|
||||
return Ok::<Vec<Value>, anyhow::Error>(matching_events);
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(25)).await;
|
||||
}
|
||||
})
|
||||
.await?
|
||||
}
|
||||
|
||||
pub(crate) fn thread_initialized_event(payload: &Value) -> Result<&Value> {
|
||||
let events = payload["events"]
|
||||
.as_array()
|
||||
|
||||
@@ -91,6 +91,7 @@ use wiremock::ResponseTemplate;
|
||||
|
||||
use super::analytics::mount_analytics_capture;
|
||||
use super::analytics::wait_for_analytics_event;
|
||||
use super::analytics::wait_for_analytics_events;
|
||||
|
||||
#[cfg(windows)]
|
||||
const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(25);
|
||||
@@ -972,6 +973,152 @@ async fn turn_start_tracks_turn_event_analytics() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn spawned_child_turn_analytics_carry_direct_parent_turn_id() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
const CHILD_PROMPT: &str = "child: do work";
|
||||
const PARENT_PROMPT: &str = "spawn a child and continue";
|
||||
const SPAWN_CALL_ID: &str = "spawn-call-1";
|
||||
|
||||
let server = responses::start_mock_server().await;
|
||||
let spawn_args = serde_json::to_string(&json!({
|
||||
"message": CHILD_PROMPT,
|
||||
}))?;
|
||||
let _parent_turn = responses::mount_sse_once_match(
|
||||
&server,
|
||||
|req: &wiremock::Request| body_contains(req, PARENT_PROMPT),
|
||||
responses::sse(vec![
|
||||
responses::ev_response_created("resp-turn1-1"),
|
||||
responses::ev_function_call_with_namespace(
|
||||
SPAWN_CALL_ID,
|
||||
"multi_agent_v1",
|
||||
"spawn_agent",
|
||||
&spawn_args,
|
||||
),
|
||||
responses::ev_completed("resp-turn1-1"),
|
||||
]),
|
||||
)
|
||||
.await;
|
||||
let _child_turn = responses::mount_sse_once_match(
|
||||
&server,
|
||||
|req: &wiremock::Request| {
|
||||
body_contains(req, CHILD_PROMPT) && !body_contains(req, SPAWN_CALL_ID)
|
||||
},
|
||||
responses::sse(vec![
|
||||
responses::ev_response_created("resp-child-1"),
|
||||
responses::ev_assistant_message("msg-child-1", "child done"),
|
||||
responses::ev_completed("resp-child-1"),
|
||||
]),
|
||||
)
|
||||
.await;
|
||||
let _parent_follow_up = responses::mount_sse_once_match(
|
||||
&server,
|
||||
|req: &wiremock::Request| body_contains(req, SPAWN_CALL_ID),
|
||||
responses::sse(vec![
|
||||
responses::ev_response_created("resp-turn1-2"),
|
||||
responses::ev_assistant_message("msg-turn1-2", "parent done"),
|
||||
responses::ev_completed("resp-turn1-2"),
|
||||
]),
|
||||
)
|
||||
.await;
|
||||
|
||||
let codex_home = TempDir::new()?;
|
||||
write_mock_responses_config_toml_with_chatgpt_base_url(
|
||||
codex_home.path(),
|
||||
&server.uri(),
|
||||
&server.uri(),
|
||||
)?;
|
||||
let config_path = codex_home.path().join("config.toml");
|
||||
let config = std::fs::read_to_string(&config_path)?;
|
||||
let collab_feature_key = FEATURES
|
||||
.iter()
|
||||
.find(|spec| spec.id == Feature::Collab)
|
||||
.map(|spec| spec.key)
|
||||
.expect("collab feature key should be defined");
|
||||
std::fs::write(
|
||||
config_path,
|
||||
format!("{config}\n[features]\n{collab_feature_key} = true\n"),
|
||||
)?;
|
||||
mount_analytics_capture(&server, codex_home.path()).await?;
|
||||
|
||||
let mut mcp = TestAppServer::new_without_managed_config(codex_home.path()).await?;
|
||||
timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??;
|
||||
|
||||
let thread_req = mcp
|
||||
.send_thread_start_request(ThreadStartParams {
|
||||
model: Some("mock-model".to_string()),
|
||||
..Default::default()
|
||||
})
|
||||
.await?;
|
||||
let thread_resp: JSONRPCResponse = timeout(
|
||||
DEFAULT_READ_TIMEOUT,
|
||||
mcp.read_stream_until_response_message(RequestId::Integer(thread_req)),
|
||||
)
|
||||
.await??;
|
||||
let ThreadStartResponse { thread, .. } = to_response::<ThreadStartResponse>(thread_resp)?;
|
||||
|
||||
let turn_req = mcp
|
||||
.send_turn_start_request(TurnStartParams {
|
||||
thread_id: thread.id.clone(),
|
||||
client_user_message_id: None,
|
||||
input: vec![V2UserInput::Text {
|
||||
text: PARENT_PROMPT.to_string(),
|
||||
text_elements: Vec::new(),
|
||||
}],
|
||||
..Default::default()
|
||||
})
|
||||
.await?;
|
||||
let turn_resp: JSONRPCResponse = timeout(
|
||||
DEFAULT_READ_TIMEOUT,
|
||||
mcp.read_stream_until_response_message(RequestId::Integer(turn_req)),
|
||||
)
|
||||
.await??;
|
||||
let TurnStartResponse { turn } = to_response::<TurnStartResponse>(turn_resp)?;
|
||||
|
||||
timeout(DEFAULT_READ_TIMEOUT, async {
|
||||
let mut saw_parent_turn_completed = false;
|
||||
let mut saw_child_turn_completed = false;
|
||||
while !saw_parent_turn_completed || !saw_child_turn_completed {
|
||||
let turn_completed_notif = mcp
|
||||
.read_stream_until_notification_message("turn/completed")
|
||||
.await?;
|
||||
let turn_completed: TurnCompletedNotification = serde_json::from_value(
|
||||
turn_completed_notif.params.expect("turn/completed params"),
|
||||
)?;
|
||||
if turn_completed.thread_id == thread.id && turn_completed.turn.id == turn.id {
|
||||
saw_parent_turn_completed = true;
|
||||
} else if turn_completed.thread_id != thread.id {
|
||||
saw_child_turn_completed = true;
|
||||
}
|
||||
}
|
||||
Ok::<(), anyhow::Error>(())
|
||||
})
|
||||
.await??;
|
||||
|
||||
let events =
|
||||
wait_for_analytics_events(&server, DEFAULT_READ_TIMEOUT, "codex_turn_event", 2).await?;
|
||||
let parent_turn_event = events
|
||||
.iter()
|
||||
.find(|event| {
|
||||
event["event_params"]["thread_id"] == thread.id
|
||||
&& event["event_params"]["turn_id"] == turn.id
|
||||
})
|
||||
.expect("parent turn analytics event should be emitted");
|
||||
let child_turn_event = events
|
||||
.iter()
|
||||
.find(|event| event["event_params"]["parent_thread_id"] == thread.id)
|
||||
.expect("child turn analytics event should be emitted");
|
||||
|
||||
assert_eq!(
|
||||
parent_turn_event["event_params"]["parent_turn_id"],
|
||||
Value::Null
|
||||
);
|
||||
assert_eq!(child_turn_event["event_params"]["parent_turn_id"], turn.id);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
|
||||
async fn turn_profile_tracks_blocking_tool_and_follow_up_sampling() -> Result<()> {
|
||||
let responses = vec![
|
||||
|
||||
@@ -129,8 +129,12 @@ impl AgentControl {
|
||||
agent_id: ThreadId,
|
||||
initial_operation: Op,
|
||||
) -> CodexResult<String> {
|
||||
self.send_input_with_parent_turn_id(agent_id, initial_operation, None)
|
||||
.await
|
||||
self.send_input_with_parent_turn_id(
|
||||
agent_id,
|
||||
initial_operation,
|
||||
/*parent_turn_id*/ None,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn send_input_with_parent_turn_id(
|
||||
|
||||
@@ -197,7 +197,7 @@ pub(crate) async fn run_codex_thread_one_shot(
|
||||
auth_manager,
|
||||
models_manager,
|
||||
parent_session,
|
||||
parent_ctx,
|
||||
Arc::clone(&parent_ctx),
|
||||
child_cancel.clone(),
|
||||
subagent_source,
|
||||
initial_history,
|
||||
@@ -205,13 +205,16 @@ pub(crate) async fn run_codex_thread_one_shot(
|
||||
.await?;
|
||||
|
||||
// Send the initial input to kick off the one-shot turn.
|
||||
io.submit(Op::UserInput {
|
||||
items: input,
|
||||
final_output_json_schema,
|
||||
responsesapi_client_metadata: None,
|
||||
additional_context: Default::default(),
|
||||
thread_settings: Default::default(),
|
||||
})
|
||||
io.submit_with_parent_turn_id(
|
||||
Op::UserInput {
|
||||
items: input,
|
||||
final_output_json_schema,
|
||||
responsesapi_client_metadata: None,
|
||||
additional_context: Default::default(),
|
||||
thread_settings: Default::default(),
|
||||
},
|
||||
Some(parent_ctx.sub_id.clone()),
|
||||
)
|
||||
.await?;
|
||||
|
||||
// Bridge events so we can observe completion and shut down automatically.
|
||||
|
||||
@@ -132,7 +132,7 @@ async fn forward_ops_preserves_submission_trace_context() {
|
||||
id: "sub-1".to_string(),
|
||||
op: Op::Interrupt,
|
||||
client_user_message_id: None,
|
||||
parent_turn_id: None,
|
||||
parent_turn_id: Some("parent-turn-1".to_string()),
|
||||
trace: Some(codex_protocol::protocol::W3cTraceContext {
|
||||
traceparent: Some(
|
||||
"00-1234567890abcdef1234567890abcdef-1234567890abcdef-01".to_string(),
|
||||
@@ -149,6 +149,7 @@ async fn forward_ops_preserves_submission_trace_context() {
|
||||
.expect("forwarded submission missing");
|
||||
assert_eq!(submission.id, forwarded.id);
|
||||
assert_eq!(submission.op, forwarded.op);
|
||||
assert_eq!(submission.parent_turn_id, forwarded.parent_turn_id);
|
||||
assert_eq!(submission.trace, forwarded.trace);
|
||||
|
||||
timeout(Duration::from_secs(1), forward)
|
||||
|
||||
@@ -762,32 +762,35 @@ async fn run_review_on_session(
|
||||
let submit_result = run_before_review_deadline(
|
||||
deadline,
|
||||
params.external_cancel.as_ref(),
|
||||
Box::pin(review_session.codex.submit(Op::UserInput {
|
||||
items: prompt_items.items,
|
||||
final_output_json_schema: Some(params.schema.clone()),
|
||||
responsesapi_client_metadata: None,
|
||||
additional_context: Default::default(),
|
||||
thread_settings: codex_protocol::protocol::ThreadSettingsOverrides {
|
||||
environments: Some(codex_protocol::protocol::TurnEnvironmentSelections::new(
|
||||
parent_turn_legacy_fallback_cwd,
|
||||
parent_turn_environments,
|
||||
)),
|
||||
approval_policy: Some(AskForApproval::Never),
|
||||
sandbox_policy: None,
|
||||
permission_profile: Some(guardian_permission_profile),
|
||||
summary: Some(params.reasoning_summary),
|
||||
personality: params.personality,
|
||||
collaboration_mode: Some(codex_protocol::config_types::CollaborationMode {
|
||||
mode: codex_protocol::config_types::ModeKind::Default,
|
||||
settings: codex_protocol::config_types::Settings {
|
||||
model: params.model.clone(),
|
||||
reasoning_effort: params.reasoning_effort.clone(),
|
||||
developer_instructions: None,
|
||||
},
|
||||
}),
|
||||
..Default::default()
|
||||
Box::pin(review_session.codex.submit_with_parent_turn_id(
|
||||
Op::UserInput {
|
||||
items: prompt_items.items,
|
||||
final_output_json_schema: Some(params.schema.clone()),
|
||||
responsesapi_client_metadata: None,
|
||||
additional_context: Default::default(),
|
||||
thread_settings: codex_protocol::protocol::ThreadSettingsOverrides {
|
||||
environments: Some(codex_protocol::protocol::TurnEnvironmentSelections::new(
|
||||
parent_turn_legacy_fallback_cwd,
|
||||
parent_turn_environments,
|
||||
)),
|
||||
approval_policy: Some(AskForApproval::Never),
|
||||
sandbox_policy: None,
|
||||
permission_profile: Some(guardian_permission_profile),
|
||||
summary: Some(params.reasoning_summary),
|
||||
personality: params.personality,
|
||||
collaboration_mode: Some(codex_protocol::config_types::CollaborationMode {
|
||||
mode: codex_protocol::config_types::ModeKind::Default,
|
||||
settings: codex_protocol::config_types::Settings {
|
||||
model: params.model.clone(),
|
||||
reasoning_effort: params.reasoning_effort.clone(),
|
||||
developer_instructions: None,
|
||||
},
|
||||
}),
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
})),
|
||||
Some(params.parent_turn.sub_id.clone()),
|
||||
)),
|
||||
)
|
||||
.await;
|
||||
let child_turn_id = match submit_result {
|
||||
@@ -1499,6 +1502,7 @@ mod tests {
|
||||
});
|
||||
}
|
||||
let params = test_review_params().await;
|
||||
let expected_parent_turn_id = params.parent_turn.sub_id.clone();
|
||||
|
||||
let review = tokio::spawn(async move {
|
||||
run_review_on_session(
|
||||
@@ -1510,6 +1514,10 @@ mod tests {
|
||||
.await
|
||||
});
|
||||
let submission = rx_sub.recv().await.expect("guardian submission");
|
||||
assert_eq!(
|
||||
submission.parent_turn_id.as_deref(),
|
||||
Some(expected_parent_turn_id.as_str())
|
||||
);
|
||||
tx_event
|
||||
.send(turn_complete_event("prior-turn", Some("stale"), Some(9)))
|
||||
.await
|
||||
|
||||
@@ -692,7 +692,8 @@ impl Codex {
|
||||
|
||||
/// Submit the `op` wrapped in a `Submission` with a unique ID.
|
||||
pub async fn submit(&self, op: Op) -> CodexResult<String> {
|
||||
self.submit_with_parent_turn_id(op, None).await
|
||||
self.submit_with_parent_turn_id(op, /*parent_turn_id*/ None)
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn submit_with_parent_turn_id(
|
||||
@@ -709,7 +710,7 @@ impl Codex {
|
||||
op: Op,
|
||||
trace: Option<W3cTraceContext>,
|
||||
) -> CodexResult<String> {
|
||||
self.submit_with_trace_and_parent_turn_id(op, trace, None)
|
||||
self.submit_with_trace_and_parent_turn_id(op, trace, /*parent_turn_id*/ None)
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
@@ -592,7 +592,7 @@ impl Session {
|
||||
sub_id: String,
|
||||
updates: SessionSettingsUpdate,
|
||||
) -> CodexResult<Arc<TurnContext>> {
|
||||
self.new_turn_with_sub_id_and_parent_turn_id(sub_id, updates, None)
|
||||
self.new_turn_with_sub_id_and_parent_turn_id(sub_id, updates, /*parent_turn_id*/ None)
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
@@ -1072,7 +1072,8 @@ impl ThreadManagerState {
|
||||
|
||||
/// Send an operation to a thread by ID.
|
||||
pub(crate) async fn send_op(&self, thread_id: ThreadId, op: Op) -> CodexResult<String> {
|
||||
self.send_op_with_parent_turn_id(thread_id, op, None).await
|
||||
self.send_op_with_parent_turn_id(thread_id, op, /*parent_turn_id*/ None)
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn send_op_with_parent_turn_id(
|
||||
|
||||
@@ -209,6 +209,7 @@ async fn run_agent_job_loop(
|
||||
)))),
|
||||
SpawnAgentOptions {
|
||||
parent_thread_id: Some(session.thread_id),
|
||||
parent_turn_id: Some(turn.sub_id.clone()),
|
||||
environments: Some(turn.environments.to_selections()),
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user