package: include zsh fork in Codex package

Teach the Codex package builder to fetch the prebuilt zsh fork from a checked-in DotSlash manifest and install it under codex-resources/zsh/bin/zsh when an artifact is available for the package target.

Generalize the DotSlash download/cache/verify helper previously embedded in ripgrep packaging so additional checked-in DotSlash manifests can use the same SHA-256 and size validation path. Add install-context support for locating the bundled zsh fork and thread that path through config loading as the lowest-precedence zsh_path default, preserving explicit CLI/profile/global config values.

Also avoid preserving platform-specific file metadata when copying executables into the package directory so package smoke tests can use macOS system binaries as inputs.
This commit is contained in:
Michael Bolin
2026-05-20 14:54:06 -07:00
parent 896ee672cc
commit 9ccfe3cb29
21 changed files with 468 additions and 176 deletions
+50
View File
@@ -4382,6 +4382,56 @@ async fn add_dir_override_extends_workspace_writable_roots() -> std::io::Result<
Ok(())
}
#[tokio::test]
async fn default_zsh_path_is_lowest_precedence() -> std::io::Result<()> {
let codex_home = TempDir::new()?;
let configured_zsh_path = codex_home.path().join("configured-zsh");
let default_zsh_path = codex_home.path().join("packaged-zsh");
let override_zsh_path = codex_home.path().join("override-zsh");
let config = Config::load_from_base_config_with_overrides(
ConfigToml::default(),
ConfigOverrides {
default_zsh_path: Some(default_zsh_path.clone()),
..Default::default()
},
codex_home.abs(),
)
.await?;
assert_eq!(config.zsh_path, Some(default_zsh_path.clone()));
let config = Config::load_from_base_config_with_overrides(
ConfigToml {
zsh_path: Some(configured_zsh_path.abs()),
..Default::default()
},
ConfigOverrides {
default_zsh_path: Some(default_zsh_path.clone()),
..Default::default()
},
codex_home.abs(),
)
.await?;
assert_eq!(config.zsh_path, Some(configured_zsh_path.clone()));
let config = Config::load_from_base_config_with_overrides(
ConfigToml {
zsh_path: Some(configured_zsh_path.abs()),
..Default::default()
},
ConfigOverrides {
zsh_path: Some(override_zsh_path.clone()),
default_zsh_path: Some(default_zsh_path),
..Default::default()
},
codex_home.abs(),
)
.await?;
assert_eq!(config.zsh_path, Some(override_zsh_path));
Ok(())
}
#[tokio::test]
async fn sqlite_home_defaults_to_codex_home_for_workspace_write() -> std::io::Result<()> {
let codex_home = TempDir::new()?;
+5 -1
View File
@@ -1366,6 +1366,7 @@ impl Config {
cfg,
ConfigOverrides {
cwd: Some(self.cwd.to_path_buf()),
default_zsh_path: refreshed_config.zsh_path.clone(),
..Default::default()
},
refreshed_config.codex_home.clone(),
@@ -2072,6 +2073,7 @@ pub struct ConfigOverrides {
pub codex_linux_sandbox_exe: Option<PathBuf>,
pub main_execve_wrapper_exe: Option<PathBuf>,
pub zsh_path: Option<PathBuf>,
pub default_zsh_path: Option<PathBuf>,
pub base_instructions: Option<String>,
pub developer_instructions: Option<String>,
pub personality: Option<Personality>,
@@ -2469,6 +2471,7 @@ impl Config {
codex_linux_sandbox_exe,
main_execve_wrapper_exe,
zsh_path: zsh_path_override,
default_zsh_path,
base_instructions,
developer_instructions,
personality,
@@ -3235,7 +3238,8 @@ impl Config {
let compact_prompt = compact_prompt.or(file_compact_prompt);
let zsh_path = zsh_path_override
.or(config_profile.zsh_path.map(Into::into))
.or(cfg.zsh_path.map(Into::into));
.or(cfg.zsh_path.map(Into::into))
.or(default_zsh_path);
let review_model = override_review_model.or(cfg.review_model);