mirror of
https://github.com/openai/codex.git
synced 2026-05-29 07:19:50 +00:00
Use remote filesystem for turn git root discovery
Remote test workspaces can live only inside the executor filesystem, so local git discovery cannot find repo markers for turn diffs. Add an executor-filesystem-backed repo root lookup and use it when building the turn diff display root. Align core-skills test project-layer discovery with the same ambient git marker filtering used by production discovery. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -38,6 +38,21 @@ pub fn get_git_repo_root(base_dir: &Path) -> Option<PathBuf> {
|
||||
find_ancestor_git_entry(base).map(|(repo_root, _)| repo_root)
|
||||
}
|
||||
|
||||
/// Return the git repository root for `base_dir` using the provided executor
|
||||
/// filesystem. This is the remote-environment equivalent of [`get_git_repo_root`].
|
||||
pub async fn get_git_repo_root_with_fs(
|
||||
fs: &dyn ExecutorFileSystem,
|
||||
base_dir: &AbsolutePathBuf,
|
||||
) -> Option<AbsolutePathBuf> {
|
||||
let base = match fs.get_metadata(base_dir, /*sandbox*/ None).await {
|
||||
Ok(metadata) if metadata.is_directory => base_dir.clone(),
|
||||
_ => base_dir.parent()?,
|
||||
};
|
||||
find_ancestor_git_entry_with_fs(fs, &base)
|
||||
.await
|
||||
.map(|(repo_root, _)| repo_root)
|
||||
}
|
||||
|
||||
/// Timeout for git commands to prevent freezing on large repositories
|
||||
const GIT_COMMAND_TIMEOUT: TokioDuration = TokioDuration::from_secs(5);
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ pub use info::default_branch_name;
|
||||
pub use info::get_git_remote_urls;
|
||||
pub use info::get_git_remote_urls_assume_git_repo;
|
||||
pub use info::get_git_repo_root;
|
||||
pub use info::get_git_repo_root_with_fs;
|
||||
pub use info::get_has_changes;
|
||||
pub use info::get_head_commit_hash;
|
||||
pub use info::git_diff_to_remote;
|
||||
|
||||
Reference in New Issue
Block a user