Skip to content

test(peers): preserve UTF-8 CLI round trips on Windows - #6839

Merged
huangruiteng merged 1 commit into
mainfrom
codex/windows-peer-cli-utf8-20261019
Oct 19, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/windows-peer-cli-utf8-20261019

Conversation

@BigDataDZ

Copy link
Copy Markdown
Contributor

On native Windows with a CP936 parent locale, the real peer CLI emits valid UTF-8 JSON but the shared collaboration test helper decodes it using the locale default. A legitimate Chinese/emoji brief makes the reader thread raise UnicodeDecodeError, followed by json.loads(None); the CLI's successful result is lost.

Decode the existing helper's stdout/stderr explicitly as UTF-8, retaining strict decoding. Add a real subprocess round trip covering a Unicode brief, receiver adoption, Unicode reply and original parent-request identity, plus the existing unknown-agent rejection behavior. Run that case in the existing native Windows peer CI step. Production code and authority rules are unchanged.

Validation on main dc9fdbb5186618ec2e797a9d7545e2fe524fee56, native Windows/Python 3.12 with CP936:

  • New regression failed before the fix with the actual reader-thread/JSON failure; after the fix it passed.
  • Full peer-collaboration module: 41 passed, 1 POSIX FIFO skip (428.68 s).
  • Independent read-only review found no blockers and separately ran the new case successfully.
  • Changed-file Ruff, whitespace and public/private boundary checks passed. The advisory inspected no production vocabulary paths; it is not semantic-equivalence evidence.

The existing shared test helper is the appropriate owner; no new abstraction or production refactor is needed. This qualifies the multilingual fixture and its CI wiring, not all Windows collaboration routes or a production behavior change. Hosted CI remains pending.

Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
@BigDataDZ

Copy link
Copy Markdown
Contributor Author

CI follow-through: the native Windows job stopped in the earlier CLI fixture step, before this PR's new peer round trip ran. Three long-path cases emit brief JSON of 10,522 characters against 10,500. Main dc9fdbb5186618ec2e797a9d7545e2fe524fee56 has the same failures; the relevant fixture/output-owner files are unchanged in this PR.

The cause is native JSON path escaping at equal physical path length, not the peer UTF-8 reader change. #6843 proposes a measured, JSON-only characterization adjustment plus real depth comparisons and an owned short pytest namespace. Its focused native checks and full real base/head CLI differential pass locally. Hosted qualification remains pending; this job is not relabeled passed and has not qualified the new peer case.

This PR's independent native result remains 41 passed / 1 POSIX FIFO skip, including the successful Unicode request/adoption/reply round trip. Maintainer review and hosted execution remain separate.

@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

Exact head: 218fab584b599dd6564f598496c3c7d81455b9a7

动机

未发现阻塞性问题。

在中文 Windows 环境运行协作回归测试的维护者,会遇到成功的 CLI 输出被测试读取器误解码的问题。

例如真实 CLI 返回含中文和 emoji 的请求与回复:旧测试辅助函数沿用父进程 CP936,读取时抛异常而丢失成功结果;修复后按既有 UTF-8 输出契约严格解码,并验证完整往返及原请求关联。

本轮真实 CLI 和存储往返在父进程 CP936 编码模型下由基线失败变为当前通过;默认 UTF-8、ASCII、未知 Agent 拒绝与非法字节严格拒绝均保持。

范围是共享测试读取器和现有 Windows CI 选择器;产品代码、权限与用户工作流均不改变。

改动思路

修复既有共享 CLI 测试辅助函数的解码参数,并用真实请求、采纳和回复流程验证;不复制启动器、不更改生产编码 owner,也不引入新抽象或协作协议。

本 PR 的完整边界是测试端正确消费现有 UTF-8 JSON 和原生 Windows 作业的用例接线;生产行为及更广 Windows 路由的资格保持独立。

