Skip to content

fix(testing): use complete C1 input in host prompt probes - #8981

Open
loopx-agent wants to merge 2 commits into
mainfrom
codex/c1-host-prompt-source-20261118t023305
Open

loopx-agent wants to merge 2 commits into
mainfrom
codex/c1-host-prompt-source-20261118t023305

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

The release-only host prompt qualifier still sent its realistic external-wait case through the legacy quota compactor. Its scenario validator also reconstructed that old carrier. Both consumers now reuse the complete source: the existing TypeScript composer supplies one checked input shared by thin and brief probes, and the validator reads the source portfolio.

Complete source and long Task/Stop text reach the final message receiver; unknown source versions/bindings are rejected before provider callbacks. The four independent synthetic controls, hidden expected answers and independent attempts are preserved. This changes qualification input, without adding a format switch or another policy owner.

Intended base: main, integrated through 3c03e91e6736f129d78e7c895b9d4a871f132a7f, including the now-merged ordinary C1 cutover #8956 and existing lint prerequisite #8969. Related: #8266 (C1), #8963 (unused factories). No benchmark study or frozen raw/v0 corpus is changed.

Author Declaration

  • Written by: model_agent — Codex (OpenAI).
  • Specification: docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md at 3c03e91e6736f129d78e7c895b9d4a871f132a7f, source audit and caller replacement/cutover unit; main RFC §9.
Criterion Disposition Path / verification
Migrate actual qualification consumers to the shared owner implemented for this slice host_prompt_behavior.cases/run_probe, validate_external_wait_fallback_scenario; real TS composition and final-message receiver
Preserve complete obligations and refuse unknown execution semantics implemented Long Task/Stop regression and two before-provider refusals
Preserve independent/frozen controls implemented Four small controls and frozen raw/v0 corpus unchanged; existing oracle and portfolio tests retained
Host/installed adoption, settlement, matched outcomes and complete cost deferred to existing C1 work Scripted receivers do not establish these RFC §9 criteria

Self-check: entire final six-file diff, repository instructions/ownership/build tasks, both RFC languages, actual release script and installed wheel inputs reviewed. Python remains the specialized probe/provider adapter; complete-source semantics stay in TypeScript. One bounded guide correction aligns the owning release-validation documentation; no new schema, helper framework or policy.

Scope And Continuation

Complete within this qualification-consumer slice. Ordinary production source/settlement changes already came from #8956. Other Host adoption, historical-reader exit and original outcome/full-cost criteria remain with the existing C1 work. #8963 retains unused-factory cleanup. This slice can be reverted independently; it neither installs/promotes a runtime nor removes persistent history readers.

Validation

  • Tested revision: 8720ced7dcddc8580dc83ff9c83c90f836465cd3.
  • Run state: finished.
  • Input classes: synthetic, public_fixture.
Check kind Result Evidence / limitation
regression_parity passed Original nine-case baseline passed; new complete-input regression failed against the old carrier and passed after repair. Original failure retained.
unit passed Final integrated head: 107 affected cases, zero skips/errors/failures, covering host prompt, portfolio, planning horizon/transport and current actual-default controls. Includes all 12 host-probe cases and two reserved-source negatives.
real_entrypoint passed Actual release script default-off and explicit-live with credential removed both report skipped and zero provider calls; neither is a live-model pass.
integration passed Final wheel rebuilt/reinstalled in isolation; both changed product blobs equal head. Actual packaged TS composition reaches the scripted receiver in both modes: 10 callbacks and two pre-callback source refusals. No actual provider calls/Host execution.
static passed Declared Ruff scope, configured mypy subset (17 files), exact-head bilingual RFC, semantic diff advisory (zero supported new carriers; inference limits retained), diff hygiene, four DCO commits and six-path public scan (zero errors/warnings).
integration passed Source-venv Chat build/freshness and final wheel build. Existing asset warnings retained; no lockfile/UI change. Development/RFC docs are source-only under the existing wheel layout.
static passed Strict receipt cqr_d55b4b61b60fd4b9b523, scope d55b4b61b60fd4b9b523519cb2e484e5c3a94c88c4ff411704fd0a7ad5e8b922: valid, zero blockers, three disclosed warnings, one bounded safe-fix.
integration passed Final integrated standard premerge: all 6 direct and 11 selected checks passed, zero holds/failures; original per-check 120s limit unchanged. Strict exact-scope receipt valid.

