Skip to content
lonlundgrenPublic

About

Versioned patches and native build tooling for a 1M-context Codex CLI variant (gpt-5.6-sol)

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codex-1m

Versioned patches and native build tooling for a Codex CLI variant configured for the extended context window used by gpt-5.6-sol.

The patch removes two local client clamps:

  • A configured context window may exceed the model catalog maximum.
  • An automatic-compaction limit of i64::MAX is preserved instead of being reduced to 90 percent of the context window.

The launcher selects gpt-5.6-sol, sets the context window to 1,050,000 tokens, and sets the automatic-compaction limit to i64::MAX. These are client-side changes; the service still decides what requests it accepts.

codex-1m is intentionally a Sol-specific launcher. Do not switch it to another model with /model: the explicit context and compaction overrides would remain active. Exit it and start the normal codex launcher when using another model.

This repository contains no authentication data or compiled binaries.

Repository layout

VERSION
launcher/codex-1m
scripts/build
scripts/verify
scripts/install
versions/<version>/codex-1m.patch
versions/<version>/source-commit
artifacts/<version>/<platform>/       # generated and ignored by Git
.work/                                # temporary and ignored by Git

VERSION supplies the default version when a command does not receive one. Each supported Codex version has its own patch and a full upstream commit pin. Builds and artifacts are native to their platform.

Supported native platforms are:

  • Apple silicon macOS: darwin-arm64
  • x86-64 Linux: linux-x86_64
  • ARM64 Linux: linux-arm64

Prerequisites

Install Git, Rust through rustup, and the native build tools for the machine. The upstream checkout pins its Rust toolchain, which rustup installs when needed.

On macOS, install the Xcode Command Line Tools:

xcode-select --install

On Linux, the default build needs file and the binutils strip command. --keep-symbols also needs objcopy and tar. The source build may require the usual C/C++ compilation and system-library packages for the distribution.

The scripts use sha256sum when available and otherwise use shasum.

Build

From the repository root:

./scripts/build

Or select a version explicitly:

./scripts/build 0.146.1

The build performs the following operations:

  1. Detects the native platform.
  2. Clones the upstream rust-v<version> tag into a unique .work/ directory and requires it to resolve to versions/<version>/source-commit.
  3. Confirms and applies versions/<version>/codex-1m.patch.
  4. Runs one foreground Cargo release build.
  5. Packages the binary, checks its reported identity using an isolated temporary CODEX_HOME inside the build work directory, and generates its manifest.
  6. Assembles a complete artifact directory, moves the prior directory to a temporary backup, and publishes the new directory. An ordinary publication failure restores the backup.

A successful build removes its temporary work directory. A failed build leaves the work directory in place and reports its path. Work interrupted during publication can leave a .previous-<platform>.* backup under the version's artifact directory, preserving the prior complete artifact for recovery.

The default output is:

artifacts/<version>/<platform>/codex
artifacts/<version>/<platform>/manifest.txt

The build refuses publication unless the binary reports the expected identity under an isolated temporary CODEX_HOME. The manifest records that observed identity, the source tag and pinned commit, native platform, binary format, binary and patch checksums, packaging mode, focused-test status, and the Rust and Cargo versions selected by the upstream source tree. The identity check's temporary Codex state is removed with the successful build work directory.

Focused patch tests

When preparing or rebasing a patch for a new Codex version, run its two focused tests before the release build:

./scripts/build --test-patch 0.146.1

This runs:

  • model_context_window_override_can_exceed_catalog_max_context_window
  • max_auto_compact_token_limit_disables_context_window_clamp

Failure stops the build before artifact publication and preserves the work directory. Success is recorded as patch_tests=passed; a normal build records patch_tests=not-run.

These tests validate the two client changes. They do not test whether the service accepts a particular context length. Because the source commit is pinned and the patch is versioned, normal repeated builds do not need to rerun them.

Packaging modes

All modes use the same optimized Cargo release profile:

./scripts/build 0.146.1
./scripts/build --unstripped 0.146.1
./scripts/build --keep-symbols 0.146.1
  • The default strips the installable binary and discards debugging symbols.
  • --unstripped preserves the optimized symbol-bearing binary.
  • --keep-symbols strips the binary and retains artifacts/<version>/<platform>/codex-symbols.tar.gz.

--unstripped and --keep-symbols are mutually exclusive. Either can be combined with --test-patch.

Running another build for the same version and platform is supported. The new successful output replaces the old artifact. If the packaging mode no longer retains a symbol archive, any old archive is removed during publication. Builds for the same version and platform must be run sequentially; concurrent publication to the same artifact directory is not supported.

Verify

Verify the default native artifact and its generated manifest:

./scripts/verify
./scripts/verify 0.146.1

An explicit binary and manifest may also be supplied:

./scripts/verify 0.146.1 /path/to/codex /path/to/manifest.txt

Verification checks the version, source tag and pinned commit, literal binary identity, native platform and binary format, packaging metadata, binary checksum, patch checksum, focused-test status, and retained symbol archive when present. Verification does not execute the Codex binary. It checks consistency with the generated manifest and does not independently prove how that manifest was produced.

Install and reinstall

Install the generated native artifact:

./scripts/install
./scripts/install 0.146.1

The installer:

  1. Verifies the artifact against its generated manifest.
  2. Copies the binary and manifest into a temporary staging directory.
  3. Verifies the staged copy.
  4. Installs it under ~/.local/lib/codex-1m/<version>/.
  5. Points ~/.local/lib/codex-1m/current at that version.
  6. Installs the launcher as ~/.local/bin/codex-1m, atomically replacing an older regular-file copy when the repository launcher changes.

Installing the same version repeatedly is supported. If the installed binary and manifest, launcher, and current link already match, the installer returns without creating a staging copy. If a different verified build of the same version is present, the installer stages it, replaces the prior version directory, and removes the temporary backup after success. A launcher being replaced is also retained until the current link switches successfully and is restored if that transaction fails.

The retained symbol archive is not installed. It remains in the ignored artifact directory.

Ensure ~/.local/bin is on PATH, then check the installed version:

codex-1m --version

Start the TUI and confirm that its status line shows the expected model and 1.05M window:

codex-1m

Sign in independently on each machine. Do not copy authentication files between machines.

Repeating the workflow on another machine

Synchronize the repository without compiled artifacts or temporary build work:

rsync -a --exclude artifacts/ --exclude .work/ \
  ./ user@host:~/workspace/codex-1m/

On the destination machine, build and install natively:

cd ~/workspace/codex-1m
./scripts/build
./scripts/install
codex-1m --version

A Linux artifact does not run on macOS, and a macOS artifact does not run on Linux. Build on each target platform instead of transporting binaries.

Upgrading Codex

For a new upstream version:

  1. Create versions/<new-version>/codex-1m.patch by rebasing the two source changes and their focused tests against the upstream tag.
  2. Record the tag's reviewed full commit SHA in versions/<new-version>/source-commit.
  3. Update VERSION if the new version should become the default.
  4. Run ./scripts/build --test-patch <new-version> on one native development machine. This also produces that machine's release artifact.
  5. Run the normal native build on each remaining platform that will use the binary.
  6. Run ./scripts/verify <new-version> and ./scripts/install <new-version> on each machine.
  7. Smoke-test codex-1m --version and the TUI context-window display. Keep that launcher on gpt-5.6-sol; use normal codex for other models.

The patch must be reviewed and rebased for each upstream version. A clean git apply result alone does not prove that upstream semantics remain compatible with the two changes.

About

Versioned patches and native build tooling for a 1M-context Codex CLI variant (gpt-5.6-sol)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages