Skip to content

Commit abee62d

Browse files
committed
docs: make release CI sync upstream-driven
1 parent 92c3a17 commit abee62d

6 files changed

Lines changed: 105 additions & 52 deletions

File tree

.agents/skills/codex-upstream-reapply/SKILL.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ description: 'Reapply a fork or secondary-development branch onto the latest sta
5454
- 对于用户可见的 TUI 功能,如果 `codex-rs/tui``codex-rs/tui_app_server` 都存在对应的平行实现,则必须同步落地两边;不能只改其中一边就判定该需求已完成,除非 upstream 已明确删除其一,或你能在当前 tag 的代码里给出清晰的“不需要同步”的理由。
5555
- 如果 `CHANGED.md` 记录的是这类共享 TUI 行为,文案应写成“用户可见行为要求”,并在需要时明确适用于 `tui``tui_app_server`,避免写成只对应某一个实现细节的说明。
5656
-`codex-rs` 目录下执行 `cargo build -p codex-cli`,确认能正常构建。
57-
- 如果本次包含 npm / release / code-mode 相关改动,必须额外检查发布产物中的伴随二进制。`cargo build -p codex-cli` 只构建 CLI,不会自动构建 `codex-code-mode-host`;至少用同一 profile 构建并核对 `codex``codex-code-mode-host` 位于同一目录
57+
- 如果本次包含 npm / release / CI 相关改动,必须在 npm/release 工作完成、准备 commit/push 时读取并执行 `references/release-ci-sync.md`。该文档以 upstream old-tag/new-tag diff 为依据,只处理 build artifacts、GitHub Release、npm Release 三类变化;不要在主 skill 中硬编码某个 upstream binary
5858

5959
### 0) Confirm upstream and inspect tags first(强制第一步)
6060

@@ -148,11 +148,11 @@ bash .agents/skills/codex-upstream-reapply/scripts/start_from_tag.sh \
148148
- `coverage-checklist.md`:把旧分支里每个变更路径都列成 checklist,并标注它是“脚本自动带过去”还是“必须手动重实现”
149149
-(默认)复制所有“变更过的 Markdown 意图文档”的旧版内容到 bundle 里
150150
-(可选)用 `--copy-all` 复制所有变更文件的旧版内容(用于离线阅读)
151-
并且会固定复制 `OLD_BRANCH``AGENTS.md``README.md``CHANGED.md``.agents/skills/``NEW_BRANCH`;复制后脚本还会刷新 `AGENTS.md` 里的临时 reapply guardrails。对于 npm / release / CI 相关改动,则会按 `OLD_BRANCH` 相对基线 tag 的 git changes 自动搬运,包括删除。只要 `OLD_BRANCH` 带有 `references/npm-release.md` 对应的 skill 规则,就必须执行 npm release 文档里定义的强制动作,而不是只把它当成“默认原则”。
151+
并且会固定复制 `OLD_BRANCH``AGENTS.md``README.md``CHANGED.md``.agents/skills/``NEW_BRANCH`;复制后脚本还会刷新 `AGENTS.md` 里的临时 reapply guardrails。对于 npm / release / CI 相关改动,则会按 `OLD_BRANCH` 相对基线 tag 的 git changes 自动搬运,包括删除。只要 `OLD_BRANCH` 带有 `references/npm-release.md` 对应的 skill 规则,就必须执行 npm release 文档和 `references/release-ci-sync.md` 定义的强制动作,而不是只把它当成“默认原则”。
152152

153-
如果分支上包含 codext npm / release 相关改动,必须先看 `references/npm-release.md`。这份文档明确要求:在 `NEW_BRANCH` 上用 `OLD_BRANCH``rust-release.yml` 覆盖当前 tag 分支内容,删除其他 workflow,并直接复制 `.github/scripts/install-musl-build-tools.sh``.github/scripts/rusty_v8_bazel.py``codex-cli/package.json``codex-cli/bin/codex.js``codex-cli/bin/rg``codex-cli/scripts/build_npm_package.py``codex-cli/scripts/install_native_deps.py`;这些是必做项,不是建议。只有这些动作完成后,才允许评估上游 / 新 tag 额外新增或改动的 CI 是否要合并或忽略
153+
如果分支上包含 codext npm / release 相关改动,必须先看 `references/npm-release.md``references/release-ci-sync.md`。旧分支的 `rust-release.yml` 作为可用的 `F_OLD` 发布基线保留;不要用 upstream 新 workflow 整体覆盖它。必须直接复制 `.github/scripts/install-musl-build-tools.sh``.github/scripts/rusty_v8_bazel.py``codex-cli/package.json``codex-cli/bin/codex.js``codex-cli/bin/rg``codex-cli/scripts/build_npm_package.py``codex-cli/scripts/install_native_deps.py`;这些是必做项。随后用 `U_OLD..U_NEW` 的 upstream workflow 最终 diff,模型只把影响三类目标的变化 patch 或重实现到 `F_OLD`
154154

