Include session titles in external agent import history (#35870)

## What changed

- Preserve the original title when importing an external-agent session and return it with successful session entries from `externalAgentConfig/import/readHistories`.
- Add dedicated history-record success types so externally completed imports can optionally supply a session title without changing the live import result type.

## Testing

- Verify imported session titles are returned by the app server and persisted when session import ledger entries are created or refreshed.

GitOrigin-RevId: e896688a5763c238f1e1dc8b4672a7aa7bc1ed4c
This commit is contained in:
charlesgong-openai authored and copyberry committed 2026-07-29 02:45:55 +00:00
1 parent 28f3f1f9ef
commit 9f23e97797
28 files changed
+465 -130

No files matched your search

@@ -787,6 +787,9 @@ pub struct ExternalAgentConfigImportItemTypeSuccess {
pub cwd: Option<PathBuf>,
pub source: Option<String>,
pub target: Option<String>,
/// Original title for an imported session; null for other item types.
#[serde(default)]
pub title: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
@@ -798,6 +801,29 @@ pub struct ExternalAgentConfigImportTypeResult {
pub failures: Vec<ExternalAgentConfigImportItemTypeFailure>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ExternalAgentConfigImportHistoryRecordSuccessParams {
pub item_type: ExternalAgentConfigMigrationItemType,
pub cwd: Option<PathBuf>,
pub source: Option<String>,
pub target: Option<String>,
/// Original title for an imported session, when available.
#[serde(default)]
#[ts(optional = nullable)]
pub title: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ExternalAgentConfigImportHistoryRecordTypeResultParams {
pub item_type: ExternalAgentConfigMigrationItemType,
pub successes: Vec<ExternalAgentConfigImportHistoryRecordSuccessParams>,
pub failures: Vec<ExternalAgentConfigImportItemTypeFailure>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
@@ -805,7 +831,7 @@ pub struct ExternalAgentConfigImportHistoryRecordParams {
/// Opaque provider identifier for the externally completed import.
pub provider_id: String,
/// Completed results grouped by imported item type.
pub item_type_results: Vec<ExternalAgentConfigImportTypeResult>,
pub item_type_results: Vec<ExternalAgentConfigImportHistoryRecordTypeResultParams>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]