mirror of
https://github.com/openai/codex.git
synced 2026-11-20 07:06:24 +00:00
Support paginated thread forks (#35220)
## Why `thread/fork` rejected threads using paginated history, so they could not use the same fork workflow as legacy threads. ## What changed - Create paginated forks by referencing a frozen source-history prefix while persisting only child-owned records in the new rollout. - Support latest, `lastTurnId`, and `beforeTurnId` boundaries, including inherited lineage, model-context reconstruction, interruption markers, and approval-reviewer inheritance. - Make paginated reads and occurrence search traverse referenced history while excluding source records added after the fork. - Coordinate fork preparation with archive and delete operations, and materialize compressed rollouts before they become fork references. ## Testing Added app-server and thread-store coverage for boundary selection, active turns, inherited reads and search, compressed lineage, and concurrent source lifecycle operations. GitOrigin-RevId: 66052d69517d7fb97a3b7817ab77a39c5ad995fd
This commit is contained in:
1 parent
58b4277228
commit
05f000263b
44 files changed
+2810
-295
No files matched your search
@@ -89,20 +89,24 @@ pub(crate) fn materialize_rollout_for_append_blocking(path: &Path) -> io::Result
|
||||
std::fs::create_dir_all(parent)?;
|
||||
}
|
||||
let result: io::Result<()> = (|| {
|
||||
let permissions = std::fs::metadata(compressed_path.as_path())?.permissions();
|
||||
let metadata = std::fs::metadata(compressed_path.as_path())?;
|
||||
let permissions = metadata.permissions();
|
||||
let mut output = create_file_with_permissions(temp_path.as_path(), &permissions)?;
|
||||
{
|
||||
let input = File::open(compressed_path.as_path())?;
|
||||
let mut decoder = zstd::stream::read::Decoder::new(input)?;
|
||||
let mut output = create_file_with_permissions(temp_path.as_path(), &permissions)?;
|
||||
io::copy(&mut decoder, &mut output)?;
|
||||
output.flush()?;
|
||||
output.sync_all()?;
|
||||
}
|
||||
output.flush()?;
|
||||
output.sync_all()?;
|
||||
match std::fs::hard_link(temp_path.as_path(), plain_path.as_path()) {
|
||||
Ok(()) => {}
|
||||
Err(err) if err.kind() == io::ErrorKind::AlreadyExists => {}
|
||||
Err(_) => persist_temp_file_noclobber(temp_path.as_path(), plain_path.as_path())?,
|
||||
}
|
||||
output.set_times(std::fs::FileTimes::new().set_modified(metadata.modified()?))?;
|
||||
output.sync_all()?;
|
||||
drop(output);
|
||||
let _ = std::fs::remove_file(temp_path.as_path());
|
||||
match std::fs::remove_file(compressed_path.as_path()) {
|
||||
Ok(()) => {}
|
||||
|
||||
Reference in new issue
Block a user