155-
完成 mandatory carry-over 后,必须执行 release artifact parity audit:逐个核对 upstream TAG 的 `cargo --bin`、artifact upload、release archive、vendor tree 与 npm platform package。特别是 `codex-code-mode-host` 必须随 `codex` 一起发布;只构建 CLI 或只复制 CLI 会导致运行时出现 “codex-code-mode-host 不存在”,这不是 API 认证失败。构建方式必须参考 upstream 的 workspace-level 单次 Cargo invocation,同时核对 release job 的 `CARGO_NET_GIT_FETCH_WITH_CLI`。使用 `.agents/skills/codex-upstream-reapply/scripts/check_release_artifact_parity.sh` 做静态检查
155+
完成 mandatory carry-over 后,不要立即执行 release CI 检查;等 npm/release 工作完成、准备 push 时,按照 `references/release-ci-sync.md`upstream diff 分类、模型决策、产物流向检查和 generic preflight。所有未采用但无法证明无关的 upstream 变化,都要在最终回复中说明其内容、作用和未采用原因
156156

157157
如果这套 codext npm / release 规则生效,所有用户可见文案、提示、tooltips、README/技能文档里凡是引用安装后命令名的地方,也必须同步使用 `codext`。例如恢复会话提示应写成 `codext resume <session>`,不要继续保留 `codex resume ...` 这类上游命令名。
158158

