Skip to content

test(native-chat): isolate ambient provider selection - #7854

Merged
huangruiteng merged 1 commit into
mainfrom
codex/return-validation-frontier-20261101
Nov 2, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/return-validation-frontier-20261101

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

测试进程继承 LOOPX_CHAT_CODEX_MODEL_PROVIDER 时,未配置该 provider 的合成 app-server 无法通过原生读回检查。private-Lark 回传夹具因此在委托启动阶段得到空创建回执,实际回传断言无法执行。

本改动把这个外部选择器纳入现有 pytest 环境隔离。每个测试仍可显式选择 provider,fixture teardown 恢复原环境。生产 provider 配置和读回拒绝逻辑保持原样。

  • Outcome basis: 可复现的测试隔离缺口,支持 roadmap R3 的现有自动回传/恢复验收。
  • Before → after: 未修改 8ac384cd,注入合成 fixture-ambient-provider 的代表 native-shared 用例出现 setup error;只在该进程移除选择器,四个 native/legacy × shared/separate 案例通过。修复后完整 56 个回传用例得到执行。
  • Intended base: loopx-project/loopx:main;最终实现基线 07149df6858fd6ed440209a74e4e2ec448476a09。

Author Declaration

Criterion Disposition Symbol / path Test
隔离宿主配置,允许测试自行选择 provider implemented tests/conftest.py existing autouse fixture 强制外部合成选择器下的七套 pytest
保留显式选择、身份读回拒绝与原线程/权限约束 implemented existing provider tests, production code unchanged test_chat_agent.py provider override / refusal / managed-executor cases
让原回传拒绝、重启恢复与去重断言真正执行 implemented within synthetic path existing private return/steward suites 135 passed,包含全部 56 个 private-return cases

Scope And Continuation

完成本测试隔离切片,复用既有 fixture,没有新增 helper 或重写合成协议。依赖恢复后的验收信号可用于 #7851 的后续准确版本资格核验。其旧失败回执、已有路由修复 #7842 和较广 R3 验收分别保留;本 PR 不自动使旧版本通过。

Validation

  • Tested revision: ba5d3c25f286d52807b974b216ca2145f164ac46 on 07149df6.
  • Run state: finished.
  • Input classes: synthetic, public_fixture.
  • Test input: ambient LOOPX_CHAT_CODEX_MODEL_PROVIDER=fixture-ambient-provider; source imports asserted before pytest.main.
Check kind Result Public-safe evidence / limitation
regression_parity passed 固定合成外部选择器使未改基线的代表用例 setup 失败;仅移除这一进程变量后四个原场景通过。原失败仍保留。
real_entrypoint passed 135 passed: test_lark_private_manager_returns.py、test_native_steward_private.py、test_native_steward_managed_mode.py。实际 Core/Chat store、原生合成子进程与 transport fixture,覆盖 56 个原回传用例。
unit / integration passed 534 passed: test_chat_agent.py、test_chat_codex_auth.py、test_chat_ordinary_project.py、test_chat_queue_preparation.py。显式 provider 选择及 wrong/missing readback 拒绝保持。
static passed Changed-fixture Ruff、committed diff/public-boundary scan;DCO sign-off。
integration passed Exact-scope quality receipt valid;source-checkout standard premerge 5 direct checks passed、0 catalog checks selected,最终 gate passed。

首次 669 项检查后,main 合入相关 readback/claim owner 变更,已在重新基线后的最终提交再跑相同 669 项。没有把第一次检查或错误来源的探针冒充最终版本结果。

  • Coverage and gaps: only test isolation changed; synthetic provider/transport evidence does not establish live Lark delivery, installed activation, real model behavior or complete R3 adoption/cost acceptance. No authority-store or runtime routing changed, so no PostgreSQL promotion/rehearsal claim.

Frontend / Visual Evidence

  • UI impact: none. Before/after, first viewport/preview, attention/craft review: N/A; no UI, bundle or production behavior changed. Test source data is synthetic/public fixture.

Type of Change

  • Bug fix
  • Test update

LoopX Area

  • Build, packaging, installer, or CI

Technical Direction

R3 automatic return/recovery validation; supports C6/C8 qualification without closing their broader acceptance.

Shared-authority RFC fixture impact

N/A: no authority-store promotion, runtime routing or compatibility-projection change.

Boundary Checklist

  • No private state, credentials, raw traces, internal links or local operating paths in diff/body.
  • Scoped to existing test isolation; active peer implementations remain with their owners.
  • No paired RFC changed; exact-head bilingual diff check passed.
  • UI impact none.
  • Commit includes DCO Signed-off-by.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

可以批准。已独立复现外部选择器造成的 setup 错误,并在当前精确 head 重跑实际受影响的测试入口;CI 未作为批准条件。

