Fix remote turn diff display roots#23261
Merged
Merged
Conversation
bde168b to
8a032df
Compare
pakrym-oai
reviewed
May 18, 2026
| .await | ||
| .unwrap_or_else(|| turn_environment.cwd.clone()) | ||
| .into_path_buf(), | ||
| None => get_git_repo_root(turn_context.cwd.as_path()) |
Collaborator
There was a problem hiding this comment.
Why do we need the fallback?
Contributor
Author
There was a problem hiding this comment.
.primary() returns Option - so either we need a fallback or should throw
pakrym-oai
reviewed
May 18, 2026
| /// | ||
| /// This mirrors [`get_git_repo_root`] for local paths, but works when `cwd` | ||
| /// only exists inside a selected remote environment. | ||
| pub async fn get_git_repo_root_with_fs( |
Collaborator
There was a problem hiding this comment.
should we convert the original and pass LOCAL_FS where needed?
Contributor
Author
There was a problem hiding this comment.
we would need to convert existing callers to be async which blows this up a bit. im just fixing tests here, can do the LOCAL_FS conversion in a separate PR
pakrym-oai
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
TurnDiffTrackercomputes a display root so turn diffs can be rendered repo-relative. For remote exec-server turns, the selected turncwdmay exist only inside the selected environment, butrun_turnwas discovering the git root through the local host filesystem. When that lookup failed, nested remote-session diffs fell back to the nestedcwdand showed/tmp/...-prefixed paths instead of repo-relative paths.What changed
cwd.codex_git_utils::get_git_repo_root_with_fs(...)so git-root discovery can run against anExecutorFileSystem, including remote environments.resolve_root_git_project_for_trust(...)and add coverage for.gitgitdir-pointer detection.Validation
//codex-rs/core:core-unit-tests --test_filter=get_git_repo_root_with_fs_detects_gitdir_pointer//codex-rs/core:core-all-test --test_filter=apply_patch_turn_diff_paths_stay_repo_relative_when_session_cwd_is_nested