mirror of
https://github.com/openai/codex.git
synced 2026-10-20 08:19:50 +00:00
## Summary Backport #40994 to the 0.150 stable release line. Enable `compaction_image_budget` by default so retained images count against the existing remote-compaction token budget and older images are trimmed as needed. Explicitly disabling the feature preserves the previous behavior. The runtime change is a clean cherry-pick of `528fd7ace5ec0a1c2a387dcb9c76a09f3fa011ee`. The implementation is already present in 0.150.0; only the feature default/stability and the existing integration test expectations change. CI-only corrections address failures already present in the public release base: recognize the valid `OFlags::WRONLY` identifier in codespell, remove the obsolete code-mode manifest-feature exception, remove an unused test import left by the public export, and stage the code-mode host beside the CLI in SDK tests. The SDK staging change matches the existing internal workflow. These changes do not alter CLI runtime behavior or dependencies. ## Validation - Existing integration coverage exercises default/on/off behavior across repeated compactions and checks retained images in follow-up requests. - `just test -p codex-features`: 39 passed, none skipped. - `just test -p codex-core --test all remote_compact_v2_charges_retained_images_to_token_budget`: all three default/on/off cases passed. - `just test -p codex-core --lib image_budget_tests`: 4 passed. - `python3 .github/scripts/verify_cargo_workspace_manifests.py`, the pinned codespell check for the affected identifier, pinned `just fmt`, and `git diff --check` passed. - CI must pass on the final head before release. ## Release Targets `release/0.150`, based on the source commit for 0.150.0 (`076f17c114b0a82d7235552ccec5ff2d69f3266a`). Intended for the next 0.150 stable patch. --------- Co-authored-by: pakrym-oai <pakrym@openai.com>
154 lines
5.3 KiB
YAML
154 lines
5.3 KiB
YAML
name: sdk
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
python-sdk:
|
|
runs-on:
|
|
group: ${{ github.event.repository.name }}-runners
|
|
labels: ${{ github.event.repository.name }}-linux-x64
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Test Python SDK
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
# Run inside a glibc Linux image so dependency resolution exercises
|
|
# the pinned manylinux runtime wheel that users install.
|
|
docker run --rm \
|
|
--user "$(id -u):$(id -g)" \
|
|
-e HOME=/tmp/codex-python-sdk-home \
|
|
-e UV_LINK_MODE=copy \
|
|
-v "${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}" \
|
|
-w "${GITHUB_WORKSPACE}/sdk/python" \
|
|
python:3.12-slim \
|
|
sh -euxc '
|
|
python -m venv /tmp/uv
|
|
/tmp/uv/bin/python -m pip install uv==0.11.3
|
|
/tmp/uv/bin/uv sync --group dev --frozen
|
|
/tmp/uv/bin/uv run --frozen --no-sync ruff check --output-format=github .
|
|
/tmp/uv/bin/uv run --frozen --no-sync ruff format --check .
|
|
/tmp/uv/bin/uv run --frozen --no-sync pytest
|
|
'
|
|
|
|
- name: Check for a clean worktree
|
|
if: always() && !cancelled()
|
|
uses: ./.github/actions/check-clean-worktree
|
|
|
|
sdks:
|
|
runs-on:
|
|
group: ${{ github.event.repository.name }}-runners
|
|
labels: ${{ github.event.repository.name }}-linux-x64
|
|
timeout-minutes: 10
|
|
environment:
|
|
name: bazel
|
|
deployment: false
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install Linux bwrap build dependencies
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
sudo apt-get update -y
|
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends pkg-config libcap-dev
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@a8198c4bff370c8506180b035930dea56dbd5288 # v5
|
|
with:
|
|
run_install: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- name: Set up Bazel CI
|
|
id: setup_bazel
|
|
uses: ./.github/actions/setup-bazel-ci
|
|
with:
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
- name: Build codex and the code-mode host with Bazel
|
|
env:
|
|
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
# Use the shared CI wrapper so fork PRs fall back cleanly when
|
|
# BuildBuddy credentials are unavailable. This workflow needs the
|
|
# built binaries on disk afterwards, so ask the wrapper to override
|
|
# CI's default remote_download_minimal behavior.
|
|
./.github/scripts/run-bazel-ci.sh \
|
|
--remote-download-toplevel \
|
|
-- \
|
|
build \
|
|
--build_metadata=COMMIT_SHA=${GITHUB_SHA} \
|
|
--build_metadata=TAG_job=sdk \
|
|
-- \
|
|
//codex-rs/cli:codex \
|
|
//codex-rs/code-mode-host:codex-code-mode-host
|
|
|
|
cquery_output="$(
|
|
./.github/scripts/run-bazel-ci.sh \
|
|
-- \
|
|
cquery \
|
|
--output=files \
|
|
-- \
|
|
'set(//codex-rs/cli:codex //codex-rs/code-mode-host:codex-code-mode-host)' \
|
|
| grep -E '^(/|bazel-out/)'
|
|
)"
|
|
mapfile -t bazel_output_paths <<< "${cquery_output}"
|
|
if [[ ${#bazel_output_paths[@]} -ne 2 ]]; then
|
|
echo "Expected both Bazel-built binaries, found ${#bazel_output_paths[@]}." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Stage both binaries together so the CLI can discover its sibling
|
|
# code-mode host while the SDK tests spawn the CLI directly.
|
|
install_dir="${GITHUB_WORKSPACE}/.tmp/sdk-ci"
|
|
mkdir -p "${install_dir}"
|
|
install -m 755 "${bazel_output_paths[@]}" "${install_dir}"
|
|
echo "CODEX_EXEC_PATH=${install_dir}/codex" >> "$GITHUB_ENV"
|
|
|
|
- name: Warm up Bazel-built codex
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
"${CODEX_EXEC_PATH}" --version
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build SDK packages
|
|
run: pnpm -r --filter ./sdk/typescript run build
|
|
|
|
- name: Lint SDK packages
|
|
run: pnpm -r --filter ./sdk/typescript run lint
|
|
|
|
- name: Test SDK packages
|
|
run: pnpm -r --filter ./sdk/typescript run test
|
|
|
|
- name: Save bazel repository cache
|
|
if: always() && !cancelled() && steps.setup_bazel.outputs.cache-hit != 'true'
|
|
continue-on-error: true
|
|
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
|
|
with:
|
|
path: ${{ steps.setup_bazel.outputs.repository-cache-path }}
|
|
key: bazel-cache-x86_64-unknown-linux-gnu-${{ hashFiles('MODULE.bazel', 'codex-rs/Cargo.lock', 'codex-rs/Cargo.toml') }}
|
|
|
|
- name: Check for a clean worktree
|
|
if: always() && !cancelled()
|
|
uses: ./.github/actions/check-clean-worktree
|