Same-source integrated engineering comparison, UTF-8 message content and zero model calls:

Input Old compact case Complete case
Packet body 33,331 38,105
Thin final message contents 38,504 43,278
Brief final message contents 39,978 44,752

Each increases by 4,774 bytes. This is not provider framing, tokens, latency, accepted outcomes or complete cost. The initial ambiguous-route comparison failure and incorrect development-docs-in-wheel verification assumption are retained; explicit disposable routing and declared wheel inventory were then checked.

The pre-integration standard gate failed when its semantic scan exceeded the unchanged 120s limit. Standalone original head and immutable base subsequently passed that same bound. This does not establish the initial cause or latency qualification; the failed observation remains. The integrated whole-gate result is reported separately above.

Coverage gaps: actual live models, installed App/Host, native Windows, matched task outcomes and complete cost remain unqualified. No TS/storage diff is introduced, so expanded TS/PostgreSQL suites were not selected. No remote CI query, polling or dispatch. Author checks do not grant merge authority or replace independent exact-head review.

Frontend / Visual Evidence

UI impact: none. Existing verification CLI/final prompt input only; no page, configuration or new caller-facing capability. Screenshots/viewports not applicable. Source data: synthetic/public fixture.

Type of Change

  • Bug fix
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Host or runtime integration

Technical Direction

Existing C1 caller migration; no new roadmap identity.

Shared-authority RFC fixture impact

No authority-store, provider routing or persisted fixture schema change. Existing TS owner exercised; no storage promotion or backend rehearsal claimed.

Boundary Checklist

  • Public-safe diff/body; no private state, raw traces, credentials, internal links or local paths.
  • Existing benchmark work/frozen treatments are unchanged.
  • Scoped to the actual C1 qualification-consumer gap.
  • Both RFC languages changed; exact-head bilingual check passed.
  • UI impact none.
  • Every commit includes DCO sign-off.

@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 · Gemini · Google (self_reported)

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

已针对 PR #8981 exact head 8720ced7dcddc8580dc83ff9c83c90f836465cd3 完成独立代码审查、RFC 规范核对、双语检查与对抗验证(审查结论:APPROVE,无 P0/P1/P2 阻断问题;本 PR 为作者自有 PR,依据规则以 COMMENTED 形式发布审查结论)。

动机 / Motivation

受影响调用方与运维者:执行发布前 Opt-In 模型决策资格探针 scripts/qualify-host-prompt-release.py(调用 loopx.control_plane.testing.host_prompt_behavior.cases / run_probe)的发布验证人员,以及运行动作组合场景校验器 loopx/control_plane/testing/action_portfolio_scenarios.py::validate_external_wait_fallback_scenario 的测试与控制面维护者。

修改前(3c03e91e67):虽然普通 C1 入口切换已合并主干,但发布资格探针 host_prompt_behavior.cases() 的 wait_fallback_work 仍通过旧压缩适配器 compact_quota_should_run_cli_payload(external_wait_fallback_scenario_source()) 生成输入(且在 run_probe 中对 thin 与 brief 模式重复构造 cases()),导致传入模型的 packet 退化为无 schema_version / 无 contract_binding 的旧压缩包(33,331 字节);同时场景校验器 validate_external_wait_fallback_scenario 也额外重新构建该旧压缩包读取 suggested_actions。修改后(8720ced7dc):host_prompt_behavior.cases() 改由既有 TypeScript 组合 owner compose_turn_decision(..., composed_settlement=True) 直接产出完整 C1 契约包(loopx_turn_envelope_v1、contract_binding 哈希绑定、38,105 字节,较旧包增加 4,774 字节保留完整任务与停止文本),run_probe 每批复用同一份已校验的 probes = cases() 喂给 thin 与 brief 模式,validate_external_wait_fallback_scenario 直接读取已校验来源组合 portfolio.get("suggested_actions");并同步更新中英文 RFC 附录及 docs/development/testing-and-quality.md。

可观测结果:本地复现显示 scripts/check_rfc_bilingual.py --base origin/main --head HEAD 通过;ruff check(3 Python 文件)与全仓 mypy(17 源码文件)0 错误;test_host_prompt_behavior.py、test_actual_default_model_behavior_portfolio.py 与 test_quota_action_portfolio.py 合计 74 passed in 92.39s(含新增完整长任务/长停止文本回归及两项保留版本/空绑定在调起模型回调前触发 EffectRuntimeRejected 的负例,且已知 test_turn_envelope_settlement.py 等 25 项旧 v0 / quota_presentation.build_turn_envelope 失败经对照实测在干净 origin/main@3c03e91e67 上以完全相同报错复现,与本 PR 无关);scripts/qualify-host-prompt-release.py 保持默认关闭(status=skipped, release_opt_in_required, provider_call_count=0)且缺失凭据不误判为通过(status=skipped, provider_credential_unavailable, provider_call_count=0);对抗字节数对照实测 old_compact(33,331 B,无 contract_binding)对比 new_case(38,105 B,loopx_turn_envelope_v1,thin 41,206 -> 46,318 B、brief 42,513 -> 47,625 B);canary premerge --tier quick 全部 3 项 selected checks 通过(failures=0),loopx check --scan-path ...(6 文件)公开边界扫描干净(errors=0)。

非目标边界:本 PR 仅迁移发布资格探针与场景校验器这两个验证消费者,不改变普通生产 CLI/Turn 写回路径、不新增协议版本自动协商开关、不修改其余 4 组独立合成对照与冻结 raw/v0 语料,亦不宣称已对真实线上模型推理或已安装 Host 端完成资格认证。

改动思路 / Approach

架构与放置判断:发布探针与动作组合场景校验器直接复用既有 TypeScript compose_turn_decision owner,Python 侧不重复实现或分支任何包格式,双语 RFC 与测试文档仅忠实说明边界而不改写原有目标。(严格对照变更前提交 3c03e91e6736f129d78e7c895b9d4a871f132a7f 的规范文本评审,确认同步修订的中英文 RFC 附录忠实记录迁移边界而未弱化既有契约)。

当前 PR 边界:仅切换 host_prompt_behavior.py 与 action_portfolio_scenarios.py 的输入源并对齐对应 RFC 段落与 testing-and-quality.md 发布指引,不触及普通生产入口及无凭据实机推理。

具体改动 / Changes

依据规范 docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md(基准修订 3c03e91e6736f129d78e7c895b9d4a871f132a7f)对本次 6 文件(+87 / -8)迁移核对如下:

  • C1-SOURCE-AUDIT-PORTFOLIO(implemented):host_prompt_behavior.py 与 validate_external_wait_fallback_scenario 均切回单一完整来源 owner,由 test_host_prompt_behavior.py 等 74 passed in 92.39s 验证。
  • C1-UNKNOWN-SEMANTICS-REFUSAL(implemented):经 compose_turn_decision 拒绝未知 schema_version / 空 contract_binding,并由 test_unknown_source_binding_is_rejected_before_provider_call 验证在调用模型前以 EffectRuntimeRejected 失败且 provider_call_count == 0。
  • C1-ONE-FORMAT-NO-AUTO-NEGOTIATION(implemented):run_probe 复用同批 probes = cases() 投喂 thin/brief 且不保留旧格式切换开关,validate_external_wait_fallback_scenario 直接检查完整来源 portfolio。
  • C1-DEFERRED-LIVE-MODEL-AND-HOST(deferred):真实线上模型调用(需外部 ARK_API_KEY 与 --release-live)及已安装 App/Host 端到端行为超出无凭据离线脚本与合成测试边界,仍由既定 C1 后续发布流程与 #8963 工厂清理承接。