动机 / Motivation

维护者在已配置 Chat provider 的机器上运行合成回传测试。外部 provider 选择器进入未配置该 provider 的合成 app-server,代表用例在委托 setup 阶段拿不到创建收据,后续回传断言没有执行;当前 fixture 先隔离这个外部选择器,测试仍可显式选择 provider。相同基线仅移除该进程变量后四种场景通过;当前精确 head 在保留相同外部变量时通过 669 项检查,pytest 返回后调用方变量恢复。本 PR 不修改生产路由、放宽 provider 读回拒绝,也不资格化真实 Codex、在线飞书投递、安装采用或完整 R3。

改动思路 / Approach

正确的边界是 pytest 的测试进程环境。复用已有 autouse fixture,与 HOME、USERPROFILE、CODEX_HOME 的隔离放在一起,比逐个修补回传夹具更小,也保持原消费者可执行。生产 CodexChatAgentSession.start 对 requested provider 的选择与读回确认继续存在;测试自己在函数内设置 provider 的路径仍可用。当前没有新增产品设置、权限流程或用户准备工作。

本次不把恢复 RFC 的阶段设计建议强加到两行维护修复;采用的是实际失败消费者、原断言和明确合成边界的判断。它修复验证信号,不以测试数量宣称完整 R3 已交付。

具体改动 / Changes

审查 head ba5d3c25f286d52807b974b216ca2145f164ac46,实际 merge base 07149df6858fd6ed440209a74e4e2ec448476a09;唯一文件 tests/conftest.py,+2/-0。没有独立书面的 provider 隔离规格:以已复现缺陷、已有 isolation fixture 和未改的 provider 合同验收;另遵循固定基线的 source-checkout 验证规则。

关键代码讲解

_isolated_default_runtime_routes 在 case 执行前移除继承的 LOOPX_CHAT_CODEX_MODEL_PROVIDER,允许测试随后自行显式设置。pytest 的 monkeypatch teardown 恢复调用方环境;本轮在同一 Python 进程运行完全部所选用例后也检查了恢复结果。

CodexChatAgentSession.start 仍将显式普通 Chat provider 传入 native 请求,并在 1042 行 拒绝未确认的选择。既有 override、wrong/missing readback 和 managed executor 隔离断言都保留;没有通过删掉拒绝路径让 setup 变绿。

同一入口的受控输入 观察
固定基线 + 外部合成选择器 native-shared setup ERROR,创建 receipt 为空,原回传断言未执行
同一基线,仅移除该进程变量 native/legacy × shared/separate 四种场景 PASS
当前 head,保留同一外部变量,七个相关模块 669 PASS;调用方变量恢复

对主干的风险 / Risks

主要反例是 fixture 清理是否掩盖真实的 provider 错配。已读生产分支并执行原有显式选择和拒绝测试,确认这些检查仍生效。合成 native 请求记录也显示基线确实带入了外部 modelProvider;不是换一个来源不明的 Python 后把失败归给源码。

PASS:669 项源码检查,Ruff、编译、双语 diff 与公开边界检查;quick premerge 的 5 项直接检查通过,未选中 catalog 项。全部原测试断言和权限/原线程/回传恢复边界保留。没有新增可重复的临时 smoke,集中在现有 fixture 的一处修复有明确消费者。

HOLD:当前 target 下 CQR receipt 已 stale,aggregate premerge 退出 1,合并门禁没有通过;它没有被改写成通过。CI 状态/原因未知,未查询、轮询或等待。此结果覆盖真实 Core/Chat store 和隔离合成子进程/transport fixture;在线投递和真实模型行为仍是独立边界。

我的整体评价 / Verdict

这个有界测试隔离问题已解决。long_horizon、user_experience 均为 preserved:原恢复和拒绝语义仍被检查,维护者不必为合成测试修改自己的实际 provider 配置。检查了 shared pytest fixture 和实际 Chat provider caller;没有 UI 或渲染呈现变化,视觉审查不适用。真实 Codex/飞书网络、安装采用和完整 R3 成果/成本没有在此验证。代码量与问题相称,保留集中隔离即可;不需要新 helper、额外配置或新的跟进任务。批准不授予 merge、dismissal 或安装权限,也不把相关 #7851 自动记为通过。

English verdict: APPROVE at ba5d3c25f286d52807b974b216ca2145f164ac46. The ambient-provider setup failure is reproduced and fixed without weakening explicit provider validation; CI and merge qualification remain separate.

@huangruiteng
huangruiteng merged commit 73d1add into main Nov 2, 2026
28 of 34 checks passed
@huangruiteng
huangruiteng deleted the codex/return-validation-frontier-20261101 branch November 2, 2026 03:22
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.

2 participants