@@ -235,16 +235,17 @@ git diff TAG..NEW_BRANCH
235235
cargo build -p codex-cli
236236
```
237237

238-
### 9) Push and monitor
238+
### 9) Release CI sync, then push
239239

240-
完成 reapply 并提交后
240+
完成 reapply 和 npm/release 工作后、准备提交和 push 时
241241

242+
- 先读取并执行 `references/release-ci-sync.md`
243+
- 让模型基于 `U_OLD``F_OLD``U_NEW` 的 workflow diff,决定只应用 build artifacts、GitHub Release、npm Release 相关变化。
244+
- 如需更新 `references/release-overrides.json`,与本次 workflow/实现变化合并到同一个 commit,并在最终回复中解释。
242245
- 推送当前 reapply 分支到 `origin`
243246
- 同一提交强制推送到 `origin/main`
244247
- 后续每次更新后,也都要把同一提交同步推送到这两个分支。
245-
- 推送后约 40 分钟再检查一次 `origin/main` 的 GitHub Actions 状态。
246-
- 如果 `origin/main` GitHub Actions 存在问题,参考当前 upstream 对应代码与 CI 配置,比对后自动修复;修复提交后再次推送当前分支,并强制推送 `origin/main`
247-
- 重复上述 CI 检查 / 修复 / 推送循环,直到 `origin/main` GitHub Actions 没有需要处理的问题。
248+
- GitHub Actions 监控和失败修复与本 skill 分离;只有用户明确要求读取或修复 CI 时才执行后续 CI 诊断。
248249

249250
## How changes are computed from OLD_BRANCH
250251

.agents/skills/codex-upstream-reapply/references/npm-release.md

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## Mandatory copy from OLD_BRANCH
1212

13-
Overwrite NEW_BRANCH with OLD_BRANCH versions of these files:
13+
Use the OLD_BRANCH release workflow as the `F_OLD` packaging baseline, then apply the release CI sync procedure before pushing. Copy these codext packaging files from OLD_BRANCH:
1414

1515
1. `.github/workflows/rust-release.yml`
1616
2. `.github/scripts/install-musl-build-tools.sh`
@@ -27,31 +27,7 @@ Delete all `.github/workflows/*` that OLD_BRANCH deleted (i.e. workflows carried
2727

2828
## Verify release workflow compatibility
2929

30-
After copying rust-release.yml from OLD_BRANCH, check upstream TAG's release CI. Actively adapt to upstream's current structure — do not cling to OLD_BRANCH's layout if upstream has moved on. The goal: working release pipeline with current upstream tooling, plus our fork-specific names (package, command, dist-tag).
31-
32-
Trace every runtime binary from build to package before committing:
33-
34-
1. Compare the upstream TAG workflow's `cargo --bin` matrix with the fork workflow.
35-
2. Follow each binary through build output, uploaded artifact, standalone archive, vendor tree, and npm platform package.
36-
3. Include `codex-code-mode-host` anywhere the CLI is shipped. It must sit beside `codex`/`codext`; `cargo build -p codex-cli` does not build it.
37-
Follow upstream's workspace-level release build and pass `--bin codex --bin codex-code-mode-host` in the same Cargo invocation. Do not split them into separate `-p` commands: target-specific feature resolution must remain shared.
38-
4. Keep Windows-only helpers (`codex-windows-sandbox-setup.exe`, `codex-command-runner.exe`) and Linux resources such as `bwrap` aligned with the current release scripts.
39-
5. Preserve `CARGO_NET_GIT_FETCH_WITH_CLI: "true"` in release jobs. The workspace contains git dependencies with nested submodules, and macOS runners can fail when Cargo uses libgit2/SecureTransport.
40-
41-
Run the static parity audit after the carry-over copy:
42-
43-
```bash
44-
bash .agents/skills/codex-upstream-reapply/scripts/check_release_artifact_parity.sh
45-
```
46-
47-
For local execution, build the CLI and companion host with the same profile:
48-
49-
```bash
50-
cd codex-rs
51-
cargo build --release --bin codex --bin codex-code-mode-host
52-
```
53-
54-
Debug builds work the same way; `--release` is not what makes code mode available.
30+
Read [release-ci-sync.md](release-ci-sync.md) together with the npm release work, immediately before the final commit and push. It defines the three-way `U_OLD` / `F_OLD` / `U_NEW` comparison, the build/GitHub Release/npm Release scope, model-driven application of upstream changes, and the required final report.
5531

5632
## After mandatory steps
5733

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Release CI Sync
2+
3+
Run this procedure together with the npm/release work, after implementation is complete and immediately before the final commit and push. This is a release workflow review, not a GitHub Actions monitoring loop.
4+
5+
## Scope
6+
7+
Only carry upstream release workflow changes that affect:
8+
9+
1. Build and shipped artifacts.
10+
2. GitHub Release assets.
11+
3. npm package staging or publication.
12+
13+
Use the artifact flow to decide scope:
14+
15+
```text
16+
build -> upload/download -> archive/vendor -> GitHub Release or npm publish
17+
```
18+
19+
Include setup, signing, checksum, and verification changes when they affect that flow. Exclude unrelated upstream products and jobs, such as website deployment or an independent wheel, unless the current codext release consumes their output.
20+
21+
## Three-way inputs
22+
23+
Use the explicit old base tag. Do not infer it from branch names:
24+
25+
```text
26+
U_OLD = OLD_BASE_TAG:.github/workflows/rust-release.yml
27+
F_OLD = OLD_BRANCH:.github/workflows/rust-release.yml
28+
U_NEW = NEW_TAG:.github/workflows/rust-release.yml
29+
```
30+
31+
Read `git diff U_OLD..U_NEW` to discover upstream's final release changes. Treat `F_OLD` as the working release baseline because it contains the known-good codext packaging flow. Do not replace it with `U_NEW` wholesale.
32+
33+
## Model decision
34+
35+
The model decides which upstream changes to apply. Inventory and `git diff` are evidence, not an automatic patch authority.
36+
37+
For every upstream release change, classify it as:
38+
39+
- `APPLIED`: patch or re-implement it in the existing codext build, GitHub Release, or npm Release flow.
40+
- `OVERRIDE`: retain the codext behavior because it is an intentional long-term fork policy.
41+
- `NOT_APPLIED`: leave it out when it is outside the three release scopes.
42+
43+
When the workflow structures differ, re-implement the upstream behavior in the existing codext structure. Do not force a textual patch or replace the whole workflow.
44+
45+
Do not hardcode a particular upstream binary in this procedure. Discover binaries from the upstream release matrix and trace each one through the artifact flow. Companion binaries required by an existing codext executable are in scope; independent upstream products are not automatically added.
46+
47+
Changes that cannot be proved relevant to the three scopes are not applied. Report them in the final response with the upstream change, its purpose, and why it was not applied.
48+
49+
## Fork overrides
50+
51+
Read `release-overrides.json` before making the decision. It contains only long-lived codext policy, such as package identity, command name, and intentionally different release triggers.
52+
53+
The model may update the manifest automatically when a difference is clearly a durable fork policy. Include that update in the same commit as the release workflow changes. Explain every manifest change in the final response. Do not add one-off tag-specific observations to the manifest.
54+
55+
## Required checks
56+
57+
Before committing and pushing npm/release work:
58+
59+
1. Run `bash .agents/skills/codex-upstream-reapply/scripts/check_release_artifact_parity.sh` as a generic structural preflight.
60+
2. Compare the upstream binary matrix with the current build commands and follow every in-scope output through upload, archive/vendor, and publish steps.
61+
3. Use the upstream workspace-level Cargo invocation for the selected binary set; do not split companion binaries into separate package builds.
62+
4. Run the skill's local build acceptance. Do not run tests, snapshots, formatters, or linters under the reapply guardrails.
63+
5. Include `APPLIED`, `OVERRIDE`, and `NOT_APPLIED` decisions in the final report.
64+
65+
GitHub Actions is a separate follow-up workflow. Do not wait for or repeatedly repair Actions unless the user explicitly asks to read or fix CI.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"workflow": ".github/workflows/rust-release.yml",
3+
"scope": [
4+
"build-artifacts",
5+
"github-release",
6+
"npm-release"
7+
],
8+
"identity": {
9+
"npm_package": "@loongphy/codext",
10+
"platform_package_prefix": "@loongphy/codext-",
11+
"cli_command": "codext"
12+
},
13+
"trigger": {
14+
"mode": "main_push",
15+
"reason": "codext publishes continuous fork builds instead of upstream tag releases"
16+
},
17+
"allowed_deviations": []
18+
}

.agents/skills/codex-upstream-reapply/scripts/check_release_artifact_parity.sh

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ if [[ ! -f "${workflow}" || ! -f "${repo_root}/codex-cli/package.json" ]]; then
99
fi
1010

1111
required_patterns=(
12-
"--bin codex-code-mode-host"
13-
"codex-code-mode-host"
14-
"codex-bin-"
15-
"CARGO_NET_GIT_FETCH_WITH_CLI"
12+
"cargo build"
13+
"actions/upload-artifact"
14+
"npm publish"
1615
)
1716
for pattern in "${required_patterns[@]}"; do
1817
if ! rg -F --quiet -- "${pattern}" "${workflow}"; then
19-
echo "[ERROR] Release workflow is missing required native component: ${pattern}" >&2
18+
echo "[ERROR] Release workflow is missing required release surface: ${pattern}" >&2
2019
exit 1
2120
fi
2221
done
@@ -27,15 +26,10 @@ for path in \
2726
"${repo_root}/scripts/install/install.sh" \
2827
"${repo_root}/scripts/install/install.ps1" \
2928
"${repo_root}/scripts/codex_package/cargo.py"; do
30-
if ! rg -F --quiet -- "codex-code-mode-host" "${path}"; then
31-
echo "[ERROR] Release packaging path is missing codex-code-mode-host: ${path}" >&2
29+
if [[ ! -f "${path}" ]]; then
30+
echo "[ERROR] Release packaging path is missing: ${path}" >&2
3231
exit 1
3332
fi
3433
done
3534

36-
if rg -F --quiet -- "-p codex-code-mode-host" "${workflow}"; then
37-
echo "[ERROR] Release workflow must build codex-code-mode-host in the same Cargo invocation as the CLI" >&2
38-
exit 1
39-
fi
40-
41-
echo "[OK] Release artifact parity includes codex-code-mode-host"
35+
echo "[OK] Release CI structural preflight passed; complete semantic review from release-ci-sync.md"

.agents/skills/codex-upstream-reapply/scripts/start_from_tag.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,9 @@ if ! git diff --cached --quiet; then
585585
fi
586586
fi
587587

588-
release_audit_script="${script_dir}/check_release_artifact_parity.sh"
589-
if has_npm_release_reapply "${OLD_BRANCH}" && [[ -x "${release_audit_script}" ]]; then
590-
echo "[INFO] Auditing release artifact parity..."
591-
"${release_audit_script}"
588+
if has_npm_release_reapply "${OLD_BRANCH}"; then
589+
echo "[INFO] Release CI sync is deferred until npm/release work is complete."
590+
echo "[INFO] Before the final commit/push, read references/release-ci-sync.md."
592591
fi
593592

594593
echo "[OK] New branch created: ${NEW_BRANCH}"

0 commit comments

Comments
 (0)