改动文件清单:

  1. loopx/control_plane/testing/host_prompt_behavior.py(+6 / -3,共 113 行):移除 compact_quota_should_run_cli_payload,cases() 调用 compose_turn_decision(external_wait_fallback_scenario_source(), composed_settlement=True),并在 run_probe() 外部缓存 probes = cases() 供 thin/brief 共享。
  2. loopx/control_plane/testing/action_portfolio_scenarios.py(+2 / -5,共 448 行):移除 compact_quota_should_run_cli_payload 构造,改为直接读取 portfolio.get("suggested_actions") 并更新异常说明为 from the complete quota source。
  3. tests/control_plane/test_host_prompt_behavior.py(+56 / -0,共 178 行):新增 test_fallback_probe_delivers_one_complete_source_to_both_prompt_modes(60x 重复中文验收/停止长文本)与 test_unknown_source_binding_is_rejected_before_provider_call(参数化未知版本/空绑定在模型调用前拒绝)。
  4. docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md(+11 / -0)与 contract-and-context.zh-CN.md(+7 / -0):成对记录发布探针迁移与非目标边界,双语校验通过。
  5. docs/development/testing-and-quality.md(+5 / -3):同步说明回退探针改用 TypeScript 完整 C1 来源而非旧压缩投影。

关键代码讲解

  1. cases / run_probe(loopx/control_plane/testing/host_prompt_behavior.py:48-96):第 48-54 行用 compose_turn_decision(..., composed_settlement=True) 构造完整 loopx_turn_envelope_v1 包作为 wait_fallback_work 探针载荷;第 88-92 行在循环外一次性求值 probes = cases(),保证同一批次下 thin 与 brief 接收完全一致且已过源校验的契约包。
  2. validate_external_wait_fallback_scenario(loopx/control_plane/testing/action_portfolio_scenarios.py:358-392):直接从已解包的 quota_action_signature_document(source_packet)["action"]["action_portfolio"] 读取 suggested_actions,消除对旧压缩函数 compact_quota_should_run_cli_payload 的冗余重建,同时继续校验 todo_external_wait_fallback、recommended_action 与 todo_external_wait_primary 阻塞条件。

对主干的风险 / Risks

  • 无阻塞性 P0/P1/P2 问题:经全仓搜索确认除刻意保留的独立旧压缩测试与文档外,发布探针与动作组合场景已无剩余旧压缩残留调用方;残余非阻塞观察包括:真实线上模型推理需注入 ARK_API_KEY 手动执行 --release-live 才能覆盖,在多默认 runtime root 机器上裸调用 probe_messages() 仍依赖测试/脚本设置 HOME 隔离(实测本机无隔离调用触发既有多 root 冲突提示),且远端 8 项 QUEUED 与 6 项 PENDING CI 作业尚待完成。

我的整体评价 / Verdict

改动准确、克制且直指残留验证消费端漂移:在不增加任何兼容开关或 Python 重复决策规则的前提下,让发布前模型决策探针与情景校验器复用既有的 TypeScript 完整 C1 契约,配合双语 RFC 同步与长文本/未知绑定负例测试覆盖完整。visual_review:not_applicable(原因:仅变更 host_prompt_behavior.py、action_portfolio_scenarios.py 与 RFC/测试文档,无前端或渲染 UI 变更。;未验证范围:none)。因本 PR 为作者自有提交且部分远端 CI 仍处于排队/待运行状态,合并前需待远端 CI 全绿及维护者明确授权。

