mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
Import only the continuation of backgrounded Claude sessions (#55365)
## Why Backgrounding a Claude session creates a continuation that includes its history. Offering both sessions for import duplicates that history. ## What changed Skip sessions containing a `continued-in` record with a nonblank `continuedInSessionId` during import detection, leaving the continuation available for import. ## Testing Add detection and app-server regression tests covering continuation-only detection, importing the full history into one thread, and no remaining import candidates afterward. GitOrigin-RevId: bf8383faadce984ae3c41a0b8e8b3072680fd4b2
This commit is contained in:
@@ -246,6 +246,31 @@ fn assert_history(response: &ThreadReadResponse, expected: &[(&str, &str)]) {
|
||||
assert_eq!(markers, 1, "the import marker must appear exactly once");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn backgrounded_session_imports_only_its_continuation() -> Result<()> {
|
||||
let mut fixture = ImportFixture::new().await?;
|
||||
let continuation = fixture.session_path.with_file_name("background.jsonl");
|
||||
std::fs::copy(&fixture.session_path, &continuation)?;
|
||||
fixture.append_to(&continuation, &[("assistant", LATE_ASSISTANT)])?;
|
||||
fixture.append_raw(&format!(
|
||||
"{}\n",
|
||||
json!({
|
||||
"type": "continued-in",
|
||||
"sessionId": "session",
|
||||
"continuedInSessionId": "background",
|
||||
})
|
||||
))?;
|
||||
|
||||
let imported = fixture.import_one().await?;
|
||||
assert_eq!(fixture.thread_count().await?, 1);
|
||||
assert_history(
|
||||
&fixture.read(&imported).await?,
|
||||
&[("user", FIRST_USER), ("assistant", LATE_ASSISTANT)],
|
||||
);
|
||||
assert!(fixture.detect().await?.items.is_empty());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn cold_exact_prefix_appends_suffix_to_same_task_and_checkpoints() -> Result<()> {
|
||||
let mut fixture = ImportFixture::new().await?;
|
||||
|
||||
Reference in New Issue
Block a user