Skip to content

Commit 65843e7

Browse files
Merge pull request #122 from ScriptedAlchemy/merge-upstream-main-2025-12-13
Sync fork with upstream main
2 parents b680b2f + 90325f4 commit 65843e7

234 files changed

Lines changed: 22985 additions & 5346 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.codespellrc‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[codespell]
22
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
3-
skip = .git*,vendor,*-lock.yaml,*.lock,.codespellrc,*test.ts,*.jsonl,frame*.txt,**/node_modules/**,**/dist/**,**/target/**,sdk/native/dist-examples_ignored/**,sdk/native/dist-examples/**,sdk/native/package-lock.json,**/.venv/**,**/.codex-ci/**,**/.fastembed_cache/**
3+
skip = .git*,vendor,*-lock.yaml,*.lock,.codespellrc,.codespellignore,*test.ts,*.jsonl,frame*.txt,**/node_modules/**,**/dist/**,**/target/**,sdk/native/dist-examples_ignored/**,sdk/native/dist-examples/**,sdk/native/package-lock.json,**/.cache/**,**/.venv/**,**/.codex-ci/**,**/.fastembed_cache/**
44
check-hidden = true
55
ignore-regex = ^\s*"image/\S+": ".*|\b(afterAll)\b
6-
ignore-words-list = ratatui,ser,iTerm,trys,vEw,ANE
6+
ignore-words-list = ratatui,ser,iTerm,trys,vEw,ANE,psuedo
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
name: macos-code-sign
2+
description: Configure, sign, notarize, and clean up macOS code signing artifacts.
3+
inputs:
4+
target:
5+
description: Rust compilation target triple (e.g. aarch64-apple-darwin).
6+
required: true
7+
apple-certificate:
8+
description: Base64-encoded Apple signing certificate (P12).
9+
required: true
10+
apple-certificate-password:
11+
description: Password for the signing certificate.
12+
required: true
13+
apple-notarization-key-p8:
14+
description: Base64-encoded Apple notarization key (P8).
15+
required: true
16+
apple-notarization-key-id:
17+
description: Apple notarization key ID.
18+
required: true
19+
apple-notarization-issuer-id:
20+
description: Apple notarization issuer ID.
21+
required: true
22+
runs:
23+
using: composite
24+
steps:
25+
- name: Configure Apple code signing
26+
shell: bash
27+
env:
28+
KEYCHAIN_PASSWORD: actions
29+
APPLE_CERTIFICATE: ${{ inputs.apple-certificate }}
30+
APPLE_CERTIFICATE_PASSWORD: ${{ inputs.apple-certificate-password }}
31+
run: |
32+
set -euo pipefail
33+
34+
if [[ -z "${APPLE_CERTIFICATE:-}" ]]; then
35+
echo "APPLE_CERTIFICATE is required for macOS signing"
36+
exit 1
37+
fi
38+
39+
if [[ -z "${APPLE_CERTIFICATE_PASSWORD:-}" ]]; then
40+
echo "APPLE_CERTIFICATE_PASSWORD is required for macOS signing"
41+
exit 1
42+
fi
43+
44+
cert_path="${RUNNER_TEMP}/apple_signing_certificate.p12"
45+
echo "$APPLE_CERTIFICATE" | base64 -d > "$cert_path"
46+
47+
keychain_path="${RUNNER_TEMP}/codex-signing.keychain-db"
48+
security create-keychain -p "$KEYCHAIN_PASSWORD" "$keychain_path"
49+
security set-keychain-settings -lut 21600 "$keychain_path"
50+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$keychain_path"
51+
52+
keychain_args=()
53+
cleanup_keychain() {
54+
if ((${#keychain_args[@]} > 0)); then
55+
security list-keychains -s "${keychain_args[@]}" || true
56+
security default-keychain -s "${keychain_args[0]}" || true
57+
else
58+
security list-keychains -s || true
59+
fi
60+
if [[ -f "$keychain_path" ]]; then
61+
security delete-keychain "$keychain_path" || true
62+
fi
63+
}
64+
65+
while IFS= read -r keychain; do
66+
[[ -n "$keychain" ]] && keychain_args+=("$keychain")
67+
done < <(security list-keychains | sed 's/^[[:space:]]*//;s/[[:space:]]*$//;s/"//g')
68+
69+
if ((${#keychain_args[@]} > 0)); then
70+
security list-keychains -s "$keychain_path" "${keychain_args[@]}"
71+
else
72+
security list-keychains -s "$keychain_path"
73+
fi
74+
75+
security default-keychain -s "$keychain_path"
76+
security import "$cert_path" -k "$keychain_path" -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign -T /usr/bin/security
77+
security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" "$keychain_path" > /dev/null
78+
79+
codesign_hashes=()
80+
while IFS= read -r hash; do
81+
[[ -n "$hash" ]] && codesign_hashes+=("$hash")
82+
done < <(security find-identity -v -p codesigning "$keychain_path" \
83+
| sed -n 's/.*\([0-9A-F]\{40\}\).*/\1/p' \
84+
| sort -u)
85+
86+
if ((${#codesign_hashes[@]} == 0)); then
87+
echo "No signing identities found in $keychain_path"
88+
cleanup_keychain
89+
rm -f "$cert_path"
90+
exit 1
91+
fi
92+
93+
if ((${#codesign_hashes[@]} > 1)); then
94+
echo "Multiple signing identities found in $keychain_path:"
95+
printf ' %s\n' "${codesign_hashes[@]}"
96+
cleanup_keychain
97+
rm -f "$cert_path"
98+
exit 1
99+
fi
100+
101+
APPLE_CODESIGN_IDENTITY="${codesign_hashes[0]}"
102+
103+
rm -f "$cert_path"
104+
105+
echo "APPLE_CODESIGN_IDENTITY=$APPLE_CODESIGN_IDENTITY" >> "$GITHUB_ENV"
106+
echo "APPLE_CODESIGN_KEYCHAIN=$keychain_path" >> "$GITHUB_ENV"
107+
echo "::add-mask::$APPLE_CODESIGN_IDENTITY"
108+
109+
- name: Sign macOS binaries
110+
shell: bash
111+
run: |
112+
set -euo pipefail
113+
114+
if [[ -z "${APPLE_CODESIGN_IDENTITY:-}" ]]; then
115+
echo "APPLE_CODESIGN_IDENTITY is required for macOS signing"
116+
exit 1
117+
fi
118+
119+
keychain_args=()
120+
if [[ -n "${APPLE_CODESIGN_KEYCHAIN:-}" && -f "${APPLE_CODESIGN_KEYCHAIN}" ]]; then
121+
keychain_args+=(--keychain "${APPLE_CODESIGN_KEYCHAIN}")
122+
fi
123+
124+
for binary in codex codex-responses-api-proxy; do
125+
path="codex-rs/target/${{ inputs.target }}/release/${binary}"
126+
codesign --force --options runtime --timestamp --sign "$APPLE_CODESIGN_IDENTITY" "${keychain_args[@]}" "$path"
127+
done
128+
129+
- name: Notarize macOS binaries
130+
shell: bash
131+
env:
132+
APPLE_NOTARIZATION_KEY_P8: ${{ inputs.apple-notarization-key-p8 }}
133+
APPLE_NOTARIZATION_KEY_ID: ${{ inputs.apple-notarization-key-id }}
134+
APPLE_NOTARIZATION_ISSUER_ID: ${{ inputs.apple-notarization-issuer-id }}
135+
run: |
136+
set -euo pipefail
137+
138+
for var in APPLE_NOTARIZATION_KEY_P8 APPLE_NOTARIZATION_KEY_ID APPLE_NOTARIZATION_ISSUER_ID; do
139+
if [[ -z "${!var:-}" ]]; then
140+
echo "$var is required for notarization"
141+
exit 1
142+
fi
143+
done
144+
145+
notary_key_path="${RUNNER_TEMP}/notarytool.key.p8"
146+
echo "$APPLE_NOTARIZATION_KEY_P8" | base64 -d > "$notary_key_path"
147+
cleanup_notary() {
148+
rm -f "$notary_key_path"
149+
}
150+
trap cleanup_notary EXIT
151+
152+
notarize_binary() {
153+
local binary="$1"
154+
local source_path="codex-rs/target/${{ inputs.target }}/release/${binary}"
155+
local archive_path="${RUNNER_TEMP}/${binary}.zip"
156+
157+
if [[ ! -f "$source_path" ]]; then
158+
echo "Binary $source_path not found"
159+
exit 1
160+
fi
161+
162+
rm -f "$archive_path"
163+
ditto -c -k --keepParent "$source_path" "$archive_path"
164+
165+
submission_json=$(xcrun notarytool submit "$archive_path" \
166+
--key "$notary_key_path" \
167+
--key-id "$APPLE_NOTARIZATION_KEY_ID" \
168+
--issuer "$APPLE_NOTARIZATION_ISSUER_ID" \
169+
--output-format json \
170+
--wait)
171+
172+
status=$(printf '%s\n' "$submission_json" | jq -r '.status // "Unknown"')
173+
submission_id=$(printf '%s\n' "$submission_json" | jq -r '.id // ""')
174+
175+
if [[ -z "$submission_id" ]]; then
176+
echo "Failed to retrieve submission ID for $binary"
177+
exit 1
178+
fi
179+
180+
echo "::notice title=Notarization::$binary submission ${submission_id} completed with status ${status}"
181+
182+
if [[ "$status" != "Accepted" ]]; then
183+
echo "Notarization failed for ${binary} (submission ${submission_id}, status ${status})"
184+
exit 1
185+
fi
186+
}
187+
188+
notarize_binary "codex"
189+
notarize_binary "codex-responses-api-proxy"
190+
191+
- name: Remove signing keychain
192+
if: ${{ always() }}
193+
shell: bash
194+
env:
195+
APPLE_CODESIGN_KEYCHAIN: ${{ env.APPLE_CODESIGN_KEYCHAIN }}
196+
run: |
197+
set -euo pipefail
198+
if [[ -n "${APPLE_CODESIGN_KEYCHAIN:-}" ]]; then
199+
keychain_args=()
200+
while IFS= read -r keychain; do
201+
[[ "$keychain" == "$APPLE_CODESIGN_KEYCHAIN" ]] && continue
202+
[[ -n "$keychain" ]] && keychain_args+=("$keychain")
203+
done < <(security list-keychains | sed 's/^[[:space:]]*//;s/[[:space:]]*$//;s/"//g')
204+
if ((${#keychain_args[@]} > 0)); then
205+
security list-keychains -s "${keychain_args[@]}"
206+
security default-keychain -s "${keychain_args[0]}"
207+
fi
208+
209+
if [[ -f "$APPLE_CODESIGN_KEYCHAIN" ]]; then
210+
security delete-keychain "$APPLE_CODESIGN_KEYCHAIN"
211+
fi
212+
fi

‎.github/actions/windows-code-sign/action.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@ runs:
5353
files: |
5454
${{ github.workspace }}/codex-rs/target/${{ inputs.target }}/release/codex.exe
5555
${{ github.workspace }}/codex-rs/target/${{ inputs.target }}/release/codex-responses-api-proxy.exe
56+
${{ github.workspace }}/codex-rs/target/${{ inputs.target }}/release/codex-windows-sandbox-setup.exe
57+
${{ github.workspace }}/codex-rs/target/${{ inputs.target }}/release/codex-command-runner.exe

‎.github/dotslash-config.json‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,30 @@
5555
"path": "codex-responses-api-proxy.exe"
5656
}
5757
}
58+
},
59+
"codex-command-runner": {
60+
"platforms": {
61+
"windows-x86_64": {
62+
"regex": "^codex-command-runner-x86_64-pc-windows-msvc\\.exe\\.zst$",
63+
"path": "codex-command-runner.exe"
64+
},
65+
"windows-aarch64": {
66+
"regex": "^codex-command-runner-aarch64-pc-windows-msvc\\.exe\\.zst$",
67+
"path": "codex-command-runner.exe"
68+
}
69+
}
70+
},
71+
"codex-windows-sandbox-setup": {
72+
"platforms": {
73+
"windows-x86_64": {
74+
"regex": "^codex-windows-sandbox-setup-x86_64-pc-windows-msvc\\.exe\\.zst$",
75+
"path": "codex-windows-sandbox-setup.exe"
76+
},
77+
"windows-aarch64": {
78+
"regex": "^codex-windows-sandbox-setup-aarch64-pc-windows-msvc\\.exe\\.zst$",
79+
"path": "codex-windows-sandbox-setup.exe"
80+
}
81+
}
5882
}
5983
}
6084
}

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
5353
- name: Upload staged npm package artifact
5454
if: github.repository == 'openai/codex-native'
55-
uses: actions/upload-artifact@v5
55+
uses: actions/upload-artifact@v6
5656
with:
5757
name: codex-npm-staging
5858
path: ${{ steps.stage_npm_package.outputs.pack_output }}

‎.github/workflows/rust-ci.yml‎

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ jobs:
176176
# avoid caching the large target dir on the gnu-dev job.
177177
- name: Restore cargo home cache
178178
id: cache_cargo_home_restore
179-
uses: actions/cache/restore@v4
179+
uses: actions/cache/restore@v5
180180
with:
181181
path: |
182182
~/.cargo/bin/
@@ -217,7 +217,7 @@ jobs:
217217
- name: Restore sccache cache (fallback)
218218
if: ${{ env.USE_SCCACHE == 'true' && env.SCCACHE_GHA_ENABLED != 'true' }}
219219
id: cache_sccache_restore
220-
uses: actions/cache/restore@v4
220+
uses: actions/cache/restore@v5
221221
with:
222222
path: ${{ github.workspace }}/.sccache/
223223
key: sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ steps.lockhash.outputs.hash }}-${{ github.run_id }}
@@ -236,7 +236,7 @@ jobs:
236236
- if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}}
237237
name: Restore APT cache (musl)
238238
id: cache_apt_restore
239-
uses: actions/cache/restore@v4
239+
uses: actions/cache/restore@v5
240240
with:
241241
path: |
242242
/var/cache/apt
@@ -290,7 +290,7 @@ jobs:
290290
- name: Save cargo home cache
291291
if: always() && !cancelled() && steps.cache_cargo_home_restore.outputs.cache-hit != 'true'
292292
continue-on-error: true
293-
uses: actions/cache/save@v4
293+
uses: actions/cache/save@v5
294294
with:
295295
path: |
296296
~/.cargo/bin/
@@ -302,7 +302,7 @@ jobs:
302302
- name: Save sccache cache (fallback)
303303
if: always() && !cancelled() && env.USE_SCCACHE == 'true' && env.SCCACHE_GHA_ENABLED != 'true'
304304
continue-on-error: true
305-
uses: actions/cache/save@v4
305+
uses: actions/cache/save@v5
306306
with:
307307
path: ${{ github.workspace }}/.sccache/
308308
key: sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ steps.lockhash.outputs.hash }}-${{ github.run_id }}
@@ -327,7 +327,7 @@ jobs:
327327
- name: Save APT cache (musl)
328328
if: always() && !cancelled() && (matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl') && steps.cache_apt_restore.outputs.cache-hit != 'true'
329329
continue-on-error: true
330-
uses: actions/cache/save@v4
330+
uses: actions/cache/save@v5
331331
with:
332332
path: |
333333
/var/cache/apt
@@ -395,28 +395,6 @@ jobs:
395395
/opt/ghc
396396
sudo apt-get remove -y docker.io docker-compose podman buildah
397397
398-
# Ensure brew includes this fix so that brew's shellenv.sh loads
399-
# cleanly in the Codex sandbox (it is frequently eval'd via .zprofile
400-
# for Brew users, including the macOS runners on GitHub):
401-
#
402-
# https://github.com/Homebrew/brew/pull/21157
403-
#
404-
# Once brew 5.0.5 is released and is the default on macOS runners, this
405-
# step can be removed.
406-
- name: Upgrade brew
407-
if: ${{ startsWith(matrix.runner, 'macos') }}
408-
shell: bash
409-
run: |
410-
set -euo pipefail
411-
brew --version
412-
git -C "$(brew --repo)" fetch origin
413-
git -C "$(brew --repo)" checkout main
414-
git -C "$(brew --repo)" reset --hard origin/main
415-
export HOMEBREW_UPDATE_TO_TAG=0
416-
brew update
417-
brew upgrade
418-
brew --version
419-
420398
# Some integration tests rely on DotSlash being installed.
421399
# See https://github.com/openai/codex/pull/7617.
422400
- name: Install DotSlash
@@ -447,7 +425,7 @@ jobs:
447425
448426
- name: Restore cargo home cache
449427
id: cache_cargo_home_restore
450-
uses: actions/cache/restore@v4
428+
uses: actions/cache/restore@v5
451429
with:
452430
path: |
453431
~/.cargo/bin/
@@ -487,7 +465,7 @@ jobs:
487465
- name: Restore sccache cache (fallback)
488466
if: ${{ env.USE_SCCACHE == 'true' && env.SCCACHE_GHA_ENABLED != 'true' }}
489467
id: cache_sccache_restore
490-
uses: actions/cache/restore@v4
468+
uses: actions/cache/restore@v5
491469
with:
492470
path: ${{ github.workspace }}/.sccache/
493471
key: sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ steps.lockhash.outputs.hash }}-${{ github.run_id }}
@@ -510,7 +488,7 @@ jobs:
510488
- name: Save cargo home cache
511489
if: always() && !cancelled() && steps.cache_cargo_home_restore.outputs.cache-hit != 'true'
512490
continue-on-error: true
513-
uses: actions/cache/save@v4
491+
uses: actions/cache/save@v5
514492
with:
515493
path: |
516494
~/.cargo/bin/
@@ -522,7 +500,7 @@ jobs:
522500
- name: Save sccache cache (fallback)
523501
if: always() && !cancelled() && env.USE_SCCACHE == 'true' && env.SCCACHE_GHA_ENABLED != 'true'
524502
continue-on-error: true
525-
uses: actions/cache/save@v4
503+
uses: actions/cache/save@v5
526504
with:
527505
path: ${{ github.workspace }}/.sccache/
528506
key: sccache-${{ matrix.runner }}-${{ matrix.target }}-${{ matrix.profile }}-${{ steps.lockhash.outputs.hash }}-${{ github.run_id }}

0 commit comments

Comments
 (0)