不处理会保留可重复失败,分别在消费者打补丁会重复错误处理或启动逻辑。当前共用 owner 已是最小有效边界;正常流程无需增加确认、重填信息或新配置。只读诊断/严格解码与真实效果继续由现有层分别负责,不能从测试或缓存成功推断更高权限。

具体改动

完整 dc9fdbb5186618ec2e797a9d7545e2fe524fee56 → 218fab584b599dd6564f598496c3c7d81455b9a7:2 路径 +23/-0。

关键代码讲解

  • cli:已有测试辅助函数运行真实模块 CLI,再检查退出码并解析 JSON。新增 UTF-8 参数同时用于 stdout/stderr,保留 strict 解码、30秒超时和隔离 cwd;它修复消费者而不改变生产输出。

  • test_peer_cli_preserves_unicode_request_and_reply:沿用真实场景完成请求、读取、采纳、回复和返回读取,逐字比较中文及 emoji,核对原 parent_request_id,并验证未知 Agent 仍被拒绝。现有 Windows peer 作业新增这个准确测试节点。

未找到单独规定此私有测试辅助函数 codec 的书面规范(no_spec);独立依据是未改动的 cli 模块转发和 entrypoint.pin_utf8_stdio,以及真实 peer 请求、采纳、结果返还的既有行为。整个 loopx、apps、packages 与依赖声明的 base/head 字节相同。新例沿用已有场景,不增加真实渠道或账户接触。

对主干的风险

完整 peer-collaboration 模块39项通过,3条未改动的原生 Windows 条件用例跳过;五项 direct 和两项 selected 全部执行通过。 exact-scope change-quality receipt_missing 仍是独立合并资格限制。

独立同脚本四类实际子进程/原生存储场景:基线只有 CP936 父解码器的中文/emoji 往返失败,当前四类全过;原默认 UTF-8、CP936 ASCII 与非法字节的严格拒绝保持。只有父进程 stdlib 默认 codec 被控制,子进程仍运行真实 CLI,生产源码没有注入或 overlay。未知 Agent 仍被 Core 拒绝,返回内容和原 parent 逐字比对。该模型验证解码器修复,不能当成原生 Windows 整机或 hosted job 已执行。

已读作者关于既有 long-path brief JSON 预算失败和 #6843 的说明;相关输出/预算 owner 未被本 PR 修改,不在此宣称修复或托管资格。新增 YAML 节点使用既有 Windows peer step,静态指向实际通过的新测试函数,未更改 required check 名称或跳过规则。

语义与 CI 对齐

变更停留在本地测试传输与 CI 选择,没有新共享词汇、Actor 或授权规则;生产树逐字节相等。标准 canary 的实际检查均执行通过,但外层因 receipt_missing 仍非通过,保留独立合并资格门。遵循 wait_for_ci=false,未查询、轮询、等待或触发 CI。

我的整体评价

problem_context=goal_achieved 仅覆盖本次有界缺陷;long_horizon 和 user_experience 均为 preserved。可移植测试恢复消费成功结果,产品的持续任务和用户工作流没有变化。结构和规模 proportionate,现有共享 helper 已足够,未发现需要在本 PR 再加的抽象。CP936 是 POSIX 上的真实父解码器模型,未执行原生 Windows 或托管 CI;作者报告的原生41/1结果保留独立来源。 不以用例数推断长期收益,不授予合并、升级或真实 peer 消息权限。

English verdict: APPROVE at 218fab584b599dd6564f598496c3c7d81455b9a7. The existing test helper now strictly decodes the CLI UTF-8 wire independently of parent locale; real request/adoption/reply lineage and authority negatives pass, with production byte-identical. Local validation is recorded with native-host limits and the separate missing managed quality receipt.

@huangruiteng
huangruiteng merged commit 4f6e20a into main Oct 19, 2026
29 of 37 checks passed
@huangruiteng
huangruiteng deleted the codex/windows-peer-cli-utf8-20261019 branch October 19, 2026 06:32
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