mirror of
https://github.com/openai/codex.git
synced 2026-11-22 23:00:42 +00:00
Expose fork source thread ids in app-server v2
This commit is contained in:
@@ -8487,6 +8487,7 @@ async fn summary_from_thread_list_item(
|
||||
);
|
||||
return Some(ConversationSummary {
|
||||
conversation_id: thread_id,
|
||||
forked_from_id: None,
|
||||
path: it.path,
|
||||
preview: it.first_user_message.unwrap_or_default(),
|
||||
timestamp,
|
||||
@@ -8561,6 +8562,7 @@ fn summary_from_state_db_metadata(
|
||||
};
|
||||
ConversationSummary {
|
||||
conversation_id,
|
||||
forked_from_id: None,
|
||||
path,
|
||||
preview,
|
||||
timestamp: Some(timestamp),
|
||||
@@ -8658,6 +8660,7 @@ pub(crate) async fn read_summary_from_rollout(
|
||||
|
||||
Ok(ConversationSummary {
|
||||
conversation_id: session_meta.id,
|
||||
forked_from_id: session_meta.forked_from_id,
|
||||
timestamp,
|
||||
updated_at,
|
||||
path: path.to_path_buf(),
|
||||
@@ -8718,6 +8721,7 @@ fn extract_conversation_summary(
|
||||
|
||||
Some(ConversationSummary {
|
||||
conversation_id,
|
||||
forked_from_id: session_meta.forked_from_id,
|
||||
timestamp,
|
||||
updated_at,
|
||||
path,
|
||||
@@ -8876,6 +8880,7 @@ fn build_thread_from_snapshot(
|
||||
pub(crate) fn summary_to_thread(summary: ConversationSummary) -> Thread {
|
||||
let ConversationSummary {
|
||||
conversation_id,
|
||||
forked_from_id,
|
||||
path,
|
||||
preview,
|
||||
timestamp,
|
||||
@@ -8897,7 +8902,7 @@ pub(crate) fn summary_to_thread(summary: ConversationSummary) -> Thread {
|
||||
|
||||
Thread {
|
||||
id: conversation_id.to_string(),
|
||||
forked_from_id: None,
|
||||
forked_from_id: forked_from_id.map(|id| id.to_string()),
|
||||
preview,
|
||||
ephemeral: false,
|
||||
model_provider,
|
||||
@@ -9276,6 +9281,7 @@ mod tests {
|
||||
|
||||
let expected = ConversationSummary {
|
||||
conversation_id,
|
||||
forked_from_id: None,
|
||||
timestamp: timestamp.clone(),
|
||||
updated_at: timestamp,
|
||||
path,
|
||||
@@ -9332,6 +9338,7 @@ mod tests {
|
||||
|
||||
let expected = ConversationSummary {
|
||||
conversation_id,
|
||||
forked_from_id: None,
|
||||
timestamp: Some(timestamp.clone()),
|
||||
updated_at: Some("2025-09-05T16:53:11Z".to_string()),
|
||||
path: path.clone(),
|
||||
@@ -9429,6 +9436,11 @@ mod tests {
|
||||
forked_from_id_from_rollout(path.as_path()).await,
|
||||
Some(forked_from_id.to_string())
|
||||
);
|
||||
|
||||
let summary = read_summary_from_rollout(path.as_path(), "fallback").await?;
|
||||
let thread = summary_to_thread(summary);
|
||||
|
||||
assert_eq!(thread.forked_from_id, Some(forked_from_id.to_string()));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user