mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Preserve plugin install failure subtypes during imports (#33182)
## What changed - Add `subErrorType` to external agent config import failures and carry it through progress and completion notifications, persisted import histories, and analytics. - Expose plugin store failure subtypes from `PluginInstallError` so manual installs and imported plugins report details such as `failed_to_copy_plugin_file` while failures without a subtype remain `null`. - Keep existing persisted import records compatible by defaulting the new field when it is absent. ## Testing - Cover store I/O subtype extraction, analytics serialization, persisted import histories, and migration notification fixtures. GitOrigin-RevId: ec1a85623fc826cbd7cfe9f55c2dd2bc86665937
This commit is contained in:
committed by
copyberry
parent
44954d1b4b
commit
3fae30dd85
@@ -640,6 +640,7 @@ fn track_completed_import_notification(
|
||||
item_type: item_type.clone(),
|
||||
failure_stage: failure.failure_stage.clone(),
|
||||
error_type: import_failure_error_type(failure),
|
||||
sub_error_type: failure.sub_error_type.clone(),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -692,6 +693,7 @@ async fn record_completed_import_notification(
|
||||
Ok(ExternalAgentConfigImportFailureRecord {
|
||||
item_type: serde_json::from_value(serde_json::to_value(failure.item_type)?)?,
|
||||
error_type: failure.error_type.clone(),
|
||||
sub_error_type: failure.sub_error_type.clone(),
|
||||
failure_stage: failure.failure_stage.clone(),
|
||||
message: failure.message.clone(),
|
||||
cwd: failure.cwd.clone(),
|
||||
@@ -747,6 +749,7 @@ fn protocol_import_failure_record(
|
||||
Ok(ProtocolImportFailure {
|
||||
item_type: protocol_import_record_item_type(record.item_type)?,
|
||||
error_type: record.error_type,
|
||||
sub_error_type: record.sub_error_type,
|
||||
failure_stage: record.failure_stage,
|
||||
message: record.message,
|
||||
cwd: record.cwd,
|
||||
@@ -844,6 +847,7 @@ fn protocol_import_raw_error(raw_error: &CoreImportRawError) -> ProtocolImportFa
|
||||
ProtocolImportFailure {
|
||||
item_type: protocol_migration_item_type(raw_error.item_type),
|
||||
error_type: raw_error.error_type.clone(),
|
||||
sub_error_type: raw_error.sub_error_type.clone(),
|
||||
failure_stage: raw_error.failure_stage.clone(),
|
||||
message: raw_error.message.clone(),
|
||||
cwd: raw_error.cwd.clone(),
|
||||
|
||||
@@ -170,6 +170,7 @@ pub(crate) struct ExternalAgentConfigImportSuccess {
|
||||
pub(crate) struct ExternalAgentConfigImportRawError {
|
||||
pub item_type: ExternalAgentConfigMigrationItemType,
|
||||
pub error_type: Option<String>,
|
||||
pub sub_error_type: Option<String>,
|
||||
pub failure_stage: String,
|
||||
pub message: String,
|
||||
pub cwd: Option<PathBuf>,
|
||||
@@ -448,6 +449,7 @@ impl ExternalAgentConfigService {
|
||||
item_result.record_error(ExternalAgentConfigImportRawError {
|
||||
item_type,
|
||||
error_type: Some(error_type.to_string()),
|
||||
sub_error_type: None,
|
||||
failure_stage: "import_request_failed".to_string(),
|
||||
message,
|
||||
cwd: item_result.cwd.clone(),
|
||||
@@ -1068,12 +1070,14 @@ impl ExternalAgentConfigService {
|
||||
Err(err) => {
|
||||
let plugin_id = format!("{plugin_name}@{marketplace_name}");
|
||||
outcome.failed_plugin_ids.push(plugin_id.clone());
|
||||
let sub_error_type = err.sub_error_type();
|
||||
let mut raw_error = plugin_import_raw_error(
|
||||
cwd,
|
||||
"plugin_import",
|
||||
err.to_string(),
|
||||
Some(plugin_id),
|
||||
);
|
||||
raw_error.sub_error_type = sub_error_type;
|
||||
if matches!(
|
||||
err,
|
||||
PluginInstallError::Marketplace(
|
||||
@@ -1660,6 +1664,7 @@ pub(crate) fn record_import_error(
|
||||
result.record_error(ExternalAgentConfigImportRawError {
|
||||
item_type: result.item_type,
|
||||
error_type: None,
|
||||
sub_error_type: None,
|
||||
failure_stage: failure_stage.to_string(),
|
||||
message: message.into(),
|
||||
cwd: result.cwd.clone(),
|
||||
@@ -1691,6 +1696,7 @@ fn plugin_import_raw_error(
|
||||
ExternalAgentConfigImportRawError {
|
||||
item_type: ExternalAgentConfigMigrationItemType::Plugins,
|
||||
error_type: None,
|
||||
sub_error_type: None,
|
||||
failure_stage: failure_stage.to_string(),
|
||||
message,
|
||||
cwd: cwd.map(Path::to_path_buf),
|
||||
|
||||
@@ -49,6 +49,7 @@ fn assert_single_plugin_raw_error(
|
||||
);
|
||||
assert_eq!(raw_error.failure_stage, failure_stage);
|
||||
assert_eq!(raw_error.error_type.as_deref(), error_type);
|
||||
assert_eq!(raw_error.sub_error_type, None);
|
||||
assert_eq!(raw_error.cwd, None);
|
||||
assert_eq!(raw_error.source.as_deref(), Some(source));
|
||||
assert!(!raw_error.message.is_empty());
|
||||
|
||||
@@ -1750,6 +1750,7 @@ impl PluginRequestProcessor {
|
||||
plugin,
|
||||
PluginInstallSource::Manual,
|
||||
error_type.to_string(),
|
||||
sub_error_type,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user