mirror of
https://github.com/openai/codex.git
synced 2026-11-29 00:00:54 +00:00
Propagate trace context through gRPC code mode (#41017)
## What changed - Inject W3C `traceparent` metadata into code-mode session and execution requests. - Carry each execution's trace context on streamed tool callbacks so callback and nested-tool spans remain connected across the gRPC boundary. - Preserve the relevant spans when execution, callback, and dispatch work moves into spawned tasks. GitOrigin-RevId: 6482963cb9b2e2f0ea27f1345bba208b70a80d0b
This commit is contained in:
@@ -103,7 +103,7 @@ impl GrpcSession {
|
||||
let canonical_tool_name =
|
||||
ToolName::new(tool_name.namespace.clone(), tool_name.name.clone())
|
||||
.with_default_namespace();
|
||||
let (sequence, subscriptions) = {
|
||||
let (sequence, traceparent, subscriptions) = {
|
||||
let state = self.state.lock().unwrap_or_else(PoisonError::into_inner);
|
||||
let Some(execution) = state.cells.get(&cell_id) else {
|
||||
return Err("code-mode cell closed before dispatching its tool call".to_string());
|
||||
@@ -124,7 +124,7 @@ impl GrpcSession {
|
||||
})
|
||||
.map(|subscription| (subscription.id, subscription.sender.clone()))
|
||||
.collect::<Vec<_>>();
|
||||
(sequence, subscriptions)
|
||||
(sequence, execution.traceparent.clone(), subscriptions)
|
||||
};
|
||||
if subscriptions.is_empty() {
|
||||
return Err("no code-mode tool subscription matches the requested tool".to_string());
|
||||
@@ -139,6 +139,7 @@ impl GrpcSession {
|
||||
tool_kind: conversions::tool_kind(invocation.tool_kind),
|
||||
input_json,
|
||||
sequence,
|
||||
traceparent,
|
||||
};
|
||||
if message.encoded_len() > MAX_FRAME_BYTES {
|
||||
return Err(format!(
|
||||
|
||||
Reference in New Issue
Block a user