Skip to content

ci(windows): qualify the native Windows settlement Turn rendering - #7920

Merged
huangruiteng merged 1 commit into
loopx-project:mainfrom
gcl-coder:ci/windows-settlement-turn-qualification
Nov 3, 2026
Merged

huangruiteng merged 1 commit into
loopx-project:mainfrom
gcl-coder:ci/windows-settlement-turn-qualification

Conversation

@gcl-coder

@gcl-coder gcl-coder commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

问题

结算计划(settlement plan)会把 Turn 实例引用渲染成运行它的那个 shell 能展开的语法:

  • POSIX 主机:"${LOOPX_TURN:?}"(sh 的参数展开,变量为空时报错)
  • 原生 Windows 主机:$LOOPX_TURN(PowerShell 语法)

PowerShell 不认识 ${LOOPX_TURN:?},会原样转发这个字面量,于是第一条结算命令带过去的 Turn 是空的,直接被 QUOTA_VALIDATION_FAILED 拒掉。上游 #7823(对应 issue #7808)修的就是这个。

缺口

验证这个渲染的用例是:

tests/control_plane/test_quota_settlement.py::test_codex_app_windows_settlement_command_substitutes_powershell_turn

它被 skipif(os.name != "nt") 保护——只有原生 Windows 才能断言。

而 windows-powershell 这条 lane 从来没有运行过 tests/control_plane/test_quota_settlement.py 这个文件。

于是 skipif 的效果不是「这条用例在非 Windows 上跳过」,而是整个文件在托管 CI 里静默消失:

  • 托管 CI 报绿
  • Windows lane 报绿
  • 但那个 Windows 专属渲染行为一次都没有被执行过

修复代码在、测试在、护栏在,唯独没人跑。

改动

1. .github/workflows/python-tests.yml — 在 windows-powershell lane 新增一个独立 step,只跑那一条 nt-only 用例:

- name: Qualify native Windows quota settlement Turn rendering
  run: >-
    python -m pytest -q
    tests/control_plane/test_quota_settlement.py::test_codex_app_windows_settlement_command_substitutes_powershell_turn

只跑这一条、不把整个 1526 行的文件塞进 Windows lane,是为了不引入与本缺口无关的失败面。

2. tests/test_python_ci_workflow.py — 新增契约测试把这个 step 钉住:

  • step 必须存在
  • 不能带 if(跳过)
  • 不能带 continue-on-error(放水)
  • pytest node ID 必须精确匹配
  • 该用例必须继续保持 skipif(os.name != "nt") 保护

这样以后谁删了这个 step、或者新增了 Windows-only 结算用例却没进 lane,契约测试直接红,而不是静默地少验一遍。

验证

  • pytest -q tests/test_python_ci_workflow.py -k windows → 3 passed
  • python -m unittest discover -s scripts/ci -p 'test_*.py' → 21 OK

范围

仅 CI 资格覆盖,不改运行时行为、不改产品代码:一个 workflow step + 一个契约测试。

The settlement plan renders the Turn reference for the shell that runs it:
a native Windows host must receive $LOOPX_TURN, because PowerShell does not
expand the POSIX-only ${LOOPX_TURN:?} and would forward an empty Turn.

The case that observes this is guarded by skipif(os.name != "nt"), and the
native Windows lane never ran tests/control_plane/test_quota_settlement.py.
The guard therefore hid the whole file: hosted CI reported green while the
Windows-only rendering of the settlement command stayed unqualified.

Run that exact case in the windows-powershell lane and pin the step in the
workflow contract test, so a dropped step or a new Windows-only settlement
case fails the contract instead of shipping unqualified.

Validation: pytest -q tests/test_python_ci_workflow.py -k windows -> 3 passed;
python -m unittest discover -s scripts/ci -p 'test_*.py' -> 21 OK.

Scope: CI qualification only, one workflow step and one contract test.
Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max.

动机 / Motivation

