mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
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:
committed by
copyberry
parent
28f3f1f9ef
commit
9f23e97797
@@ -17,6 +17,7 @@ use codex_app_server_protocol::ExternalAgentConfigImportHistoriesReadResponse;
|
||||
use codex_app_server_protocol::ExternalAgentConfigImportHistoryRecordParams;
|
||||
use codex_app_server_protocol::ExternalAgentConfigImportHistoryRecordResponse;
|
||||
use codex_app_server_protocol::ExternalAgentConfigImportItemTypeFailure as ProtocolImportFailure;
|
||||
use codex_app_server_protocol::ExternalAgentConfigImportItemTypeSuccess as ProtocolImportSuccess;
|
||||
use codex_app_server_protocol::ExternalAgentConfigImportParams;
|
||||
use codex_app_server_protocol::ExternalAgentConfigImportProgressNotification;
|
||||
use codex_app_server_protocol::ExternalAgentConfigImportResponse;
|
||||
@@ -390,11 +391,30 @@ impl ExternalAgentConfigRequestProcessor {
|
||||
.as_ref()
|
||||
.ok_or_else(|| internal_error("state database is unavailable"))?;
|
||||
let import_id = Uuid::new_v4().to_string();
|
||||
let item_type_results = params
|
||||
.item_type_results
|
||||
.into_iter()
|
||||
.map(|type_result| ProtocolImportTypeResult {
|
||||
item_type: type_result.item_type,
|
||||
successes: type_result
|
||||
.successes
|
||||
.into_iter()
|
||||
.map(|success| ProtocolImportSuccess {
|
||||
item_type: success.item_type,
|
||||
cwd: success.cwd,
|
||||
source: success.source,
|
||||
target: success.target,
|
||||
title: success.title,
|
||||
})
|
||||
.collect(),
|
||||
failures: type_result.failures,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
record_import_history(
|
||||
state_db,
|
||||
import_id.as_str(),
|
||||
Some(params.provider_id.as_str()),
|
||||
¶ms.item_type_results,
|
||||
&item_type_results,
|
||||
)
|
||||
.await
|
||||
.map_err(|err| internal_error(format!("failed to record import history: {err}")))?;
|
||||
@@ -639,6 +659,7 @@ async fn record_import_history(
|
||||
cwd: success.cwd.clone(),
|
||||
source: success.source.clone(),
|
||||
target: success.target.clone(),
|
||||
title: success.title.clone(),
|
||||
})
|
||||
})
|
||||
.collect::<anyhow::Result<Vec<_>>>()?;
|
||||
@@ -672,7 +693,11 @@ fn apply_plugin_outcome_to_item_result(
|
||||
plugin_outcome: PluginImportOutcome,
|
||||
) {
|
||||
for plugin_id in plugin_outcome.succeeded_plugin_ids {
|
||||
item_result.record_success(Some(plugin_id.clone()), Some(plugin_id));
|
||||
item_result.record_success(
|
||||
Some(plugin_id.clone()),
|
||||
Some(plugin_id),
|
||||
/*title*/ None,
|
||||
);
|
||||
}
|
||||
for raw_error in plugin_outcome.raw_errors {
|
||||
item_result.record_error(raw_error);
|
||||
|
||||
Reference in New Issue
Block a user