Skip to content

Commit bdc1fa1

Browse files
committed
code + logic
1 parent 0b1083f commit bdc1fa1

29 files changed

+2323
-334
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,44 @@ on:
88

99
env:
1010
DOTNET_VERSION: '10.0.x'
11+
NODE_VERSION: '22'
1112

1213
jobs:
1314
build-test:
14-
name: Build and Test
15-
runs-on: ubuntu-latest
15+
name: Build and Codex CLI Smoke (${{ matrix.os }})
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, macos-latest, windows-latest]
20+
runs-on: ${{ matrix.os }}
1621

1722
steps:
1823
- name: Checkout
1924
uses: actions/checkout@v5
2025
with:
2126
submodules: recursive
2227

28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: ${{ env.NODE_VERSION }}
32+
2333
- name: Setup .NET
2434
uses: actions/setup-dotnet@v4
2535
with:
2636
dotnet-version: ${{ env.DOTNET_VERSION }}
2737

38+
- name: Install Codex CLI
39+
run: npm install --no-save @openai/codex
40+
2841
- name: Restore
2942
run: dotnet restore ManagedCode.CodexSharpSDK.slnx
3043

3144
- name: Build
3245
run: dotnet build ManagedCode.CodexSharpSDK.slnx -c Release -warnaserror --no-restore
3346

34-
- name: Test
35-
run: dotnet test --solution ManagedCode.CodexSharpSDK.slnx -c Release --no-build
47+
- name: Smoke tests (Codex CLI discover + invoke)
48+
run: dotnet test --solution ManagedCode.CodexSharpSDK.slnx -c Release --no-build -- --treenode-filter "/*/*/*/CodexCli_Smoke_*"
3649

3750
aot-smoke:
3851
name: NativeAOT Smoke

.github/workflows/typescript-sdk-watch.yml renamed to .github/workflows/codex-cli-watch.yml

Lines changed: 91 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: TypeScript SDK Watch
1+
name: Codex CLI Upstream Watch
22

33
on:
44
schedule:
@@ -10,12 +10,12 @@ permissions:
1010
issues: write
1111

1212
concurrency:
13-
group: typescript-sdk-watch
13+
group: codex-cli-upstream-watch
1414
cancel-in-progress: false
1515

1616
jobs:
1717
detect-and-open-issue:
18-
name: Detect TypeScript SDK Updates
18+
name: Detect Codex CLI Upstream Updates
1919
runs-on: ubuntu-latest
2020

2121
steps:
@@ -25,14 +25,22 @@ jobs:
2525
submodules: recursive
2626
fetch-depth: 0
2727