维护 Windows PowerShell 上任务结算能力的开发者与 CI 维护者。原 Windows 测试任务没有运行已有的 PowerShell Turn 转发用例,其他测试通过也无法暴露结算命令丢失 Turn 的回归;新版把该现有用例接入 Windows 必需任务。head 的新检查通过,换回 base 工作流或禁用步骤、忽略失败、替换错误节点时检查均退出 1;实际 Windows 执行尚未在本机验证。本 PR 只交付 CI 覆盖接线,不修改结算实现,也不将本机通过冒充 Windows 平台资格或合并授权。

改动思路 / Approach

复用已有 Windows job 和已有真实 PowerShell 用例即可覆盖已证明的 CI 空洞,无需新平台探测器或第二个结算实现。当前 PR 边界是 Windows CI 接线及阻止接线回退的测试,不包含重新设计平台结算。保留现状会留下已复现的问题;重新建立规则或平台实现会增加不必要的维护边界。当前设计把必要判定放在原 owner,数据源和失败仍沿用原路径。新步骤不加条件跳过或失败容错,断言复用原测试对实际 PowerShell 子进程的验证;工作流本身没有增加产品状态、权限或配置。

具体改动 / Changes

全量 diff:2 个文件,增加 47 行、删除 0 行。仅修改现有 workflow 和其测试,已有结算源码与 Windows-only 用例内容完全不变。对完整相关 job 解析比较,删除唯一新增步骤后与 base 相同;独立 AST 检查把 nt-only decorator 绑定到实际目标函数,而非仅凭文件中某处出现 skipif。

关键代码讲解

修改前契约映射

依据 docs/development/testing-and-quality.md,不可变版本 214afbb6222c4f0b410a6a1cc084d0262e91925f。以下采用原文节标题作为 criterion_id:

  • Required Merge Check / 必需合并检查:代码与 workflow 变更保留必需 Windows 测试,失败或异常跳过不得作为成功。 implemented;由 .github/workflows/python-tests.yml 和本轮真实入口验证。

补充问题背景为 #7808,运行时修复 #7823 已合并;本 PR 不重新声称该修复的独立 Windows 实测。接线测试在当前 head PASS,替换为 base 工作流,以及禁用步骤、容错、错节点三种变体,均真实运行 pytest 后 FAIL,证明该测试可捕获目标缺口。

对主干的风险 / Risks

未发现阻塞项。workflow 测试 550 PASS,CI 辅助 unittest 21 PASS,portable settlement 78 PASS / 1 SKIP,Ruff 和标准 premerge PASS。唯一 skip 是原本仅在 nt 上运行的 PowerShell 用例;没有更改 os.name 或把 macOS 结果称作原生 Windows 执行。新增接线不改变其他 job 或运行时代码,主要风险是 future native test 自身出现额外 skip;当前目标 decorator 与 job 调用已独立核验。suite-wide skipif 搜索将来可以收紧,但当前没有证明误分类。

按当前策略未获取、轮询或等待远端 CI,CI 未知不当作代码缺陷或已通过。本机 source-checkout 验证、合成 provider、平台未测与安装后的真实使用分别保留。该评审不执行合并、安装或部署。

我的整体评价 / Verdict

APPROVE:未发现阻塞项。 这个有界 CI 覆盖目标已达成;long_horizon 与 user_experience 的产品行为保持。原有测试逻辑未重复实现,无新状态或配置,新增人工准备和确认轮次均为零。复用已有 Windows job 和已有真实 PowerShell 用例即可覆盖已证明的 CI 空洞,无需新平台探测器或第二个结算实现。当前 PR 边界是 Windows CI 接线及阻止接线回退的测试,不包含重新设计平台结算。未改图形页面;检查的是 GitHub Actions 工作流和 pytest 接线。视觉未验证范围:无适用的页面布局变更;运行边界为精确 head 的隔离 source checkout。最强未验证范围为安装后的 Host 行为、模型理解与长期完整成本;原生 Windows 本机执行也未覆盖。语义词汇复用既有 owner,未创建公共闭集协议或新授权。

English verdict: APPROVE — head 404fbb38ec2e171f60028c0396c39ec1c13042c9; no blocking findings. Existing native Windows settlement coverage is now wired into the Windows job; local wiring, negative cases and portable regressions pass. Native Windows execution was not run on this Mac.

@huangruiteng
huangruiteng merged commit 4fcdc7a into loopx-project:main Nov 3, 2026
28 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants