Stop bundling patched zsh in Codex packages (#52213)

## What changed

Remove the patched `zsh` resource from package assembly and macOS signing, along with the `--zsh-bin` and `--zsh-manifest` packaging options.

Delete the standalone `codex-zsh` release workflow, build scripts, and DotSlash manifests. Update package documentation and layout and signing tests to match the remaining resources.

GitOrigin-RevId: 429a8db55048fed7facec89957910206523b6013
This commit is contained in:
jif
2026-10-08 18:17:04 +00:00
committed by copyberry
parent ade12342e2
commit a645742bb5
18 changed files with 12 additions and 577 deletions
-9
View File
@@ -22,7 +22,6 @@ The builder creates a canonical Codex package directory:
│ └── codex-code-mode-host[.exe]
├── codex-resources
│ ├── bwrap # Linux only
│ ├── zsh/bin/zsh # supported Unix targets only
│ ├── codex-command-runner.exe # Windows only
│ └── codex-windows-sandbox-setup.exe # Windows only
└── codex-path
@@ -100,11 +99,3 @@ DotSlash manifest at `scripts/codex_package/rg`. Downloaded archives are cached
under `$TMPDIR/codex-package/<target>-rg` and are reused only after the recorded
size and SHA-256 digest have been verified. Pass `--rg-bin` to use a local
ripgrep executable instead.
The patched zsh fork used by `shell_zsh_fork` is fetched from the DotSlash
manifest at `scripts/codex_package/codex-zsh` when the selected target has a
matching prebuilt artifact. Downloaded archives are cached under
`$TMPDIR/codex-package/<target>-zsh` and installed at
`codex-resources/zsh/bin/zsh`. Pass `--zsh-bin` to package a prebuilt, signed
executable, or `--zsh-manifest` to use a different DotSlash manifest, such as
the manifest published with a standalone zsh artifact release.
+1 -19
View File
@@ -17,7 +17,6 @@ from .targets import TARGET_SPECS
from .targets import PackageInputs
from .targets import default_target
from .targets import resolve_input_path
from .zsh import resolve_zsh_bin
from .version import read_workspace_version
@@ -149,20 +148,6 @@ def create_parser() -> argparse.ArgumentParser:
"targets, bwrap is built with Cargo."
),
)
zsh_source = parser.add_mutually_exclusive_group()
zsh_source.add_argument(
"--zsh-manifest",
type=Path,
help=(
"Optional DotSlash manifest for the patched zsh fork instead of "
"scripts/codex_package/codex-zsh."
),
)
zsh_source.add_argument(
"--zsh-bin",
type=Path,
help="Optional prebuilt zsh executable instead of fetching from a manifest.",
)
parser.add_argument(
"--codex-command-runner-bin",
type=Path,
@@ -245,7 +230,6 @@ def assemble_package(args: argparse.Namespace) -> Path:
entrypoint_bin=source_outputs.entrypoint_bin,
code_mode_host_bin=source_outputs.code_mode_host_bin,
rg_bin=resolve_rg_bin(spec, args.rg_bin),
zsh_bin=resolve_zsh_bin(spec, args.zsh_manifest, zsh_bin=args.zsh_bin),
bwrap_bin=source_outputs.bwrap_bin,
codex_command_runner_bin=source_outputs.codex_command_runner_bin,
codex_windows_sandbox_setup_bin=source_outputs.codex_windows_sandbox_setup_bin,
@@ -262,9 +246,7 @@ def assemble_package(args: argparse.Namespace) -> Path:
and prebuilt is None
):
strip_binary(package_dir / "bin" / filename, spec, tool=args.strip_tool)
validate_package_dir(
package_dir, variant, spec, include_zsh=inputs.zsh_bin is not None
)
validate_package_dir(package_dir, variant, spec)
return package_dir
-55
View File
@@ -1,55 +0,0 @@
#!/usr/bin/env dotslash
{
"name": "codex-zsh",
"platforms": {
"macos-aarch64": {
"size": 358776,
"hash": "sha256",
"digest": "49dec9832379688c9090666694a3449502ac5ebd4d76b9ffde1d0999cd088205",
"format": "tar.gz",
"path": "codex-zsh/bin/zsh",
"providers": [
{
"url": "https://github.com/openai/codex/releases/download/rust-v0.134.0-alpha.3/codex-zsh-aarch64-apple-darwin.tar.gz"
}
]
},
"macos-x86_64": {
"size": 391161,
"hash": "sha256",
"digest": "0246fd4703bb540ae74f13ec739ca365ebd607df44a1f21e335eb7a421352923",
"format": "tar.gz",
"path": "codex-zsh/bin/zsh",
"providers": [
{
"url": "https://github.com/openai/codex/releases/download/rust-v0.134.0-alpha.3/codex-zsh-x86_64-apple-darwin.tar.gz"
}
]
},
"linux-x86_64": {
"size": 433412,
"hash": "sha256",
"digest": "e7f760998c9644448d2cb8a821084a0134d6820c14b284bd7f39d7f32262ad40",
"format": "tar.gz",
"path": "codex-zsh/bin/zsh",
"providers": [
{
"url": "https://github.com/openai/codex/releases/download/rust-v0.134.0-alpha.3/codex-zsh-x86_64-unknown-linux-musl.tar.gz"
}
]
},
"linux-aarch64": {
"size": 411655,
"hash": "sha256",
"digest": "8d50cff5dfabc97e37e1138513da022d9247a802c2ff996ab91654bf1892c7d5",
"format": "tar.gz",
"path": "codex-zsh/bin/zsh",
"providers": [
{
"url": "https://github.com/openai/codex/releases/download/rust-v0.134.0-alpha.3/codex-zsh-aarch64-unknown-linux-musl.tar.gz"
}
]
}
}
}
-15
View File
@@ -8,7 +8,6 @@ from pathlib import Path
from .targets import PackageInputs
from .targets import PackageVariant
from .targets import TargetSpec
from .zsh import ZSH_RESOURCE_PATH
LAYOUT_VERSION = 1
@@ -58,13 +57,6 @@ def build_package_dir(
)
copy_executable(inputs.rg_bin, path_dir / spec.rg_name, is_windows=spec.is_windows)
if inputs.zsh_bin is not None:
copy_executable(
inputs.zsh_bin,
resources_dir / ZSH_RESOURCE_PATH,
is_windows=False,
)
if inputs.bwrap_bin is not None:
copy_executable(inputs.bwrap_bin, resources_dir / "bwrap", is_windows=False)
@@ -98,8 +90,6 @@ def validate_package_dir(
package_dir: Path,
variant: PackageVariant,
spec: TargetSpec,
*,
include_zsh: bool,
) -> None:
required_dirs = [
Path("bin"),
@@ -140,11 +130,6 @@ def validate_package_dir(
]
executable_files = list(required_files)
if include_zsh:
zsh_path = Path("codex-resources") / ZSH_RESOURCE_PATH
required_files.append(zsh_path)
executable_files.append(zsh_path)
if spec.is_linux:
required_files.append(Path("codex-resources") / "bwrap")
executable_files.append(Path("codex-resources") / "bwrap")
@@ -12,7 +12,6 @@ ROOT_OF_EXTRACTED_PACKAGE
├── bwrap # Linux only
├── codex-command-runner.exe # Windows only
├── codex-windows-sandbox-setup.exe # Windows only
└── zsh/bin/zsh # supported Unix targets only
Debug symbols for all shipped binaries arrive in a separate companion archive.
Each package contains one entrypoint, not both codex and codex-app-server.
-1
View File
@@ -46,7 +46,6 @@ class PackageInputs:
entrypoint_bin: Path
code_mode_host_bin: Path
rg_bin: Path
zsh_bin: Path | None
bwrap_bin: Path | None
codex_command_runner_bin: Path | None
codex_windows_sandbox_setup_bin: Path | None
+2 -19
View File
@@ -64,7 +64,6 @@ int main(void) {
"--entrypoint-bin",
"--code-mode-host-bin",
"--rg-bin",
"--zsh-bin",
]
if "linux" in target:
flags.append("--bwrap-bin")
@@ -85,8 +84,7 @@ int main(void) {
else:
self.assertLess(executable.stat().st_size, len(original))
self.assertEqual(source.read_bytes(), original)
for resource in ("codex-path/rg", "codex-resources/zsh/bin/zsh"):
self.assertEqual((package / resource).read_bytes(), original)
self.assertEqual((package / "codex-path/rg").read_bytes(), original)
if "linux" in target:
self.assertEqual(
(package / "codex-resources/bwrap").read_bytes(), original
@@ -164,9 +162,7 @@ int main(void) {
package_dir = root / "package"
package_dir.mkdir()
rg_bin = touch_executable(root / "signed-rg")
zsh_bin = touch_executable(root / "signed-zsh")
rg_bin.write_bytes(b"signed ripgrep binary")
zsh_bin.write_bytes(b"signed zsh binary")
variant = PACKAGE_VARIANTS[variant_name]
spec = TARGET_SPECS[target]
inputs = PackageInputs(
@@ -177,31 +173,20 @@ int main(void) {
root / "codex-code-mode-host"
),
rg_bin=rg_bin,
zsh_bin=zsh_bin,
bwrap_bin=None,
codex_command_runner_bin=None,
codex_windows_sandbox_setup_bin=None,
)
build_package_dir(package_dir, "1.2.3", variant, spec, inputs)
validate_package_dir(
package_dir, variant, spec, include_zsh=True
)
validate_package_dir(package_dir, variant, spec)
self.assertEqual(
{
"rg": (package_dir / "codex-path" / "rg").read_bytes(),
"zsh": (
package_dir
/ "codex-resources"
/ "zsh"
/ "bin"
/ "zsh"
).read_bytes(),
},
{
"rg": b"signed ripgrep binary",
"zsh": b"signed zsh binary",
},
)
@@ -214,7 +199,6 @@ int main(void) {
entrypoint_bin=touch_executable(root / "codex-app-server"),
code_mode_host_bin=touch_executable(root / "codex-code-mode-host"),
rg_bin=touch_executable(root / "rg"),
zsh_bin=None,
bwrap_bin=touch_executable(root / "bwrap"),
codex_command_runner_bin=None,
codex_windows_sandbox_setup_bin=None,
@@ -231,7 +215,6 @@ int main(void) {
package_dir,
PACKAGE_VARIANTS["codex-app-server"],
TARGET_SPECS["x86_64-unknown-linux-musl"],
include_zsh=False,
)
self.assertTrue((package_dir / "bin" / "codex-code-mode-host").is_file())
-83
View File
@@ -1,83 +0,0 @@
#!/usr/bin/env python3
import gzip
import hashlib
import json
from pathlib import Path
import sys
import tarfile
import tempfile
import unittest
from unittest.mock import patch
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from codex_package.targets import TARGET_SPECS
from codex_package.zsh import resolve_zsh_bin
class ResolveZshBinTest(unittest.TestCase):
def test_uses_prebuilt_executable_override(self) -> None:
with tempfile.TemporaryDirectory() as temp_dir:
signed_zsh = Path(temp_dir) / "signed-zsh"
signed_zsh.write_bytes(b"signed zsh binary")
signed_zsh.chmod(0o755)
with patch("codex_package.zsh.fetch_dotslash_executable") as fetch:
zsh_bin = resolve_zsh_bin(
TARGET_SPECS["aarch64-apple-darwin"], zsh_bin=signed_zsh
)
self.assertEqual(zsh_bin, signed_zsh.resolve())
fetch.assert_not_called()
def test_uses_manifest_override(self) -> None:
for archive_format in ("tar.gz", "gz"):
with self.subTest(archive_format=archive_format):
with tempfile.TemporaryDirectory() as temp_dir:
root = Path(temp_dir)
archive = root / f"codex-zsh.{archive_format}"
source = root / "zsh"
source.write_bytes(b"standalone zsh")
if archive_format == "gz":
archive.write_bytes(gzip.compress(source.read_bytes()))
else:
with tarfile.open(archive, "w:gz") as tar:
tar.add(source, arcname="codex-zsh/bin/zsh")
manifest = root / "codex-zsh"
manifest.write_text(
json.dumps(
{
"platforms": {
"linux-x86_64": {
"size": archive.stat().st_size,
"hash": "sha256",
"digest": hashlib.sha256(
archive.read_bytes()
).hexdigest(),
"format": archive_format,
"path": "codex-zsh/bin/zsh",
"providers": [{"url": archive.as_uri()}],
}
}
}
),
encoding="utf-8",
)
with patch(
"codex_package.dotslash.default_cache_root",
return_value=root / "cache",
):
zsh_bin = resolve_zsh_bin(
TARGET_SPECS["x86_64-unknown-linux-musl"], manifest
)
self.assertIsNotNone(zsh_bin)
assert zsh_bin is not None
self.assertEqual(zsh_bin.read_bytes(), b"standalone zsh")
if __name__ == "__main__":
unittest.main()
-28
View File
@@ -1,28 +0,0 @@
"""Fetch the patched zsh fork used by shell_zsh_fork."""
from pathlib import Path
from .dotslash import fetch_dotslash_executable
from .targets import TargetSpec, resolve_input_path
ZSH_MANIFEST = Path(__file__).with_name("codex-zsh")
ZSH_RESOURCE_PATH = Path("zsh") / "bin" / "zsh"
def resolve_zsh_bin(
spec: TargetSpec,
manifest_path: Path | None = None,
*,
zsh_bin: Path | None = None,
) -> Path | None:
if zsh_bin is not None:
return resolve_input_path(zsh_bin, "zsh executable", "--zsh-bin")
return fetch_dotslash_executable(
spec,
manifest_path=manifest_path or ZSH_MANIFEST,
artifact_label="codex-zsh",
cache_key=f"{spec.target}-zsh",
dest_name="zsh",
missing_ok=True,
)