mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
Preserve workspace roots across client and server platforms (#62377)
## Why A TUI connected to an app server on another platform can receive workspace roots that its own filesystem cannot represent. For example, a Windows drive path from the server cannot be stored as a native absolute path on a Unix client. ## What changed Keep `runtimeWorkspaceRoots` as native path strings on the wire for thread start, resume, and fork. Validate absolute paths on the server and store the returned roots as `PathUri` values in the TUI. Use the session's roots for active remote forks, including side chats, and preserve permissions for those roots in the TUI's permission display. ## Testing Cover thread startup with workspace and writable roots from another platform, remote root retention through start, turn, resume, and fork, and server rejection of relative roots. GitOrigin-RevId: 1e9e3bff64a6e7ddadb941f16c4952c44724af54
This commit is contained in:
@@ -37,7 +37,6 @@ use codex_protocol::openai_models::ReasoningEffort;
|
||||
use codex_protocol::protocol::ThreadGoalStatus as CoreThreadGoalStatus;
|
||||
use codex_protocol::protocol::TokenUsage as CoreTokenUsage;
|
||||
use codex_protocol::protocol::TokenUsageInfo as CoreTokenUsageInfo;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_path_uri::LegacyAppPathString;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use serde::Deserialize;
|
||||
@@ -85,7 +84,9 @@ pub struct ThreadStartParams {
|
||||
/// Replace the thread's runtime workspace roots. Paths must be absolute.
|
||||
#[experimental("thread/start.runtimeWorkspaceRoots")]
|
||||
#[ts(optional = nullable)]
|
||||
pub runtime_workspace_roots: Option<Vec<AbsolutePathBuf>>,
|
||||
#[schemars(with = "Option<Vec<codex_utils_absolute_path::AbsolutePathBuf>>")]
|
||||
#[ts(as = "Option<Vec<codex_utils_absolute_path::AbsolutePathBuf>>")]
|
||||
pub runtime_workspace_roots: Option<Vec<LegacyAppPathString>>,
|
||||
#[experimental(nested)]
|
||||
#[ts(optional = nullable)]
|
||||
pub approval_policy: Option<AskForApproval>,
|
||||
@@ -196,14 +197,16 @@ pub struct ThreadStartResponse {
|
||||
/// Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.
|
||||
#[serde(default)]
|
||||
pub disabled_plugin_ids: Vec<String>,
|
||||
#[schemars(with = "AbsolutePathBuf")]
|
||||
#[ts(as = "AbsolutePathBuf")]
|
||||
#[schemars(with = "codex_utils_absolute_path::AbsolutePathBuf")]
|
||||
#[ts(as = "codex_utils_absolute_path::AbsolutePathBuf")]
|
||||
pub cwd: LegacyAppPathString,
|
||||
/// Thread-scoped runtime workspace roots used to materialize
|
||||
/// `:workspace_roots`.
|
||||
#[experimental("thread/start.runtimeWorkspaceRoots")]
|
||||
#[serde(default)]
|
||||
pub runtime_workspace_roots: Vec<AbsolutePathBuf>,
|
||||
#[schemars(with = "Vec<codex_utils_absolute_path::AbsolutePathBuf>")]
|
||||
#[ts(as = "Vec<codex_utils_absolute_path::AbsolutePathBuf>")]
|
||||
pub runtime_workspace_roots: Vec<LegacyAppPathString>,
|
||||
/// Environment-native paths to instruction source files currently loaded for this thread.
|
||||
#[serde(default)]
|
||||
pub instruction_sources: Vec<LegacyAppPathString>,
|
||||
@@ -316,8 +319,8 @@ pub struct ThreadSettings {
|
||||
/// Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.
|
||||
#[serde(default)]
|
||||
pub disabled_plugin_ids: Vec<String>,
|
||||
#[schemars(with = "AbsolutePathBuf")]
|
||||
#[ts(as = "AbsolutePathBuf")]
|
||||
#[schemars(with = "codex_utils_absolute_path::AbsolutePathBuf")]
|
||||
#[ts(as = "codex_utils_absolute_path::AbsolutePathBuf")]
|
||||
pub cwd: LegacyAppPathString,
|
||||
/// Environments configured for future turns, in priority order, primary first.
|
||||
/// `null` means the server does not expose the selection; [] means none are selected.
|
||||
@@ -409,7 +412,9 @@ pub struct ThreadResumeParams {
|
||||
/// Replace the thread's runtime workspace roots. Paths must be absolute.
|
||||
#[experimental("thread/resume.runtimeWorkspaceRoots")]
|
||||
#[ts(optional = nullable)]
|
||||
pub runtime_workspace_roots: Option<Vec<AbsolutePathBuf>>,
|
||||
#[schemars(with = "Option<Vec<codex_utils_absolute_path::AbsolutePathBuf>>")]
|
||||
#[ts(as = "Option<Vec<codex_utils_absolute_path::AbsolutePathBuf>>")]
|
||||
pub runtime_workspace_roots: Option<Vec<LegacyAppPathString>>,
|
||||
#[experimental(nested)]
|
||||
#[ts(optional = nullable)]
|
||||
pub approval_policy: Option<AskForApproval>,
|
||||
@@ -459,14 +464,16 @@ pub struct ThreadResumeResponse {
|
||||
/// Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.
|
||||
#[serde(default)]
|
||||
pub disabled_plugin_ids: Vec<String>,
|
||||
#[schemars(with = "AbsolutePathBuf")]
|
||||
#[ts(as = "AbsolutePathBuf")]
|
||||
#[schemars(with = "codex_utils_absolute_path::AbsolutePathBuf")]
|
||||
#[ts(as = "codex_utils_absolute_path::AbsolutePathBuf")]
|
||||
pub cwd: LegacyAppPathString,
|
||||
/// Thread-scoped runtime workspace roots used to materialize
|
||||
/// `:workspace_roots`.
|
||||
#[experimental("thread/resume.runtimeWorkspaceRoots")]
|
||||
#[serde(default)]
|
||||
pub runtime_workspace_roots: Vec<AbsolutePathBuf>,
|
||||
#[schemars(with = "Vec<codex_utils_absolute_path::AbsolutePathBuf>")]
|
||||
#[ts(as = "Vec<codex_utils_absolute_path::AbsolutePathBuf>")]
|
||||
pub runtime_workspace_roots: Vec<LegacyAppPathString>,
|
||||
/// Environment-native paths to instruction source files currently loaded for this thread.
|
||||
#[serde(default)]
|
||||
pub instruction_sources: Vec<LegacyAppPathString>,
|
||||
@@ -620,7 +627,9 @@ pub struct ThreadForkParams {
|
||||
/// Replace the thread's runtime workspace roots. Paths must be absolute.
|
||||
#[experimental("thread/fork.runtimeWorkspaceRoots")]
|
||||
#[ts(optional = nullable)]
|
||||
pub runtime_workspace_roots: Option<Vec<AbsolutePathBuf>>,
|
||||
#[schemars(with = "Option<Vec<codex_utils_absolute_path::AbsolutePathBuf>>")]
|
||||
#[ts(as = "Option<Vec<codex_utils_absolute_path::AbsolutePathBuf>>")]
|
||||
pub runtime_workspace_roots: Option<Vec<LegacyAppPathString>>,
|
||||
#[experimental(nested)]
|
||||
#[ts(optional = nullable)]
|
||||
pub approval_policy: Option<AskForApproval>,
|
||||
@@ -678,14 +687,16 @@ pub struct ThreadForkResponse {
|
||||
/// Saved list of disabled plugin IDs. Does not yet filter plugin capabilities.
|
||||
#[serde(default)]
|
||||
pub disabled_plugin_ids: Vec<String>,
|
||||
#[schemars(with = "AbsolutePathBuf")]
|
||||
#[ts(as = "AbsolutePathBuf")]
|
||||
#[schemars(with = "codex_utils_absolute_path::AbsolutePathBuf")]
|
||||
#[ts(as = "codex_utils_absolute_path::AbsolutePathBuf")]
|
||||
pub cwd: LegacyAppPathString,
|
||||
/// Thread-scoped runtime workspace roots used to materialize
|
||||
/// `:workspace_roots`.
|
||||
#[experimental("thread/fork.runtimeWorkspaceRoots")]
|
||||
#[serde(default)]
|
||||
pub runtime_workspace_roots: Vec<AbsolutePathBuf>,
|
||||
#[schemars(with = "Vec<codex_utils_absolute_path::AbsolutePathBuf>")]
|
||||
#[ts(as = "Vec<codex_utils_absolute_path::AbsolutePathBuf>")]
|
||||
pub runtime_workspace_roots: Vec<LegacyAppPathString>,
|
||||
/// Environment-native paths to instruction source files currently loaded for this thread.
|
||||
#[serde(default)]
|
||||
pub instruction_sources: Vec<LegacyAppPathString>,
|
||||
|
||||
Reference in New Issue
Block a user