mirror of
https://github.com/openai/codex.git
synced 2026-11-25 15:24:26 +00:00
Track image preparation details in turn analytics (#36388)
## What changed - Record the effective detail setting and source and prepared dimensions for successfully decoded images. - Associate message images with their role and tool-output images with their originating call ID. - Include the collected image preparation metadata in the corresponding turn analytics event. ## Testing - Cover image resize metadata, tool-output attribution, turn aggregation, event serialization, and app-server analytics output. GitOrigin-RevId: dbfb5ba1ce7cb02dd93d9b579c5109817f16aef5
This commit is contained in:
1 parent
bf7804c254
commit
1bef168976
13 files changed
+315
-29
No files matched your search
@@ -77,6 +77,8 @@ use crate::facts::CustomAnalyticsFact;
|
||||
use crate::facts::ExternalAgentConfigImportCompletedInput;
|
||||
use crate::facts::ExternalAgentConfigImportFailureInput;
|
||||
use crate::facts::HookRunInput;
|
||||
use crate::facts::ImagePreparationFact;
|
||||
use crate::facts::ImagePreparationMetadata;
|
||||
use crate::facts::PluginInstallFailedInput;
|
||||
use crate::facts::PluginInstallRequestedInput;
|
||||
use crate::facts::PluginState;
|
||||
@@ -369,6 +371,7 @@ struct TurnState {
|
||||
connection_id: Option<u64>,
|
||||
thread_id: Option<String>,
|
||||
num_input_images: Option<usize>,
|
||||
image_preparations: Vec<ImagePreparationMetadata>,
|
||||
resolved_config: Option<TurnResolvedConfigFact>,
|
||||
started_at: Option<u64>,
|
||||
token_usage: Option<TokenUsage>,
|
||||
@@ -543,6 +546,9 @@ impl AnalyticsReducer {
|
||||
CustomAnalyticsFact::TurnCodexError(input) => {
|
||||
self.ingest_turn_codex_error(*input);
|
||||
}
|
||||
CustomAnalyticsFact::ImagePreparation(input) => {
|
||||
self.ingest_image_preparation(*input);
|
||||
}
|
||||
CustomAnalyticsFact::SkillInvoked(input) => {
|
||||
self.ingest_skill_invoked(input, out).await;
|
||||
}
|
||||
@@ -736,6 +742,11 @@ impl AnalyticsReducer {
|
||||
turn_state.codex_error = Some(error);
|
||||
}
|
||||
|
||||
fn ingest_image_preparation(&mut self, input: ImagePreparationFact) {
|
||||
let turn_state = self.turns.entry(input.turn_id).or_default();
|
||||
turn_state.image_preparations.push(input.metadata);
|
||||
}
|
||||
|
||||
async fn ingest_skill_invoked(
|
||||
&mut self,
|
||||
input: SkillInvokedInput,
|
||||
@@ -2729,6 +2740,7 @@ fn codex_turn_event_params(
|
||||
personality: personality_mode(personality),
|
||||
workspace_kind,
|
||||
num_input_images,
|
||||
image_preparations: turn_state.image_preparations.clone(),
|
||||
is_first_turn,
|
||||
status: completed.status,
|
||||
explicit_client_interrupt_requested_at_ms: turn_state
|
||||
|
||||
Reference in new issue
Block a user