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:
charlesgong-openai authored and copyberry committed 2026-07-14 22:21:27 +00:00
1 parent 44954d1b4b
commit 3fae30dd85
22 files changed
+114 -29

No files matched your search

@@ -18,6 +18,8 @@ pub struct ExternalAgentConfigImportSuccessRecord {
pub struct ExternalAgentConfigImportFailureRecord {
pub item_type: String,
pub error_type: Option<String>,
#[serde(default)]
pub sub_error_type: Option<String>,
pub failure_stage: String,
pub message: String,
pub cwd: Option<PathBuf>,
@@ -38,6 +38,7 @@ async fn records_completion_by_import_id() -> anyhow::Result<()> {
&[ExternalAgentConfigImportFailureRecord {
item_type: "MCP_SERVER_CONFIG".to_string(),
error_type: None,
sub_error_type: Some("failed_to_copy_plugin_file".to_string()),
failure_stage: "import".to_string(),
message: "failed".to_string(),
cwd: None,
@@ -68,6 +69,7 @@ async fn records_completion_by_import_id() -> anyhow::Result<()> {
failures: vec![ExternalAgentConfigImportFailureRecord {
item_type: "MCP_SERVER_CONFIG".to_string(),
error_type: None,
sub_error_type: Some("failed_to_copy_plugin_file".to_string()),
failure_stage: "import".to_string(),
message: "failed".to_string(),
cwd: None,
@@ -106,6 +108,7 @@ async fn records_completion_by_import_id() -> anyhow::Result<()> {
vec![ExternalAgentConfigImportFailureRecord {
item_type: "MCP_SERVER_CONFIG".to_string(),
error_type: None,
sub_error_type: Some("failed_to_copy_plugin_file".to_string()),
failure_stage: "import".to_string(),
message: "failed".to_string(),
cwd: None,