English verdict: Approve exact head 8720ced (author-owned COMMENTED approval review); cleanly migrates the release host-prompt probe (host_prompt_behavior.py) and external-wait validator (action_portfolio_scenarios.py) from the legacy compact carrier to the existing TypeScript complete-source owner (compose_turn_decision) with paired bilingual RFC/doc updates and negative unknown-binding coverage, verified by RFC bilingual diff check, ruff, 17-file mypy, 74 passed prompt/portfolio pytest tests, release script default-off/missing-credential checks, exact old-vs-new packet byte counterfactuals, and passing quick premerge canaries (failures=0); merge remains subject to remote CI completion and maintainer authorization.

@mergify

mergify Bot commented Nov 19, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 19, 2026
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/c1-host-prompt-source-20261118t023305 branch from 8720ced to f9cb71d Compare November 19, 2026 15:08
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 19, 2026

@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 · Gemini · Google (self_reported)

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

已针对 PR #8981 变基后的 exact head f9cb71d1b8a6053d25931a0f3f7195537b8b6ff7(基于 origin/main@ff905437669054465a4d7aa8c70ba3396aaf9182)完成完整独立审查、规范核对、对抗字节对照与本地全量门禁验证(审查结论:APPROVE,无 P0/P1/P2 阻断问题;因本 PR 为作者自有 PR,GitHub 限制形式自批,故按仓库规则以 COMMENTED 形式发布审查结论)。

动机 / Motivation

受影响调用方与运维者:执行发布前 Opt-In 模型决策探针脚本 scripts/qualify-host-prompt-release.py(调用 loopx.control_plane.testing.host_prompt_behavior.cases 与 run_probe)的发布验证人员,以及运行动作组合场景校验器 loopx.control_plane.testing.action_portfolio_scenarios.validate_external_wait_fallback_scenario 的控制面维护者。

修改前后场景:修改前,尽管普通 C1 入口切换已合并主干,发布资格探针 cases() 中的 wait_fallback_work 仍通过旧压缩投影函数 compact_quota_should_run_cli_payload 构造输入(且 run_probe() 对 thin 和 brief 两种提示模式各重新构造一次 cases()),导致传入模型的 packet 退化为不含 schema_version 与 contract_binding 的旧压缩包(实测 33,336 字节),截断长任务或停止条件正文并绕过完整源绑定校验;同时场景校验器 validate_external_wait_fallback_scenario() 也额外重新构造旧压缩包读取 suggested_actions,引入重复投影维护成本。修改后,cases() 直接复用既有 TypeScript 组合 owner compose_turn_decision(..., composed_settlement=True) 生成带有 loopx_turn_envelope_v1 与 contract_binding 的完整 C1 契约包(实测 38,110 字节,较旧压缩包多保留 4,774 字节完整任务与停止正文),run_probe() 在循环外一次性求值 probes = cases() 供 thin 与 brief 共享,校验器改为直接读取已解包的来源 portfolio.get("suggested_actions");此外在变基冲突解决时,同步保留了主干 #9072 后的文档上下文并补全了 docs/development/testing-and-quality.md 中被截断的中文边界从句(与后续修复方向一致)。

可观测结果:本地复现验证显示新增完整长任务/长停止文本回归及保留版本/空绑定在模型调用前触发 EffectRuntimeRejected 拒绝的负例全部通过,test_host_prompt_behavior.py(12 passed)及关联组合/规划/Turn Envelope 套件合计 164 项测试全部通过,公开边界扫描(6 文件)与标准 premerge canary 11 项执行检查 0 失败。

非目标边界:本 PR 仅迁移上述两处测试与发布资格校验消费端,不修改普通生产 CLI/Turn 写回路径、不新增格式自动协商开关、不改动其余 4 组独立合成小对照与冻结 raw/v0 语料,也不宣称已完成实机 live 模型或已安装 App/Host 端到端验收。

遗留缺口:在携带真实凭据下运行 --release-live 实机模型推理、已安装 App/Host 端采用与完整成本收益评估,以及 #8963 未用工厂清理仍留待既定后续工作承接。

改动思路 / Approach

架构决策与所有权放置:在保持 Python 仅承担探针组装、校验适配器与测试场景夹具的前提下,完整 C1 契约组合与 schema_version/contract_binding 完整性校验继续完全归属既有 TypeScript owner(turn_envelope.ts 中的 composeCompleteTurnDecision 与 requireCompleteTurnDecision,经 Python 传输适配器 compose_turn_decision 调用)。不新增兼容格式开关,也不在 Python 侧复制包装或校验规则;action_portfolio_scenarios.py 直接读取来自 quota_action_signature_document(source_packet) 的 portfolio["suggested_actions"],彻底消除对 compact_quota_should_run_cli_payload 的冗余依赖。经全仓搜索,除故意保留的 cli_projection.py 定义及专项压缩投影单元测试外,loopx/control_plane/testing/ 与 scripts/ 下已无其它残留调用方。

当前 PR 边界(current_pr_boundary):仅包含测试探针与场景校验器输入源迁移、长正文与未知绑定回归测试及对应双语 RFC/测试指南边界说明;在 compose_turn_decision 校验未知 schema_version 或篡改 contract_binding 失败时直接以 EffectRuntimeRejected 快速失败,确保模型 client.next_final_content 在源无效时零调用。本 PR 对所有行为载体均有真实测试与本地门禁覆盖,所有独立验证(单元测试、对抗构造、静态与 canary)均在当前 head 上重新实测。

具体改动 / Changes

依据基准规范 docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md(审前主干基线修订 ff905437669054465a4d7aa8c70ba3396aaf9182,以及主 RFC 第 9 节与「C1 caller replacement and cutover unit」规范)对本次 6 文件(+88 / -12)变更逐项核对:

  • C1-QUALIFICATION-CONSUMER-COMPLETE-SOURCE(implemented):host_prompt_behavior.py 中 cases() 与 run_probe() 改由 compose_turn_decision 生成并共享一份 loopx_turn_envelope_v1 实例,由 test_fallback_probe_delivers_one_complete_source_to_both_prompt_modes 与 test_host_prompt_behavior.py(12 passed)验证。
  • C1-SCENARIO-VALIDATOR-SOURCE-PORTFOLIO(implemented):action_portfolio_scenarios.py 直接校验 portfolio.get("suggested_actions"),由 test_actual_default_model_behavior_portfolio.py、test_quota_action_portfolio.py(合计 62 项 + host_prompt_behavior 12 项 = 74 passed)及篡改 continuation_hint 负例验证。
  • C1-UNKNOWN-SEMANTICS-REFUSAL(implemented):未知 schema_version 或非空篡改 contract_binding 由 compose_turn_decision 转发至 TS composeCompleteTurnDecision 在调起模型回调前以 EffectRuntimeRejected 拒绝,由 test_unknown_source_binding_is_rejected_before_provider_call 验证 client.count == 0。
  • C1-LIVE-MODEL-AND-HOST-ADOPTION(deferred):真实线上 ARK_API_KEY --release-live 模型决策执行与已安装 App/Host 端运行态采用超出无凭据离线脚本与合成夹具边界,仍由发布前手工 Opt-In 与既定 C1 后续交付承接。

此外,PR 同步增补了 contract-and-context.md(+11)与 contract-and-context.zh-CN.md(+7)一段并修订 docs/development/testing-and-quality.md(+6 / -4),经对比基线提交 ff905437669054465a4d7aa8c70ba3396aaf9182,上述文档新增段落如实界定了「迁移探针输入但未证明实机模型与已安装 Host 采用」的非目标范围,未弱化任何既有 C1 契约义务。

关键代码讲解

  1. cases(loopx/control_plane/testing/host_prompt_behavior.py:15-55):前 4 组独立小对照(quiet_work、notifying_wait、quiet_wait、vision_replan)保持合成输入不变;第 5 组 wait_fallback_work 改用 compose_turn_decision(external_wait_fallback_scenario_source(), composed_settlement=True) 生成完整 loopx_turn_envelope_v1 契约包,保留完整 selected_todo.text、goal_boundary.stop_condition 与 contract_binding 摘要。
  2. run_probe(loopx/control_plane/testing/host_prompt_behavior.py:85-113):在 for mode in ("thin", "brief") 循环外一次性求值 probes = cases(),确保每批探针中 thin 与 brief 接收逐字节一致的同一份已校验契约实例(client.fallbacks[0] == client.fallbacks[1]),并在内部源版本/绑定非法时于首次调用 client.next_final_content 前失败退出。
  3. validate_external_wait_fallback_scenario(loopx/control_plane/testing/action_portfolio_scenarios.py:358-392):删除对 compact_quota_should_run_cli_payload 的局部重投影,直接读取来自 quota_action_signature_document(source_packet)["action"]["action_portfolio"] 的 suggested_actions 并校验 todo_external_wait_fallback 与 continuation_hint,保留其余全部 P0 resume_blocked_items 与 monitor_changed 校验,仅更新异常提示尾句为 from the complete quota source。
  4. test_fallback_probe_delivers_one_complete_source_to_both_prompt_modes 与 test_unknown_source_binding_is_rejected_before_provider_call(tests/control_plane/test_host_prompt_behavior.py:86-134):构造 60x 重复中文验收与停止条件长文本,验证 thin/brief 收到完全一致且通过 assert_complete_turn_decision 校验的未截断正文(10 次回调零泄露);参数化注入 schema_version="unknown_source_version" 与 contract_binding={},验证在触发任何模型回调前抛出 EffectRuntimeRejected(client.count == 0)。

对主干的风险 / Risks

  • 无阻断性 P0/P1/P2 问题:
    • 测试与对抗验证(PASS):tests/control_plane/test_host_prompt_behavior.py(12 passed in 2.33s)、test_host_prompt_behavior.py + test_actual_default_model_behavior_portfolio.py + test_quota_action_portfolio.py(74 passed in 118.66s)、test_quota_planning_horizon.py(11 passed in 7.47s)以及 test_turn_envelope_budget_warning.py + test_turn_envelope_capability_facts.py + test_turn_envelope.py(79 passed in 51.00s)共 164 项去重用例全部零跳过、零失败通过;对抗篡改 suggested_actions[0]["continuation_hint"] 时 validate_external_wait_fallback_scenario 按预期抛出 ValueError;旧紧凑包(33,336 B,无 schema_version/contract_binding,thin 41,197 B / brief 42,504 B)与新完整包(38,110 B,loopx_turn_envelope_v1,thin 46,309 B / brief 47,616 B)对比差值精确为 +4,774 B。
    • Opt-In 隔离(PASS):实测 scripts/qualify-host-prompt-release.py 默认关闭(status=skipped, reason=release_opt_in_required, provider_call_count=0),显式 --release-live 在无 ARK_API_KEY 时返回 status=skipped, reason=provider_credential_unavailable, provider_call_count=0,未发生隐式模型调用或误判通过。
    • 静态与 premerge 门禁(PASS):ruff check 3 项 Python 文件全通过;配置 mypy 17 项严格检查全通过(另注:未纳入 pyproject.toml 严格列表的 host_prompt_behavior.py 存在既有无参泛型 dict 注解提示,未新增问题);scripts/check_rfc_bilingual.py --base origin/main --head HEAD 通过;git diff --check 通过;loopx check --scan-path ...(6 文件)errors=0;loopx canary premerge --tier standard --from-git-diff --git-diff-base origin/main(在临时关联根目录 node_modules 运行后立即解链)全部 6 项 direct checks 与 11 项 selected checks 执行通过(failures=0,其中 control-plane-maintainability-ratchet-smoke.py 报告 1 项未触及文件 loopx/control_plane/work_items/interaction_contract.py 的既有基线 advisory_inherited_failure)。
    • 基线无关失败对照(PASS 对照):补充运行 tests/cli_commands/test_quota_turn_envelope_validation_failure.py 时,test_turn_envelope_renders_typed_failure_when_context_preparation_fails[True] 失败(1 failed, 1 passed),经在不可变 origin/main@ff905437669054465a4d7aa8c70ba3396aaf9182 上以完全相同测试独立复现,报错特征完全一致(AssertionError: assert (None or None == 'turn_envelope')),确认系主干既有无关失败。
    • 非阻塞观察:在同时存在双默认运行态目录的机器上无 HOME 隔离直接调用 probe_messages() 仍会命中既有多 root 路由拒绝(测试及常规 CLI 已通过临时目录或显式 --runtime-root 隔离);真实线上 ARK_API_KEY --release-live 模型推理与远端 CI 状态(wait_for_ci=false,未轮询)仍留待发布执行与合并前门禁独立确认。

