用途:更新 VS Code 内置的 @openai/codex 依赖及其协议客户端。公共 npm 的 latest 版本在 VS Code CI 中不一定可安装,Azure 流水线使用私有 vscode feed,新第三方包通常被 CFS 隔离七天,因此需先从该 feed 选定 CI 可用的版本。
选取版本:在仓库根目录运行 node --experimental-strip-types .agents/skills/update-codex-sdk/scripts/latest-private-version.ts,脚本从已登录的 Azure CLI 获取令牌,查询依赖检查使用的同一 feed,报告最新的稳定完整版本;可用 --version 0.149.1 显式检查,用 --raw 仅输出版本字符串。Azure CLI 认证缺失时应请用户登录,不得回退到公共 registry。
更新各锁定点:将 CODEX_VERSION 设为选定版本,用 npm install --save-dev --save-exact --ignore-scripts --registry=https://registry.npmjs.org "@openai/codex@$CODEX_VERSION" 更新根依赖,再对 build/agent-sdk/agents/codex 执行带 --package-lock-only 的安装;用 apply_patch 同步 build/codex/codex-version.txt,随后运行 npm run codex:gen-protocol。涉及文件包括两个 package.json 与 lockfile、codex-version.txt 及 src/vs/platform/agentHost/node/codex/protocol/generated/**。切勿手改生成文件,私有 feed URL 不得写入源码 lockfile。
验证:依次执行 npm run codex:check-protocol、npm run compile、./scripts/test.sh --grep codex、(cd build && npm run test)、npm run test-agent-host-e2e -- --jobs 2、npm run hygiene。E2E 以回放模式运行,出现回放未命中或 fixture 过期时先阅读相关 SKILL.md,不得削弱或跳过失败测试。
真实会话验证:按 .agents/skills/launch/SKILL.md 启动隔离 Agents 窗口,用 Playwright 快照显式启动 Codex 会话并完成确定性工具调用任务,确认所选 provider 为 Codex、命令经 Agent Host 完成、版本匹配所有锁定点、响应含指定哨兵且日志无启动崩溃或协议错误。完成后按启动技能清理。提交或推送前检查无关改动、密钥与私有 URL,仅在用户授权时提交。