Skip to content

exec-server: canonicalize bound filesystem paths#25149

Merged
starr-openai merged 5 commits into
mainfrom
starr/skills-path-ref-1b-bound-canonicalize
Jun 1, 2026
Merged

exec-server: canonicalize bound filesystem paths#25149
starr-openai merged 5 commits into
mainfrom
starr/skills-path-ref-1b-bound-canonicalize

Conversation

@starr-openai
Copy link
Copy Markdown
Contributor

@starr-openai starr-openai commented May 29, 2026

Summary

  • add executor filesystem canonicalization as a bound-path operation
  • route remote canonicalization through the exec-server filesystem RPC surface
  • keep path normalization attached to the filesystem that owns the path

Stack

Validation

  • cd /Users/starr/code/codex-worktrees/pr-25098-restack-review-pr1b/codex-rs && just fmt
  • Not run: tests/checks (not requested)
  • GitHub CI pending on rewritten head

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab25267ba1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/exec-server/src/environment_path.rs Outdated
Comment thread codex-rs/exec-server/src/remote_file_system.rs Outdated
Comment thread codex-rs/exec-server/src/client.rs
@starr-openai starr-openai force-pushed the starr/skills-path-ref-1b-bound-canonicalize branch 3 times, most recently from 865271a to 1170d1c Compare May 29, 2026 22:14
@starr-openai starr-openai force-pushed the starr/skills-path-ref-1-env-path-ref branch from f1f663f to b444724 Compare May 29, 2026 22:29
@starr-openai starr-openai force-pushed the starr/skills-path-ref-1b-bound-canonicalize branch 2 times, most recently from 1119f59 to 641000f Compare May 29, 2026 22:44
@starr-openai starr-openai force-pushed the starr/skills-path-ref-1-env-path-ref branch from b444724 to 55ec07d Compare May 29, 2026 22:50
@starr-openai starr-openai force-pushed the starr/skills-path-ref-1b-bound-canonicalize branch from 641000f to 8c24577 Compare May 29, 2026 22:50
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Good for me after having double checked my comments

base_path: &AbsolutePathBuf,
path: &Path,
) -> FileSystemResult<AbsolutePathBuf> {
Ok(base_path.join(path))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I might be crazy... but what if

  1. A user gets an EnvironmentPathRef for one allowed skill/root path.
  2. Some later code calls something like join("../outside"), join("/absolute/path"), or join("~/.codex")
  3. AbsolutePathBuf::join normalizes that into a valid absolute path outside the original ref.
  4. Now the caller has a same-filesystem EnvironmentPathRef to a path it was
    never handed

I we want to preserve path authority, should we do everything in relative for this function?
I might be completely wrong here so I invite you to double check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I moved the EnvironmentPathRef struct here to make it general purpose / agnostic of skills, and instead tried to keep the API to mirror AbsolutePathBuf as closely as possible to avoid confusion and simplify migrating existing code paths.

IMO forcing join() to be nested relative to base is a pretty opinionated choice. I'd rather have a helper for that which does the join first, then just checks for the output requirement afterward.

.map(|path| path.map(|path| self.with_path(path)))
}

pub async fn canonicalize(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The new canonicalize method accepts a sandbox, but local() binds LOCAL_FS, which has no runtime paths, so won't the callers hit the helper-path error instead of sandboxed canonicalization?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mmm good catch. I think in practice this is less of a concern, since my intention is to always pass in an explicit Environment (even for local) rather than use this constructor, which is really meant for unsandboxed/internal use-cases.

EnvironmentPathRef::new(Arc::clone(&LOCAL_FS), path)
}

#[async_trait]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Side note but if you want to learn cool stuff about Rust, ask ChatGPT more about async_trait, how does it work, why this is useful and why this is necessary
This is a very interesting example

Base automatically changed from starr/skills-path-ref-1-env-path-ref to main June 1, 2026 17:55
@starr-openai starr-openai force-pushed the starr/skills-path-ref-1b-bound-canonicalize branch from 8c24577 to 111adfb Compare June 1, 2026 17:59
@starr-openai starr-openai merged commit 53ac023 into main Jun 1, 2026
44 of 47 checks passed
@starr-openai starr-openai deleted the starr/skills-path-ref-1b-bound-canonicalize branch June 1, 2026 18:53
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants