Skip to content

test(windows): launch the source CLI through the shipped host entry - #6406

Merged
huangruiteng merged 2 commits into
loopx-project:mainfrom
JasonBuildAI:codex/windows-source-cli-m6v3
Oct 14, 2026
Merged

huangruiteng merged 2 commits into
loopx-project:mainfrom
JasonBuildAI:codex/windows-source-cli-m6v3

Conversation

@JasonBuildAI

@JasonBuildAI JasonBuildAI commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

Author Declaration

  • Written by: an OpenAI Codex agent executing a human operator's task; the operator set the constraints and reviewed the change before submission. AI disclosure: this change was drafted with AI assistance at my request, under my direction and review.

Implemented against

Criterion (spec clause) Disposition Symbol / path Test or command
Windows hosts exercise the CLI through the shipped Windows entry, not the POSIX shim implemented tests/source_cli.py (source_cli_command, source_cli_env, run_source_cli) 14-file set on Windows: 399 passed, 18 skipped
POSIX hosts keep the previous bash-shim invocation (argv, cwd, env) implemented tests/source_cli.py POSIX branch keeps the prior form; to be confirmed by the ubuntu CI lane (no POSIX host in this environment)
POSIX-only launcher assertions declared POSIX-only instead of failing implemented tests/test_loopx_launcher_python_selection.py, tests/test_scheduler_native_launcher.py 20 prior Windows failures now skip (18) or pass (2)
CLI text reads pin UTF-8, matching the CLI's pinned stdio implemented tests/test_scheduler_native_launcher.py previous UnicodeDecodeError: 'gbk' codec ... byte 0xb7 cases now pass
  • Self-check before submission: read the shipped launcher chain (loopx/windows_install.py, scripts/loopx_entry.py, scripts/loopx.ps1) so the helper matches installed behavior; verified every migrated call keeps its original check semantics (30 sites compared old vs new); left out product-code changes, new dependencies, and unrelated Windows failures. Review-driven follow-up commit fee76fc77 pins LOOPX_RELEASE_ROOT like the shipped launchers instead of inheriting an ambient value, pins UTF-8 on the two remaining launcher-output reads, and adds the end-to-end --version smoke. Not verified locally: POSIX execution (no POSIX host here).

Scope And Continuation

Validation

  • Tested revision: 320762cad6908b7b5672a0640de1e815ed70c3e1 (rebased onto latest main at 14112f36c; the 14-file Windows run was repeated on this head)
  • Run state: finished
  • Input classes: synthetic
Check kind Result Public-safe evidence / limitation
static passed ruff check over all changed files: All checks passed!; git diff --check clean
unit passed uv run --extra test python -m pytest -q -p no:cacheprovider tests/test_source_cli.py → 4 passed in 3.90s, including an end-to-end smoke that starts the real host entry (--version)
integration passed Windows, 14 affected files: 399 passed, 18 skipped in 366.76s; tests exec the real CLI entry end-to-end
regression_parity passed Same 14-file command at 3300dfdd2: 45 failed, 372 passed in 229.91s; before-failure list recorded in #6405; total collected 417 both sides
manual passed Byte-level check of the write-guard stdout (31,661 bytes): first non-ASCII byte at offset 732, decodes as UTF-8, not cp936 — the reader-side failure class
manual not_run POSIX execution unavailable in this environment (Windows host; bash is a broken WSL relay). CI's ubuntu lane must confirm POSIX parity
  • Coverage and gaps: changed paths are test launchers only; every affected file was executed on Windows before and after. Gap: no local POSIX re-run, argued rather than measured; the POSIX branch is byte-for-byte the previous invocation and the skips/encoding are nt-scoped. Scope note: the required windows-powershell CI lane runs a curated file list that does not include these files (.github/workflows/python-tests.yml), so the demonstrated benefit is the Windows developer loop and any job that runs the suite there; durable CI regression protection for the Windows branch would need a lane change and is left out of this PR.

Frontend / Visual Evidence

  • UI impact: none
  • Before: N/A
  • After: N/A
  • States and viewports shown: N/A
  • Source data: none
  • Attention review: N/A (test-only change)
  • Craft review: N/A (test-only change)

Type of Change

  • Test update

LoopX Area

  • Build, packaging, installer, or CI

Technical Direction

  • Direction / acceptance reference, when applicable: N/A

Shared-authority RFC fixture impact

  • Production-scale fixture schema: N/A
  • Semantic dimensions changed, or reviewed no-impact rationale: N/A
  • Provider conformance arms run: N/A
  • Read-only legacy/file/PostgreSQL three-arm rehearsal (required for promotion, runtime-routing, or compatibility-projection changes): N/A

Boundary Checklist

  • Neither the diff nor this PR body/comments/attachments disclose private state, credentials, raw traces or verifier output, internal links, or local machine paths (including .loopx/, .codex/goals/, and live ACTIVE_GOAL_STATE.md).
  • I did not duplicate maintainer-owned benchmark work unless a maintainer split out a public issue for it.
  • I kept the change scoped to the linked issue/task.
  • I completed the visual evidence section for UI changes, or marked UI impact none.
  • Every commit includes a DCO Signed-off-by trailer (git commit -s).

JasonBuildAI added a commit to JasonBuildAI/loopx that referenced this pull request Oct 14, 2026
Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
On native Windows the public suite cannot exec the extensionless POSIX bash
shim `scripts/loopx` (OSError WinError 193), `bash` resolves to the WSL
relay, and one CLI text read uses the host locale codec on output the CLI
pins to UTF-8. A shared helper (tests/source_cli.py) selects the host's real
entry: `scripts/loopx_entry.py` on Windows -- the same entry
loopx/windows_install.py and scripts/loopx.ps1 invoke -- and the bash shim on
POSIX hosts. POSIX-only launcher assertions are declared POSIX-only instead of
failing on Windows, and CLI text reads pin UTF-8.

14 files on Windows at 3300dfd: 45 failed, 372 passed before; 399 passed,
18 skipped after.

Closes loopx-project#6405

Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
Pin LOOPX_RELEASE_ROOT like the shipped launchers instead of inheriting an
ambient value, pin UTF-8 on the two remaining launcher-output reads in the
scheduler launcher tests, and add an end-to-end smoke that launches the real
host entry (`--version`).

Refs loopx-project#6405

Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
@JasonBuildAI
JasonBuildAI force-pushed the codex/windows-source-cli-m6v3 branch from fee76fc to 320762c Compare October 14, 2026 05:53

@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=xhigh.

Exact head: 320762c. Whole-PR review against 14112f3.

动机

在原生 Windows 上跑源码测试的贡献者,需要让测试真正启动该宿主可执行的 CLI。旧测试直接启动 POSIX bash shim;Windows 无法执行它,WSL relay 也不能代替已安装的 bash,按宿主默认编码读取 UTF-8 输出还会报解码错误。结果是 CLI 行为未得到检验,贡献者却要处理无关的启动失败。

此次将 30 处既有 CLI 调用集中到宿主入口 helper,保留原命令参数、cwd、env 和成功/失败断言,并声明真正的 POSIX 专用场景。独立 POSIX base/head 测试与实际 Python 隔离入口均通过,源码测试的可执行入口和既有检查语义得到保留。本次未在原生 Windows 或 PowerShell 宿主重跑,不把作者的 Windows 结果、分支模拟或本机 Python 入口验证当成该平台的独立验收;不启动 benchmark、外部模型或活动 Goal。

改动思路

复用产品已有的 Windows 启动链:sys.executable → -I → scripts/loopx_entry.py,明确设置当前 checkout 的 LOOPX_RELEASE_ROOT。POSIX 继续走原 bash shim;helper 提供原 cwd/text/capture_output 默认值及 UTF-8 解码,调用者仍保留 check 的决定。测试 fixture 只适配宿主启动与读取,不成为产品 CLI、评分或权限的新 owner。

这是一份有实际 30 处消费者的共享测试 helper,替代重复 subprocess 包装;现有 tests/control_plane/test_source_cli_entrypoint.py 检验的是 module/console 分支和 typed ownership,不是宿主 launcher 的选择,两个边界不同。相邻 windows_install/_entry_command 和 scripts/loopx.ps1 已核对,helper 的 Windows argv 与原产品 owner 一致。该 PR 边界是已有源码 CLI 测试的宿主适配,不修改已发布产品、控制面或 benchmark 的运行规则。

宿主或输入 入口与结果
POSIX 原 scripts/loopx,原参数与结果保持
Windows 分支 当前解释器 -I 运行既有 loopx_entry.py,当前 root 覆盖过期环境 root
CLI 非零退出 check=False 返回退出码;check=True 仍抛 CalledProcessError
POSIX 专用 launcher 场景 仅 nt 宿主跳过;其余平台继续检验

表格说明当前 head 的代码分支;Windows 分支的实际 Python 入口本次在 POSIX 执行,不能据此声称 Windows 内核或 PowerShell 已验证。

具体改动

全量 16 文件 +197/-219。tests/source_cli.py 的 source_cli_command(L28)选择 launcher;source_cli_env(L41)复制输入环境,并在 Windows 固定当前 root;run_source_cli(L51)保持 cwd、显式 check 和 subprocess 返回语义,默认读取 UTF-8。11 个 benchmark capability 测试文件与 Todo cadence 文件迁移 30 处调用,完整函数 AST 对照证明只删除被 helper 提供的 launcher/cwd/text/capture 包装,原 check=True/False、参数、断言和其他函数逻辑未改。

tests/test_loopx_launcher_python_selection.py 增加 nt-only 的 POSIX 声明;test_scheduler_native_launcher.py 只在 Windows 跳过 unix 分支,并固定三个原有输出读取位置的 UTF-8。tests/test_source_cli.py 用四个聚焦用例覆盖 Windows/POSIX 选择、过期 root、非 ASCII 输出和真实 host entry 启动。生产目录、依赖、CI 选择和原 benchmark 用例语义均未修改。

独立依据是 #6405 的 Expected behavior,按本次读取的当前 issue body 判断:宿主使用可执行的原有入口、POSIX 保留旧行为、POSIX 专用断言有明确范围、CLI 输出按 UTF-8 读取。Windows 入口同时对照上述 immutable base 的 shipped launcher,而非只对照新 helper 自己的返回值。

独立实际探针在非仓库 cwd 放置会报错的同名模块,并传入过期 root/PYTHONPATH:Windows 分支生成的 argv 与 windows_install owner 相同,实际 Python -I 子进程读回当前源码版本 1.4.0,未被环境或 cwd 模块截获。POSIX 原调用和新 helper 的完整 stdout/stderr/退出码相同;实际非法 CLI 参数仍返回 2 或按 check=True 抛异常。

对主干的风险

相同的原 14 文件在本机 immutable base 是 404 passed、13 skipped;当前加上四个 helper 用例是 408 passed、13 skipped。13 项均依赖本机没有的 pwsh,未作为通过项;与作者原生 Windows 的 399/18 是不同平台和选择,不能混算。风险 canary 的 4 项直接检查及 10 项选中检查通过,完整语义与维护性检查通过;没有获取或等待远端 CI。

风险集中于测试准入和 source root,而非新产品行为。用整函数 AST 与实际子进程检验防止把原失败断言改成成功;没有把 benchmark 本身跳过。Windows 环境 pin 是刻意与产品启动链对齐,POSIX 环境不增加该 pin。helper 只在 tests 内被消费,不安装新能力、写入真实配置或改变执行授权。

非阻塞建议: 后续可将 tests/test_source_cli.py 纳入现有 windows-powershell 的 curated 文件列表,使四项测试及真实 host-entry smoke 持续在 Windows CI 执行。目前该列表没有这些文件,作者也已明确披露;本 PR 已交付有用的本地贡献者测试修复,但不能声称新增 Windows CI 防护已生效。该建议不要求在此 PR 扩大到其他 Windows、TS 或 EdgeBench 任务。

我的整体评价

APPROVE。共享 helper 有 30 处真实消费者,减少重复维护并修复已演示的宿主入口问题;既有正负检查、POSIX 行为和输入环境隔离均有独立证据。原生 Windows/PowerShell 的本次独立运行缺口保留,当前无要求作者更改产品 runtime 的 blocker。

未来维护检查已应用:调用者集中到同一个测试入口,复用既有产品 owner,不再增加另一套 installer 或通用测试框架。同作者最近 30 个 PR 已检查;相邻 #6356、#6368、#6399 和 #6422 处理其他明确宿主或产品边界,没有发现重复同形 scaffold,未触发贡献限制。历史 RFC 经验对本测试修复不提供结论,只提示核验实际使用路径;不宣称模型采纳或长期收益。

English verdict: APPROVE — 320762c. All 30 migrated calls preserve their checks and assertions. POSIX base: 404 passed/13 pwsh skips; head: 408 passed/13 skips. The real isolated Python entry and ambient-root rejection are verified on POSIX; native Windows and PowerShell were not independently rerun. Consider adding the helper tests to the existing Windows CI selection.

@huangruiteng
huangruiteng merged commit 4998d0b into loopx-project:main Oct 14, 2026
45 of 52 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.

[Bug]: On native Windows the source-checkout test suite cannot launch the CLI (WinError 193 / WSL relay / locale decode)

3 participants