Skip to content

core: preserve selected environment workspace paths#28560

Closed
anp-oai wants to merge 0 commit into
codex/remote-windows-path-requirementsfrom
codex/remote-windows-thread-paths
Closed

core: preserve selected environment workspace paths#28560
anp-oai wants to merge 0 commit into
codex/remote-windows-path-requirementsfrom
codex/remote-windows-thread-paths

Conversation

@anp-oai

@anp-oai anp-oai commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

app-server may run on a different OS from the selected execution environment. Thread metadata and model context therefore need to preserve environment-native workspace paths instead of projecting them onto the app-server host.

This returns the selected environment cwd and runtime roots as API path strings, carries model-visible roots as PathUri through turn context, and reports the implicit active permission profile. The TUI still converts paths only at its host-native config boundary and rejects foreign roots there.

Stacked on #28152.

Validation:

  • just test -p codex-app-server-protocol
  • focused app-server, core, exec, and TUI tests for selected-environment paths
  • bazel test //codex-rs/core/tests/remote_env_windows:smoke-test --test_output=errors
  • just bazel-lock-check

model_provider: "openai".to_string(),
service_tier: None,
cwd,
cwd: codex_utils_path_uri::ApiPathString::from_abs_path(&cwd),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be imported at top of file

.collect()
}

fn render_path_uri(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use one of the lossy infallible conversions for this instead?

&& root == config_snapshot.cwd()
&& let Some(environment_cwd) = selected_environment_cwd
{
let convention = environment_cwd.infer_path_convention().ok_or_else(|| {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as below

- `thread/resume` — reopen an existing thread by id so subsequent `turn/start` calls append to it. Accepts the same permission override rules as `thread/start`.
- `thread/fork` — fork an existing thread into a new thread id by copying the stored history; if the source thread is currently mid-turn, the fork records the same interruption marker as `turn/interrupt` instead of inheriting an unmarked partial turn suffix. The returned `thread.forkedFromId` points at the source thread when known. Accepts `ephemeral: true` for an in-memory temporary fork, emits `thread/started` (including the current `thread.status`), and auto-subscribes you to turn/item events for the new thread. Experimental clients can pass `excludeTurns: true` when they plan to page fork history via `thread/turns/list` instead of receiving the full turn array immediately. Accepts the same permission override rules as `thread/start`.
- `thread/start`, `thread/resume`, and `thread/fork` responses include the legacy `sandbox` compatibility projection. Experimental clients can read `runtimeWorkspaceRoots` for the thread-scoped runtime roots and `activePermissionProfile` for the named or implicit built-in profile identity/provenance when known.
- `thread/start`, `thread/resume`, and `thread/fork` responses include the legacy `sandbox` compatibility projection. Experimental clients can read `runtimeWorkspaceRoots` for the thread-scoped runtime roots and `activePermissionProfile` for the named or implicit built-in profile identity/provenance when known. In a `thread/start` response, the root corresponding to a selected environment's `cwd` uses that environment's native path spelling.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this diff, dont need to mention it

@@ -121,14 +121,12 @@ impl FileSystemContext {
fn from_permission_profile(
permission_profile: &PermissionProfile,
workspace_roots: &[AbsolutePathBuf],

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's discuss in chat why we're passing both here

fn render_environment_cwd(cwd: &PathUri) -> String {
let Some(convention) = cwd.infer_path_convention() else {
return cwd.to_string();
fn render_environment_path(path: &PathUri) -> String {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see https://github.com/openai/codex/pull/28152/changes for my preferred helper shape, crib that one

@anp-oai anp-oai force-pushed the codex/remote-windows-path-requirements branch 5 times, most recently from c5fabde to d7de7ef Compare June 16, 2026 21:24
@anp-oai anp-oai closed this Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant