mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Restore thread cwd from owned settings snapshots (#41567)
## Why Resuming a thread without an explicit `cwd` should restore that thread's latest retained setting. Forked history can contain settings copied from another thread, while compaction can move the latest setting outside the replay window. ## What changed - Record the owning thread ID on new settings snapshots and only use snapshots owned by the resumed thread when restoring `cwd`. Older snapshots without an owner remain readable but do not override the startup `cwd`. - Checkpoint the current settings after compaction and serialize checkpoints with settings updates so the retained history contains an accepted, current snapshot. - Cover resume behavior across compaction, forks, reverts, legacy histories, and concurrent settings updates. GitOrigin-RevId: 1efc9cf55472d6b88c465c4efe44672a232dbf64
This commit is contained in:
1 parent
4210c08def
commit
f5636bb733
20 files changed
+462
-35
No files matched your search
@@ -3739,7 +3739,21 @@ impl ThreadRequestProcessor {
|
||||
};
|
||||
}
|
||||
|
||||
let history_cwd = thread_history.session_cwd();
|
||||
// Copied or referenced history can contain another thread's settings. Only snapshots
|
||||
// explicitly owned by this thread can override its startup cwd.
|
||||
let history_cwd = if let InitialHistory::Resumed(resumed) = &thread_history {
|
||||
resumed.history.iter().rev().find_map(|item| match item {
|
||||
RolloutItem::EventMsg(EventMsg::ThreadSettingsApplied(event))
|
||||
if event.thread_id == Some(resumed.conversation_id) =>
|
||||
{
|
||||
Some(event.thread_settings.cwd.to_path_buf())
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let history_cwd = history_cwd.or_else(|| thread_history.session_cwd());
|
||||
let runtime_workspace_roots = runtime_workspace_roots.map(resolve_runtime_workspace_roots);
|
||||
let mut typesafe_overrides = self.build_thread_config_overrides(
|
||||
model,
|
||||
|
||||
Reference in new issue
Block a user