28-
- name: Detect updates in openai/codex sdk/typescript
28+
- name: Detect updates in openai/codex
2929
id: detect
3030
shell: bash
3131
run: |
3232
set -euo pipefail
3333
3434
SUBMODULE_PATH="submodules/openai-codex"
35-
TARGET_PATH="sdk/typescript"
35+
SURFACE_PATHS=(
36+
"codex-rs"
37+
"docs"
38+
"README.md"
39+
"CHANGELOG.md"
40+
"Cargo.toml"
41+
"Cargo.lock"
42+
"package.json"
43+
)
3644
3745
if [ ! -d "$SUBMODULE_PATH/.git" ] && [ ! -f "$SUBMODULE_PATH/.git" ]; then
3846
echo "Submodule not initialized: $SUBMODULE_PATH"
@@ -42,7 +50,6 @@ jobs:
4250
4351
current_sha="$(git -C "$SUBMODULE_PATH" rev-parse HEAD)"
4452
default_branch="$(git -C "$SUBMODULE_PATH" remote show origin | sed -n '/HEAD branch/s/.*: //p')"
45-
4653
if [ -z "$default_branch" ]; then
4754
default_branch="main"
4855
fi
@@ -60,57 +67,95 @@ jobs:
6067
exit 0
6168
fi
6269
63-
changed_files="$(git -C "$SUBMODULE_PATH" diff --name-only "$current_sha" "$latest_sha" -- "$TARGET_PATH")"
64-
70+
changed_files="$(git -C "$SUBMODULE_PATH" diff --name-only "$current_sha" "$latest_sha")"
6571
if [ -z "$changed_files" ]; then
66-
echo "Upstream changed, but not in $TARGET_PATH."
6772
echo "has_update=false" >> "$GITHUB_OUTPUT"
6873
exit 0
6974
fi
7075
7176
echo "has_update=true" >> "$GITHUB_OUTPUT"
7277
73-
{
74-
echo "changed_files<<EOF"
75-
echo "$changed_files"
76-
echo "EOF"
77-
} >> "$GITHUB_OUTPUT"
78-
79-
commits="$(git -C "$SUBMODULE_PATH" log --no-merges --date=short --pretty=format:'- %h %s (%ad)' "$current_sha..$latest_sha" -- "$TARGET_PATH" | head -n 80)"
78+
cli_changed_files="$(printf '%s\n' "$changed_files" | grep -E '^(codex-rs/|docs/|README\.md|CHANGELOG\.md|Cargo\.toml|Cargo\.lock|package\.json)' || true)"
79+
if [ -z "$cli_changed_files" ]; then
80+
cli_changed_files="$(printf '%s\n' "$changed_files" | head -n 200)"
81+
fi
8082
83+
commits="$(git -C "$SUBMODULE_PATH" log --no-merges --date=short --pretty=format:'- %h %s (%ad)' "$current_sha..$latest_sha" | head -n 100)"
8184
if [ -z "$commits" ]; then
82-
commits="- No commit messages found for $TARGET_PATH (file-level diff exists)."
85+
commits='- No commit summary available.'
86+
fi
87+
88+
surface_diff="$(git -C "$SUBMODULE_PATH" diff --unified=0 "$current_sha" "$latest_sha" -- "${SURFACE_PATHS[@]}" || true)"
89+
90+
changed_flags="$(printf '%s\n' "$surface_diff" | grep -Eo -- '--[a-z0-9][a-z0-9-]*' | sort -u | head -n 200 || true)"
91+
changed_models="$(printf '%s\n' "$surface_diff" | grep -Eo -- 'gpt-[0-9][a-z0-9.-]*' | sort -u | head -n 200 || true)"
92+
changed_features="$(printf '%s\n' "$surface_diff" | grep -Eo -- 'features\.[a-zA-Z0-9_.-]+' | sed 's/^features\.//' | sort -u | head -n 200 || true)"
93+
94+
if [ -z "$changed_flags" ]; then
95+
changed_flags='- (no CLI flag tokens detected from diff)'
96+
else
97+
changed_flags="$(printf '%s\n' "$changed_flags" | sed 's/^/- `/' | sed 's/$/`/')"
98+
fi
99+
100+
if [ -z "$changed_models" ]; then
101+
changed_models='- (no model tokens detected from diff)'
102+
else
103+
changed_models="$(printf '%s\n' "$changed_models" | sed 's/^/- `/' | sed 's/$/`/')"
104+
fi
105+
106+
if [ -z "$changed_features" ]; then
107+
changed_features='- (no feature tokens detected from diff)'
108+
else
109+
changed_features="$(printf '%s\n' "$changed_features" | sed 's/^/- `/' | sed 's/$/`/')"
83110
fi
84111
85112
{
113+
echo "cli_changed_files<<EOF"
114+
echo "$cli_changed_files"
115+
echo "EOF"
86116
echo "commits<<EOF"
87117
echo "$commits"
88118
echo "EOF"
119+
echo "changed_flags<<EOF"
120+
echo "$changed_flags"
121+
echo "EOF"
122+
echo "changed_models<<EOF"
123+
echo "$changed_models"
124+
echo "EOF"
125+
echo "changed_features<<EOF"
126+
echo "$changed_features"
127+
echo "EOF"
89128
} >> "$GITHUB_OUTPUT"
90129
91-
- name: Create issue for TypeScript SDK update
130+
- name: Create issue for Codex CLI update
92131
if: steps.detect.outputs.has_update == 'true'
93132
uses: actions/github-script@v7
94133
env:
95134
CURRENT_SHA: ${{ steps.detect.outputs.current_sha }}
96135
LATEST_SHA: ${{ steps.detect.outputs.latest_sha }}
97136
DEFAULT_BRANCH: ${{ steps.detect.outputs.default_branch }}
98-
CHANGED_FILES: ${{ steps.detect.outputs.changed_files }}
137+
CLI_CHANGED_FILES: ${{ steps.detect.outputs.cli_changed_files }}
99138
COMMITS: ${{ steps.detect.outputs.commits }}
100-
ASSIGNEE: ${{ vars.SDK_SYNC_ASSIGNEE != '' && vars.SDK_SYNC_ASSIGNEE || 'codex' }}
139+
CHANGED_FLAGS: ${{ steps.detect.outputs.changed_flags }}
140+
CHANGED_MODELS: ${{ steps.detect.outputs.changed_models }}
141+
CHANGED_FEATURES: ${{ steps.detect.outputs.changed_features }}
142+
ASSIGNEE: ${{ vars.SDK_SYNC_ASSIGNEE != '' && vars.SDK_SYNC_ASSIGNEE || 'copilot' }}
101143
with:
102144
script: |
103145
const currentSha = process.env.CURRENT_SHA;
104146
const latestSha = process.env.LATEST_SHA;
105147
const defaultBranch = process.env.DEFAULT_BRANCH;
106-
const changedFilesRaw = process.env.CHANGED_FILES || '';
148+
const changedFilesRaw = process.env.CLI_CHANGED_FILES || '';
107149
const commitsRaw = process.env.COMMITS || '';
108-
const assignee = process.env.ASSIGNEE || 'codex';
150+
const changedFlags = process.env.CHANGED_FLAGS || '- (not provided)';
151+
const changedModels = process.env.CHANGED_MODELS || '- (not provided)';
152+
const changedFeatures = process.env.CHANGED_FEATURES || '- (not provided)';
153+
const assignee = process.env.ASSIGNEE || 'copilot';
109154
110155
const shortCurrent = currentSha.slice(0, 7);
111156
const shortLatest = latestSha.slice(0, 7);
112-
const marker = `<!-- codexsharp-typescript-sdk-update:${latestSha} -->`;
113-
const labelName = 'typescript-sdk-sync';
157+
const marker = `<!-- codexsharp-codex-cli-update:${latestSha} -->`;
158+
const labelName = 'codex-cli-sync';
114159
115160
const changedFiles = changedFilesRaw
116161
.split('\n')
@@ -121,21 +166,21 @@ jobs:
121166
.join('\n');
122167
123168
const commits = commitsRaw.trim() || '- No commit summary available.';
169+
const compareUrl = `https://github.com/openai/codex/compare/${currentSha}...${latestSha}`;
170+
const latestCommitUrl = `https://github.com/openai/codex/commit/${latestSha}`;
124171
125-
// Ensure label exists (ignore if it already exists or cannot be created).
126172
try {
127173
await github.rest.issues.createLabel({
128174
owner: context.repo.owner,
129175
repo: context.repo.repo,
130176
name: labelName,
131177
color: '0e8a16',
132-
description: 'Tracks upstream TypeScript SDK updates from openai/codex',
178+
description: 'Tracks upstream Codex CLI changes from openai/codex',
133179
});
134180
} catch (error) {
135181
core.info(`Label create skipped: ${error.message}`);
136182
}
137183
138-
// Avoid duplicate issue for the same upstream SHA.
139184
const openIssues = await github.paginate(github.rest.issues.listForRepo, {
140185
owner: context.repo.owner,
141186
repo: context.repo.repo,
@@ -153,35 +198,41 @@ jobs:
153198
return;
154199
}
155200
156-
const title = `Sync TypeScript SDK from openai/codex (${shortCurrent} -> ${shortLatest})`;
157-
const compareUrl = `https://github.com/openai/codex/compare/${currentSha}...${latestSha}`;
158-
const submoduleCommitUrl = `https://github.com/openai/codex/commit/${latestSha}`;
159-
201+
const title = `Sync Codex CLI upstream changes (${shortCurrent} -> ${shortLatest})`;
160202
const body = [
161203
marker,
162204
'',
163-
'Detected upstream updates in `openai/codex/sdk/typescript`.',
205+
'Detected upstream updates in `openai/codex` affecting CLI surface tracking.',
164206
'',
165207
`- Submodule path: \`submodules/openai-codex\``,
166208
`- Watched branch: \`${defaultBranch}\``,
167209
`- Current pinned commit: \`${currentSha}\``,
168210
`- Latest upstream commit: \`${latestSha}\``,
169211
`- Compare: ${compareUrl}`,
170-
`- Latest commit: ${submoduleCommitUrl}`,
212+
`- Latest commit: ${latestCommitUrl}`,
171213
'',
172-
'## Changed files (`sdk/typescript`)',
214+
'## Changed files (CLI-relevant)',
173215
changedFiles || '- (No file list available)',
174216
'',
175-
'## Commits touching `sdk/typescript`',
217+
'## Potential CLI flag changes from diff',
218+
changedFlags,
219+
'',
220+
'## Potential model changes from diff',
221+
changedModels,
222+
'',
223+
'## Potential feature changes from diff',
224+
changedFeatures,
225+
'',
226+
'## Commits',
176227
commits,
177228
'',
178229
'## Action required',
179-
'- [ ] Review upstream TypeScript SDK changes',
180-
'- [ ] Update the C# SDK in this repository to keep parity',
181-
'- [ ] Add/adjust tests for new behavior',
182-
'- [ ] Update docs/changelog if public API changed',
230+
'- [ ] Validate latest `codex --help` and `codex exec --help` output',
231+
'- [ ] Sync C# SDK constants/options/models with upstream CLI changes',
232+
'- [ ] Add or update tests for new flags/models/features',
233+
'- [ ] Update docs (README + docs/Features + docs/Architecture if needed)',
183234
'',
184-
`_Opened automatically by scheduled workflow \'TypeScript SDK Watch\'._',
235+
`_Opened automatically by scheduled workflow 'Codex CLI Upstream Watch'._`,
185236
].join('\n');
186237
187238
let issue;

.github/workflows/real-integration.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Real Integration
1+
name: Codex CLI Smoke
22

33
on:
44
schedule:
@@ -13,8 +13,8 @@ env:
1313
NODE_VERSION: '22'
1414

1515
jobs:
16-
codex-real-integration:
17-
name: Real Codex Integration (${{ matrix.os }})
16+
codex-cli-smoke:
17+
name: Codex CLI Smoke (${{ matrix.os }})
1818
strategy:
1919
fail-fast: false
2020
matrix:
@@ -43,7 +43,8 @@ jobs:
4343
- name: Restore
4444
run: dotnet restore ManagedCode.CodexSharpSDK.slnx
4545

46-
- name: Run real integration tests
47-
run: dotnet test --project CodexSharpSDK.Tests/CodexSharpSDK.Tests.csproj -c Release -- --treenode-filter "/*/*/*/RunAsync_WithRealCodexCli_*"
48-
env:
49-
CODEX_TEST_MODEL: gpt-5.3-codex
46+
- name: Build
47+
run: dotnet build ManagedCode.CodexSharpSDK.slnx -c Release -warnaserror --no-restore
48+
49+
- name: Smoke tests (Codex CLI discover + invoke)
50+
run: dotnet test --solution ManagedCode.CodexSharpSDK.slnx -c Release --no-build -- --treenode-filter "/*/*/*/CodexCli_Smoke_*"

0 commit comments

Comments
 (0)