Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions codex-rs/core/src/tools/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ impl ToolOrchestrator {
let otel_tn = &tool_ctx.tool_name;
let otel_ci = &tool_ctx.call_id;
let otel_user = ToolDecisionSource::User;
let otel_automated_reviewer = ToolDecisionSource::AutomatedReviewer;
let otel_cfg = ToolDecisionSource::Config;

// 1) Approval
Expand All @@ -136,8 +137,13 @@ impl ToolOrchestrator {
network_approval_context: None,
};
let decision = tool.start_approval_async(req, approval_ctx).await;
let otel_source = if routes_approval_to_guardian(turn_ctx) {
otel_automated_reviewer.clone()
} else {
otel_user.clone()
};

otel.tool_decision(otel_tn, otel_ci, &decision, otel_user.clone());
otel.tool_decision(otel_tn, otel_ci, &decision, otel_source);

match decision {
ReviewDecision::Denied | ReviewDecision::Abort => {
Expand Down Expand Up @@ -286,7 +292,12 @@ impl ToolOrchestrator {
};

let decision = tool.start_approval_async(req, approval_ctx).await;
otel.tool_decision(otel_tn, otel_ci, &decision, otel_user);
let otel_source = if routes_approval_to_guardian(turn_ctx) {
otel_automated_reviewer
} else {
otel_user
};
otel.tool_decision(otel_tn, otel_ci, &decision, otel_source);

match decision {
ReviewDecision::Denied | ReviewDecision::Abort => {
Expand Down
1 change: 1 addition & 0 deletions codex-rs/otel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub use codex_utils_string::sanitize_metric_tag_value;
#[derive(Debug, Clone, Serialize, Display)]
#[serde(rename_all = "snake_case")]
pub enum ToolDecisionSource {
AutomatedReviewer,
Config,
User,
}
Expand Down
Loading