Repository navigation
Conversation
native_host.switch() refuses a non-macOS host at its entry gate, so test_native_restart_uses_real_accepted_work_fence_before_app_quit failed on Linux CI with `platform_unavailable` instead of reaching its `waiting_for_idle` assertion. The fence that protects accepted Chat work from a client restart was therefore never exercised on the Linux runner. Mock the platform at the host boundary so the platform-independent fence assertion runs on every CI platform. Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning effort: max
动机 / Motivation
[P2] 请处理与已合并 #7813 的重复修复。 受影响的是在 Linux 上验证 Codex 账户切换保护的贡献者。原测试在检查已接收的 Chat 工作之前就被平台入口拒绝;模拟 macOS 入口后,测试可以验证有未完成输入时禁止退出 App,工作完成后再允许继续。该修复在此 head 的目标用例上有效,但当前 main 已通过合并的 #7813 实现同一保护,因此本 PR 现在没有新增覆盖。本次只评审测试补丁,不改变账户切换、凭据、进程退出或任何运行时权限。
当前 main 38fcfece0dea9a754832390d8eb0e24037cb669b 已包含提交 e076af6,随 #7813 于 2026-11-01T12:32:32Z 合入。它已在同一测试内设置 host_module.sys.platform = "darwin"。这里的 sys 与该模块的 sys 是同一解释器模块,新增 override 没有不同的保护作用。建议关闭重复提案;若另有未覆盖情形,请先基于当前 main 明确那一项缺口再提交。
改动思路 / Approach
原本应保持真实的 NativeHost.switch → restart_guard → managed_chat_activation_guard,只模拟操作系统入口。此 head 的实现确实保持了这个边界:测试创建真实临时 Chat store,依次写入 queued、starting、running、completing、interrupting、invalid;用合成进程信息识别管理中的 Chat 服务,并以本地函数替代 App quit。被保护状态必须返回 waiting_for_idle,不能改写输入,也不能到达 quit。有效状态转成 completed 后,测试还检查 ingress lock 在退出阶段仍然持有。
这个结构有长期回归价值;当前 main 已有相同断言和平台 override,继续加一次 override 不会增加失败检测能力。此 PR 没有增加新 fixture、测试参数或生产分支。
具体改动 / Changes
关键内容讲解
唯一改动是 tests/presentation/test_codex_accounts.py:433–437 的四行说明与 monkeypatch.setattr(sys, "platform", "darwin")。fixture 会在测试结束后恢复平台;真实 fence 没有被替换。没有独立书面规格或关联 issue;依据是 PR 内可复现的测试缺陷、现有保护语义及当前 main 的已合并修复。
独立验证的结果是:macOS 上六个目标参数通过;真实 Linux 的聚焦运行中,较新目标基线的六例均在 platform_unavailable 失败,当前 head 六例通过。该目标基线不是 PR 的分支点;真实 merge base 是 428f71177db4c0acb87d16ecad2abe555d952e2d,随后将三份不可变 Git 快照放入原生 ARM64 Linux 容器内的文件系统:真实 merge base 为 6 failed、81 passed、2 skipped,head 与当前 main 均为 87 passed、2 skipped。目标 main 的其他提交没有计入本 PR。canary premerge 的 5 个 direct checks、Ruff、DCO 和 diff 检查通过。公共扫描仅提示既有非字面量 credential 引用及空临时 runtime,没有新增敏感值。
整文件的共享挂载 Linux 运行存在其他红项:amd64 模拟环境 head 为 5 failed/82 passed/2 skipped,ARM64 共享挂载 head 为 1 failed/86 passed/2 skipped。失败均在未改动的账户策略测试;目标 fence 参数通过。它们的环境与并发原因仍未完全归因,不能记为整文件通过,也不是本次重复性 finding 的依据。未获取、轮询或等待 CI。
对主干的风险 / Risks
当前阻断来自重复覆盖,而非宣称平台模拟有安全缺陷。旧分支上的目标用例通过,只能说明原始修复有效;无法证明它仍填补当前主干的缺口。叠加到 main 后只会留下重复的平台设置和额外说明,增加维护噪声。最低处理是关闭重复 PR;如保留提案,应先 rebase,保留一个平台 override,并给出能区分当前 main 与修订 head 的独立失败用例。
覆盖检索已检查现有 accepted-work/Chat activation tests、同一作者的当前开放项和最近十个提案。未发现需要合并的新 smoke,也没有先前警告后反复批量重复提交的依据,因此不建议账户限制。对 Linux 冷启动红项保留诊断记录;没有降低 timeout、删断言或以较晚单次成功追认它们的原因。
我的整体评价 / Verdict
REQUEST_CHANGES。实现保留了真实 fence,测试目标也有实际价值;但这个 exact head 对已合并的当前 main 没有新的独立价值,属于重复维护。长期工作保护已由既有实现覆盖,此补丁没有新增运行时行为;检查的用户路径是内部测试与既有账户切换保护,没有渲染页面变化,visual review 不适用。已安装宿主与整文件 Linux 冷启动稳定性仍未验证。
本结论只覆盖 4289aea2acee76b5c68dd760cd18aa3c9fd20a1f,不授予关闭 PR、账户限制或合并权限;没有执行这些操作。
English verdict: REQUEST_CHANGES — head 4289aea; the same platform override and accepted-work coverage are already on main via #7813. Close the duplicate or demonstrate a distinct remaining gap. No merge performed.
| # refuses a non-macOS host at its entry gate, so without this the Linux | ||
| # CI run stopped at `platform_unavailable` and never reached the | ||
| # `waiting_for_idle` assertion below. | ||
| monkeypatch.setattr(sys, "platform", "darwin") |
There was a problem hiding this comment.
|
Confirmed, and thanks for the pointer.
monkeypatch.setattr(host_module.sys, "platform", "darwin")added by #7813 ( This branch was opened nine minutes before that merge, so it is a duplicate |
tests/presentation/test_codex_accounts.py::test_native_restart_uses_real_accepted_work_fence_before_app_quitfails on Linux CI.Why
native_host.switch()refuses a non-macOS host at its entry gate:So on the Linux runner the test stopped at the gate and never reached its
waiting_for_idleassertion. The fence that protects accepted Chat workfrom a client restart - the whole point of this test - was never executed
on Linux CI. The six parametrized cases reported a failure that looked
like a product defect, but no fence code ran.
What
Mock the platform at the host boundary, before
native_hostis imported:The fence logic itself is platform independent; only the macOS entry gate
is not. This keeps the real
switch()path, the realrestart_guard(),and the real
waiting_for_idleassertion under test on every platform.Validation
Reproduced with a
sys.platform = "linux"pytest plugin:Whole file under the same plugin:
87 passed, 2 skipped.Scope
One file, one test, five lines. No product code changes.