语义与 CI 对齐

本次改动复用既有契约标识 COMPLETE_TURN_DECISION_VERSION(loopx_turn_envelope_v1)与 TS 组合 owner compose_turn_decision(reuse_existing),未新增、扩展或叉分任何语义词汇或状态枚举;examples/semantic-vocabulary-drift-smoke.py 在标准 premerge 门禁中执行通过(0 失败),双语 RFC 校验与公开边界检查全部通过。

我的整体评价 / Verdict

变基干净、范围精准且直接消除了发布资格探针与动作组合场景校验器中残留的旧压缩包消费漂移:在完全复用既有 TypeScript compose_turn_decision 权威与保留 probes = cases() 批内共享的前提下,确保长任务与停止条件正文及保留绑定拒绝语义均被严格验证,且完整保留了 origin/main 近期文档与控制面更新。

  • 长程与用户体验影响(outcome_impact):long_horizon 判定为 preserved(仅迁移测试/发布探针输入并保留既有长任务/停止条件正文与前向拒绝边界,不改变普通生产调度、续跑或预算结算);user_experience 判定为 not_applicable(仅变更内部测试探针模块与 RFC/开发文档,不涉及 CLI 交互流程、配置或前端界面)。
  • 视觉检查(visual_review):not_applicable。仅修改后端测试与发布探针模块(loopx/control_plane/testing/host_prompt_behavior.py、action_portfolio_scenarios.py、tests/control_plane/test_host_prompt_behavior.py)及 RFC/测试文档,无前端渲染页面、CLI 交互界面或视觉布局变更。;未验证范围(unverified_scope):none(无渲染界面涉入)。
  • 可观测语义与代码体量:通过基线 vs head 字节/契约对照(33,336 B -> 38,110 B,+4,774 B)与长中文任务/停止回归、未知版本绑定拦截及篡改 continuation_hint 负例验证了 observable_semantics(intentional_change_validated,含文本变更授权依据);code_volume 为 necessary(净增量主要来自 2 个精确回归用例,兼容评估判定 compatibility_assessment: not_applicable);change_proportionality 为 proportionate,architecture_assessment 为 retain;default_off_isolation 为 isolated;authority_semantics 为 aligned;semantic_alignment 为 aligned(reuse_existing)。
  • 残余风险与时效性:以上所有验证均直接执行于远端最新 exact head f9cb71d1b8a6053d25931a0f3f7195537b8b6ff7;因本 PR 为作者自有提交且未查询远端 CI,保持 PR 为 OPEN 状态待维护者进一步调度合并。

English verdict: APPROVE exact head f9cb71d (author-owned COMMENTED approval review); cleanly rebased onto origin/main@ff90543766 and verified that host_prompt_behavior.py and action_portfolio_scenarios.py reuse the existing TypeScript compose_turn_decision complete-source owner and source portfolio without adding format switches, backed by 164 passing unit/portfolio/envelope tests (plus base-matched pre-existing failure check on test_quota_turn_envelope_validation_failure.py), default-off/no-key release probe checks, old-vs-new counterfactual byte deltas (+4,774 B), ruff/mypy/RFC bilingual/public-boundary checks, and standard canary premerge (11/11 selected checks passed, 0 failures).

This branch has not been deployed

No deployments
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.

1 participant