Report detailed session import error types (#33863)

## What changed

- Add stable `sub_error_type` values for external-agent session import failures,
  including detection, preparation, configuration, thread storage, and ledger
  update errors.
- Preserve these values through import results and analytics while leaving
  unrelated plugin and memory errors unchanged.

## Testing

- Verify that a missing session reports `session_not_detected` in both the
  completed import result and its analytics event.

GitOrigin-RevId: cbf1f52df4bb1ac107442c4afa0b130fa32ad0a5
This commit is contained in:
charlesgong-openai
2026-07-17 16:14:36 +00:00
committed by copyberry
parent 20465d30ae
commit ab0f71aed6
5 changed files with 98 additions and 18 deletions
@@ -23,13 +23,14 @@ fn migration_item_type_label(item_type: ExternalAgentConfigMigrationItemType) ->
pub fn record_import_error(
result: &mut ExternalAgentConfigImportItemResult,
failure_stage: &'static str,
sub_error_type: Option<&str>,
message: impl Into<String>,
source: Option<String>,
) {
result.record_error(ExternalAgentConfigImportRawError {
item_type: result.item_type,
error_type: None,
sub_error_type: None,
sub_error_type: sub_error_type.map(str::to_string),
failure_stage: failure_stage.to_string(),
message: message.into(),
cwd: result.cwd.clone(),
@@ -208,6 +208,7 @@ impl ExternalAgentConfigService {
record_import_error(
&mut item_result,
"plugin_import",
/*sub_error_type*/ None,
err.to_string(),
/*source*/ None,
);
@@ -222,6 +223,7 @@ impl ExternalAgentConfigService {
record_import_error(
&mut item_result,
"plugin_import",
/*sub_error_type*/ None,
err.to_string(),
/*source*/ None,
);
@@ -239,6 +241,7 @@ impl ExternalAgentConfigService {
record_import_error(
&mut item_result,
"plugin_import",
/*sub_error_type*/ None,
err.to_string(),
/*source*/ None,
);
@@ -350,6 +353,7 @@ impl ExternalAgentConfigService {
record_import_error(
&mut item_result,
"memory_import",
/*sub_error_type*/ None,
failure.message,
Some(failure.project_key),
);