Skip to content

Commit dd6de52

Browse files
chore(telemetry): make launchedAgent required for agentConfigInit (#2504)
1 parent 7660ebe commit dd6de52

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

crates/chat-cli/src/cli/agent/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ pub enum PermissionEvalResult {
322322

323323
#[derive(Clone, Default, Debug)]
324324
pub struct Agents {
325+
/// Mapping from agent name to an [Agent].
325326
pub agents: HashMap<String, Agent>,
327+
/// Agent name.
326328
pub active_idx: String,
327329
pub trust_all_tools: bool,
328330
}
@@ -384,10 +386,7 @@ impl Agents {
384386
output: &mut impl Write,
385387
) -> (Self, AgentsLoadMetadata) {
386388
// Tracking metadata about the performed load operation.
387-
let mut load_metadata = AgentsLoadMetadata {
388-
launched_agent: agent_name.map(Into::into),
389-
..Default::default()
390-
};
389+
let mut load_metadata = AgentsLoadMetadata::default();
391390

392391
let new_agents = if !skip_migration {
393392
match legacy::migrate(os, false).await {
@@ -683,6 +682,7 @@ impl Agents {
683682
}
684683
}
685684

685+
load_metadata.launched_agent = active_idx.clone();
686686
(
687687
Self {
688688
agents,
@@ -745,7 +745,7 @@ pub struct AgentsLoadMetadata {
745745
pub migrated_count: u32,
746746
pub load_count: u32,
747747
pub load_failed_count: u32,
748-
pub launched_agent: Option<String>,
748+
pub launched_agent: String,
749749
}
750750

751751
async fn load_agents_from_entries(

crates/chat-cli/src/telemetry/core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl Event {
368368
legacy_profile_migration_executed.into(),
369369
),
370370
codewhispererterminal_legacy_profile_migrated_count: Some(legacy_profile_migrated_count.into()),
371-
codewhispererterminal_launched_agent: launched_agent.map(Into::into),
371+
codewhispererterminal_launched_agent: Some(launched_agent.into()),
372372
}
373373
.into_metric_datum(),
374374
),
@@ -502,7 +502,7 @@ pub struct AgentConfigInitArgs {
502502
pub agents_loaded_failed_count: i64,
503503
pub legacy_profile_migration_executed: bool,
504504
pub legacy_profile_migrated_count: i64,
505-
pub launched_agent: Option<String>,
505+
pub launched_agent: String,
506506
}
507507

508508
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]

crates/chat-cli/telemetry_definitions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@
423423
{ "type": "codewhispererterminal_agentsFailedToLoadCount" },
424424
{ "type": "codewhispererterminal_legacyProfileMigrationExecuted", "required": false },
425425
{ "type": "codewhispererterminal_legacyProfileMigratedCount", "required": false },
426-
{ "type": "codewhispererterminal_launchedAgent", "required": false }
426+
{ "type": "codewhispererterminal_launchedAgent" }
427427
]
428428
},
429429
{

0 commit comments

Comments
 (0)