mirror of
https://github.com/openai/codex.git
synced 2026-10-26 18:38:47 +00:00
Preserve runtime workspace roots across thread resume (#43848)
## Why Resuming a thread should retain its selected workspace folders, including additional roots and explicit empty selections. Resume overrides also need to survive a subsequent resume when no turn has run. ## What changed - Persist `runtime_workspace_roots` in startup metadata and thread settings snapshots, separately from explicit environment selections and permission-profile roots. - Restore roots from the latest snapshot owned by the resumed thread, falling back to owned startup metadata only when no snapshot exists. Honor explicit `runtimeWorkspaceRoots` overrides, retarget the old `cwd` root when `cwd` changes, deduplicate roots, and validate restored paths for the current host. - Checkpoint effective settings on resume and restored settings after revert. Reload resume configuration if saved workspace roots change during loading. - Normalize Windows rollout path spellings when matching thread search results, preserving selection of the correct rollout after revert, including compressed rollouts. ## Testing Add regression coverage for workspace restoration, empty and explicit overrides, foreign paths, compaction and revert, resume checkpoints without recency changes, concurrent settings persistence, and rollout search path matching. GitOrigin-RevId: d98d9d34dd63934d441120916c61c12b69e7f062
This commit is contained in:
@@ -522,6 +522,10 @@ pub struct ThreadSettingsOverrides {
|
||||
/// Updated fallback `cwd` and environments supplied together as a complete pair.
|
||||
pub environments: Option<TurnEnvironmentSelections>,
|
||||
|
||||
/// Updated top-level runtime workspace roots for default environments.
|
||||
/// Explicit environment selections own their roots separately.
|
||||
pub runtime_workspace_roots: Option<Vec<AbsolutePathBuf>>,
|
||||
|
||||
/// Updated profile-defined workspace roots for status summaries and
|
||||
/// per-turn config reconstruction.
|
||||
pub profile_workspace_roots: Option<Vec<AbsolutePathBuf>>,
|
||||
@@ -2203,6 +2207,12 @@ pub struct ThreadSettingsSnapshot {
|
||||
#[ts(optional)]
|
||||
pub active_permission_profile: Option<ActivePermissionProfile>,
|
||||
pub cwd: AbsolutePathBuf,
|
||||
/// Top-level runtime workspace roots for default environments, excluding roots
|
||||
/// supplied by explicit environment selections or permission profiles.
|
||||
/// An absent value means unknown; an empty list means no roots.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub runtime_workspace_roots: Option<Vec<AbsolutePathBuf>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reasoning_effort: Option<ReasoningEffortConfig>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -3051,6 +3061,13 @@ pub struct SessionMeta {
|
||||
pub parent_thread_id: Option<ThreadId>,
|
||||
pub timestamp: String,
|
||||
pub cwd: PathBuf,
|
||||
/// Top-level runtime workspace roots at creation for default environments,
|
||||
/// excluding roots supplied by explicit environment selections or permission profiles.
|
||||
/// An absent value means unknown; an empty list means no roots.
|
||||
/// Keep native paths parseable across hosts; validate them when restoring settings.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub runtime_workspace_roots: Option<Vec<PathBuf>>,
|
||||
pub originator: String,
|
||||
pub cli_version: String,
|
||||
#[serde(default)]
|
||||
@@ -3112,6 +3129,7 @@ impl Default for SessionMeta {
|
||||
parent_thread_id: None,
|
||||
timestamp: String::new(),
|
||||
cwd: PathBuf::new(),
|
||||
runtime_workspace_roots: None,
|
||||
originator: String::new(),
|
||||
cli_version: String::new(),
|
||||
source: SessionSource::default(),
|
||||
|
||||
Reference in New Issue
Block a user