Skip to content

Define the verifier Hook co-design contract - #9262

Merged
huangruiteng merged 8 commits into
mainfrom
codex/verifier-hook-co-design-20261122
Nov 27, 2026
Merged

huangruiteng merged 8 commits into
mainfrom
codex/verifier-hook-co-design-20261122

Conversation

@huangruiteng

@huangruiteng huangruiteng commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Current review scope

Rebased cleanly onto latest origin/main (a9c275052a54076cfd2e2fb15271a121e20c2360) and resolved all remaining [P1]/[P2] review threads at exact head 1a4253e8d8a63446330f5482ef96751c5cd97dc8:

  • Type-only contract + executable fixture isolation: loopx/control_plane/turn_driver/verifier_hook_contract.ts defines the type-only contract (QuotaGoalBoundaryReference from turn_envelope.ts, WorkYardstickProfile reuse, and canonical sha256:<64 lowercase hex> candidate_sha), while tests/control_plane_ts/fixtures/verifier_hook_contract.ts exercises negotiation (L0–L2 + explicit pre_tool_use), scope/role bindings, and KeepRaw fail-closed guards.
  • Unreadable & wrong-kind reader handling (EACCES, EPERM, EISDIR, ENOTDIR, ENOENT): updated readAvailable in tests/control_plane_ts/fixtures/verifier_hook_contract.ts and synced RFC §3/§5 (verifier-hook-co-design-v0.md & .zh-CN.md) so missing, permission-denied, and wrong-kind filesystem lookups at both readReceipt and readEvidence resolve cleanly to unavailable (KeepRaw), while parse (SyntaxError) and programmer (TypeError) failures remain thrown.
  • RFC governance & index sync: regenerated docs/architecture/rfcs/STATUS.md and STATUS.zh-CN.md on top of current origin/main and kept Delivery on main / Current boundary explicit in docs/architecture/rfcs/README.md.

Current validation (Exact Head 1a4253e8d8a63446330f5482ef96751c5cd97dc8)

  • npm run typecheck:control-plane: passed (0 errors)
  • node --no-warnings --experimental-sqlite --experimental-strip-types --test (verifier_hook_contract.test.ts, content_digest_single_owner.test.ts, turn_envelope.test.ts, context_delivery.test.ts, native_context_lifecycle.test.ts): 143 passed, 0 skipped, 0 failed, including real ENOENT, EACCES (chmod 0o000), EISDIR, ENOTDIR, readable-file FoldToReceipt, SyntaxError, and TypeError checks across both reader levels
  • scripts/generate_rfc_status_index.py --check, scripts/check_rfc_bilingual.py --base origin/main --head HEAD, and examples/docs-governance-smoke.py: passed
  • loopx check --scan-path ... (all 9 changed files): errors=0, warnings=0, public boundary scan clean: 9 files
  • Goal loopx change-quality verify --goal-id <goal-id> --base-ref origin/main: ok: true, status: "valid", receipt_id: "cqr_0f513500ef3455ce938b", decision: "pass"
  • Goal loopx canary premerge --from-git-diff --git-diff-base origin/main --goal-id <goal-id> --tier standard:
    • direct_checks: 4/4 passed
    • catalog_canaries: 9/9 passed, failure_count=0
    • risk_profile_smokes: 8/8 passed, failure_count=0
    • boundary_run: 1/1 passed (public boundary scan)
    • Overall gate status: passed (merge_gate_passed: true, failure_count: 0, manual_hold_count: 0)

Left OPEN per maintainer workflow; no auto-merge. Native host adoption, real matched model outcomes, cache, and full-cost measurements remain queued for subsequent implementation PRs.

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

动机 / Motivation

在长程求解任务中,控制面与宿主维护者在启用多轮探索与独立验收时,往往只能在粗糙的 Stop-Hook 兜底验证与同步逐工具拦截之间二选一;缺乏跨宿主的四边界验证 Hook 协同契约,也缺乏“子作用域须经独立 Oracle 回执且满足低重叠后才折叠”的 VerifiedClose 约束,因此本 PR 试图把验证接入收敛到既有 C1 与历史上下文边界之下。

如果不做任何改动,外部宿主(如 Codex、Claude Code、DSH、Antigravity)上的验证探测、子作用域折叠以及领域快尺(yardstick)试跑仍各自依赖局部协议或散落脚本,既难对齐能力协商档位,也容易让未验证的代理结果或跨作用域回执污染主干上下文。

  • 受影响对象(affected_caller_or_operator): 接入宿主 Hook 生命周期(启动、里程碑、压缩/子作用域与停止边界)并消费独立验收回执的 LoopX 控制面、宿主适配器与实验评估维护者。
  • 前后对比场景(before_after_scenario): 改动前,不同宿主各自实现启动上下文恢复、里程碑采样、压缩后恢复与停止验收,子工作折叠与快尺试跑缺少统一的不变式边界;理想改进是先建立双语架构提案再沿真实拥有者接线,而当前 PR 在没有任何生产调用方的情况下提前向控制面运行时放入未接线的 TypeScript 契约文件,且新增 RFC 头部未满足仓库治理检查,导致主干 docs-governance-smoke.py 与 generate_rfc_status_index.py --check 从基线通过退化为失败。
  • 可观测结果(observable_outcome): 文档侧新增了四边界能力协商(L0–L2)、VerifiedClose(FoldToReceipt / KeepRaw)及领域插件试跑的中文/英文双语提案;代码侧新增了纯内存/纯类型的 verifier_hook_contract.ts 及其 3 条单元测试,但尚未接入任何生产入口(turn_driver、progressive_context.ts、goal_capability_organization.ts 或宿主插件),同时 recommendVerifiedClose 在空身份与空引用输入下仍会误返回 FoldToReceipt。
  • 非目标(non_goals): 本次变更不改变 C1 准入、传输或结算所有权,不实现具体宿主适配器(Codex、DSH、Claude Code、Antigravity)运行时代码,不启用新默认开关,也不开展跨宿主或同宿主模型效果/缓存对照实验。

改动思路 / Approach

从控制面所有权看,本 PR 提出了一个跨宿主验证 Hook 协商与子作用域验证折叠的设计方案:策略默认关闭(enabled !== true 返回 null),启用后按宿主实际观测能力协商 L0 / L1 / L2,并坚持 pre_tool_use 默认关闭、只有策略显式开启且宿主观测到对应能力时才激活;在子作用域结束时,由 recommendVerifiedClose 比对外部 Oracle 回执的六元组身份与 verdict、open_obligations、overlap,决定 FoldToReceipt 或 KeepRaw。

然而从架构与比例性(architecture_assessment)角度拆解现有机制,本次提交把“尚未落地的 RFC 设计”与“过早进入生产目录的未接线 TypeScript 源码”混在了同一个 PR 中:verifier_hook_contract.ts 的两个纯函数与 12 个仅作类型声明的导出没有任何生产调用方,FoldToReceipt / KeepRaw 脱离了既有的上下文策略拥有者 progressive_context.ts 与 context_delivery.ts,DomainPluginTrial 则与既有的能力组合/改进规划拥有者 goal_capability_organization.ts 平行另立一套阶段类型,且边界函数缺少仓库通行的 runtime_decode 非空校验;当前 PR 应先修正 RFC 治理头与索引、移除尚未接线的生产 .ts 雏形(或完整接到真实调用链并修复校验与所有权归属),不应把无调用方的孤立契约代码合入 loopx/control_plane/turn_driver/。 当前 PR 边界(current_pr_boundary):仅建议保留且修全双语 RFC 设计与目录索引,或将代码切片收口为带真实调用方和边界解码的最小端到端变更;在未完成接线与验证前,宿主适配器接入、真实缓存收益测量和生产开关均保留在后续切片。

与既有实现对比,仓库在 loopx/control_plane/quota/progressive_context.ts 与 docs/architecture/rfcs/history-working-set-context-policy-v0.md §5.1 中已明确将 KeepRaw / FoldToReceipt / EpochReset 归属为共享 TypeScript 投影拥有者;在 loopx/control_plane/capabilities/goal_capability_organization.ts 中已实现 goal_capability_improvement_plan_v0 及 planCapabilityImprovement 试跑—反馈—回滚追踪;在 loopx/control_plane/work_items/yardstick_decision.ts 中已实现 WorkYardstickProfile 与 proxy_order_reversed 判定;在 loopx/control_plane/capability_hooks.ts 与 post_writeback_hook_transaction.ts 中已有标准 Hook 注册与事务边界。本 PR 仅复用导入了 WorkYardstickProfile 一个类型,其余均处于未接线状态。

提案边界 RFC 设计职责 本 PR 代码覆盖现状 既有所属拥有者
Start / resume 在真实恢复/换阶段交付有界求解视图 仅类型 VerifierHookEvent(无实现) progressive_context.ts / turn_start Hook
Milestone probe 异步采样并回传平台期/快尺反转 仅联合类型 VerifierTransition(无实现) yardstick_decision.ts / stride_policy.ts
Compaction / subscope 独立 Oracle 回执门控 FoldToReceipt / KeepRaw 纯函数 recommendVerifiedClose(无调用方) history-working-set-context-policy-v0.md §5.1 (progressive_context.ts)
Stop / Domain plugin 独立 Oracle 验收及内容寻址试跑准入 DomainPluginCandidate/DomainPluginTrial 仅类型(无调用方) settlement.ts / goal_capability_organization.ts

具体改动 / Changes

本次精确审查头 8a6fa6c68ea8745325b615e668fb5caa26811295 相对 origin/main(d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d)共新增/修改 5 个文件(+331 / -0):

  1. 文档与索引(3 个文件,+116/-0): 新增 docs/architecture/rfcs/verifier-hook-co-design-v0.md(57 行)和中文镜像 docs/architecture/rfcs/verifier-hook-co-design-v0.zh-CN.md(57 行),并在 docs/architecture/rfcs/README.md 第 204–205 行添加条目链接;但未运行 scripts/generate_rfc_status_index.py --write 更新 STATUS.md / STATUS.zh-CN.md。
  2. 控制面 TypeScript 源码(1 个文件,+142/-0): 新增 loopx/control_plane/turn_driver/verifier_hook_contract.ts。
  3. TypeScript 单测(1 个文件,+73/-0): 新增 tests/control_plane_ts/verifier_hook_contract.test.ts,也是全仓唯一导入 verifier_hook_contract.ts 的文件。

关键代码讲解

  • negotiateVerifierHooks(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L19-L32): 读取 VerifierHookPolicy 与可选 HarnessVerifierCapabilities。当 policy.enabled !== true 时返回 null;当启用后,仅当 session_lineage === true && boundary_context === true 时进入 L1,并在同时满足 milestone_observation && isolated_subscope && verified_return 全为 true 时升级为 L2,否则退化为 L0;pre_tool_use 仅在策略与宿主观测能力双双显式为 true 时才返回 true。当前无生产调用方,也未做运行时对象解码校验。
  • recommendVerifiedClose(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L101-L128): 根据 VerifiedCloseRequest 与调用方注入的 readVerifierReceipt 读取回执。先比对 receipt?.identity 的 6 个字段与 request.identity 是否逐一全等,不匹配或缺失则返回 KeepRaw;receipt.verdict === "failed" 时返回带 counterexample_ref 的 KeepRaw;仅当 verdict === "passed"、open_obligations === false 且 overlap === "low" 时返回 FoldToReceipt。缺陷在于只做全等比较而不校验身份或引用是否非空/合法,空字符串也能通过折叠条件。
  • VerifierTransition 与 VerifierHookEvent(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L48-L65): 定义了 completion_claim、yardstick_plateau_or_regression、proxy_order_reversed 和 protected_boundary_touch 四类转移与四边界事件结构,但 VerifierHookEvent 仅在 boundary === "stop" 分支引用了 completion_claim,其余三类转移与 VerifierSolverView 在当前分支没有任何生产者或消费者。
  • DomainPluginCandidate 与 DomainPluginTrial(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L130-L142): 声明了 yardstick / diagnostic_probe / verification_recipe 候选产物及 staging / trial / adopted / retired 四态联合类型,但未绑定 verifier_version 或作用域,也没有关联或复用既有拥有者 goal_capability_organization.ts。

规范基线映射(spec_basis)

依据基线 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d 上的规范入口 docs/architecture/rfcs/README.md(以及其引用的 docs/development/README.md Scope-Fit Review 与 history-working-set-context-policy-v0.md §5.1)逐项映射当前 HEAD:

  • RFC-INDEX-HEADER -> not_met:docs/architecture/rfcs/README.md 要求合入 RFC 使用 Accepted 生命周期值、声明 Supersedes / closes、携带 semantic mirror / 语义镜像 互链并通过 generate_rfc_status_index.py --write 同步 STATUS.md;当前 HEAD 使用 Proposed、缺少 Supersedes / closes 与 semantic mirror / 语义镜像 字样且未更新状态索引,README.md 新条目亦缺少 Delivery on main / Current boundary 说明。
  • RFC-BILINGUAL-PAIR -> implemented:docs/architecture/rfcs/README.md 要求英文与中文镜像在同一 PR 成对变更并通过 scripts/check_rfc_bilingual.py --base origin/main --head HEAD(本地实测 PASS)。
  • RFC-MATURITY-SEPARATION -> not_met:docs/architecture/rfcs/README.md 要求严格区分设计提案与已实现边界(且 docs/development/README.md 要求新增控制面模块必须有真实生产调用方并复用既有拥有者);本 PR 将无生产调用方的 TypeScript 模块放入 loopx/control_plane/turn_driver/ 并在 RFC 头部标注 Delivery maturity: TypeScript contract,同时未接入 history-working-set-context-policy-v0.md §5.1 的 progressive_context.ts 拥有者。

对主干的风险 / Risks

阻塞发现(Findings)

  1. [P1 · 阻塞] RFC 生命周期头、镜像声明与派生索引破坏仓库文档治理检查

    • Problem: 新增 RFC 头部违反了仓库 RFC 索引与双语治理规范,导致基线原本通过的门禁脚本在 HEAD 上直接失败。
    • Evidence: 在同一本地环境对比基线 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d 与 HEAD 8a6fa6c68ea8745325b615e668fb5caa26811295:基线运行 scripts/generate_rfc_status_index.py --check 和 examples/docs-governance-smoke.py 均退出 0(docs-governance-smoke ok);HEAD 上 generate_rfc_status_index.py --check 退出 1,报错 verifier-hook-co-design-v0.md: status 'Proposed' does not begin with a lifecycle state (Accepted, Superseded, Retired, Rejected) 及 missing '**Supersedes / closes:**' declaration;examples/docs-governance-smoke.py 在 check_rfc_language_mirrors() 第 202 行因缺少 "semantic mirror" 抛出 AssertionError: verifier-hook-co-design-v0.md(且中文镜像第 203 行同样缺少 "语义镜像")。此外 docs/architecture/rfcs/README.md 第 204–205 行缺少同级条目均有的 Delivery on main 与 Current boundary 描述。
    • Impact: 合入主干后 examples/docs-governance-smoke.py 与 scripts/generate_rfc_status_index.py --check 会持续红灯,影响所有后续 RFC 与文档治理门禁。
    • Fix: 在 verifier-hook-co-design-v0.md 与 .zh-CN.md 头部将 RFC status 改为 Accepted / 已接受(保留 Delivery maturity: Proposal 描述当前无运行时实现),补齐 **Supersedes / closes:** none 与 **替代 / 关闭:** 无,补充 semantic mirror / 语义镜像 互链声明,运行 uv run --extra test python scripts/generate_rfc_status_index.py --write 更新 STATUS.md 与 STATUS.zh-CN.md,并在 docs/architecture/rfcs/README.md 补全 Delivery on main 与 Current boundary 说明,最后重跑 scripts/generate_rfc_status_index.py --check 与 examples/docs-governance-smoke.py。
  2. [P1 · 阻塞] 生产目录新增未接线的 verifier_hook_contract.ts 违反 scope_fit 与所有权边界

    • Problem: loopx/control_plane/turn_driver/verifier_hook_contract.ts 仅被自身单测导入,全仓没有任何生产调用方,且在错误的模块边界平行定义了已被既有模块拥有的语义。
    • Evidence: 全仓搜索确认 loopx/、packages/、apps/、scripts/ 中对 verifier_hook_contract.ts、negotiateVerifierHooks、recommendVerifiedClose、DomainPluginTrial 的生产引用数为 0;14 个导出中 12 个为纯编译期 TypeScript 类型,PR 描述亦自述“TypeScript seam is a contract proposal”。同时 FoldToReceipt / KeepRaw 的所有者在 history-working-set-context-policy-v0.md §5.1(progressive_context.ts + context_delivery.ts),领域能力试跑与采纳/退役的所有者在 goal_capability_organization.ts(goal_capability_improvement_plan_v0)。
    • Impact: 在没有真实宿主适配器或投影消费者验证前过早冻结生产 TS 类型与不完整状态机,违反 docs/development/README.md Scope-Fit Review(无真实调用方的设计应保留在文档中)与 change_proportionality,增加后续迁移与兼容性负担。
    • Fix: 最简修复是把本 PR 收敛为纯双语 RFC 提案(移除未接线的 verifier_hook_contract.ts 与 verifier_hook_contract.test.ts,必要示例接口内嵌于 RFC 正文);若需保留代码,则必须移除孤立的 DomainPluginTrial 等平行类型,将其对接至少一个真实生产入口(如 progressive_context.ts 或宿主能力协商读回)并配合 runtime_decode.ts 完成端到端验证。
  3. [P1 · 阻塞] recommendVerifiedClose 缺少非空身份与引用校验,空字段可触发 FoldToReceipt

    • Problem: loopx/control_plane/turn_driver/verifier_hook_contract.ts 第 101–128 行的 recommendVerifiedClose 仅做字符串全等比对,不校验核心绑定标识与引用是否非空、有效。
    • Evidence: 在本地使用 node --no-warnings --experimental-strip-types 直接运行反例探测:向 recommendVerifiedClose 传入全空 VerifiedScopeIdentity(goal_id: "", todo_id: "", parent_epoch_ref: "", child_scope_ref: "", candidate_sha: "", verifier_version: "")与空 receipt_ref: ""、oracle_evidence_ref: ""、source_ref: ""、summary_ref: "",在 verdict: "passed"、overlap: "low"、open_obligations: false 下函数返回 {"action":"FoldToReceipt","receipt_ref":"","source_ref":"","summary_ref":""}。同样,negotiateVerifierHooks 与 recommendVerifiedClose 均未使用控制面通行的 runtime_decode.ts(requireJsonObject、requireNonEmptyString、isExploreEvidenceRef)进行边界解码。
    • Impact: 一旦未加额外校验的桥接或宿主回执返回空身份/空引用,就会越过 KeepRaw 保护生成指向空 source_ref/summary_ref 的折叠建议,破坏可追溯性。
    • Fix: 若保留代码实现切片,必须通过 runtime_decode.ts 强制校验非空 VerifiedScopeIdentity、非空 receipt_ref / oracle_evidence_ref / source_ref / summary_ref(及 failed 下的非空 counterexample_ref),令空值/空白串快速失败或保持 KeepRaw,并补齐负向单测;若采纳 Findings 2 的纯 RFC 方案移除 .ts 文件,此问题一并消除。

边界隔离与权限语义检查

  • 默认关闭隔离(default_off_isolation): negotiateVerifierHooks({ enabled: false, pre_tool_use: true }, l2) 返回 null,且生产代码无任何调用点导入 verifier_hook_contract.ts,既有默认执行、上下文编码与结算行为保持未变(相关既有 TS 测试 87 条均通过)。但需指出生产侧尚未实现与 Goal 配置绑定的权威开关。
  • 权限与生命周期命名(authority_semantics): DomainPluginTrial 暴露 adopted / retired 阶段且 RFC 将 Delivery maturity 标为 TypeScript contract,在没有任何运行时事务、权限门控或 goal_capability_organization.ts 接入的情况下,命名与成熟度标签高于当前代码实际提供的生命周期能力。

语义与 CI 对齐

  • 语义词表扫描边界: scripts/generate_semantic_inventory.py --changed-from origin/main 报告 supported candidates: 0,examples/semantic-vocabulary-drift-smoke.py 通过(29/29 词表、56/56 拥有者符号均通过)。但该工具仅扫描 Python Enum/Literal/命名集合与 TypeScript as const 数组;verifier_hook_contract.ts 使用内联 TS 字符串联合类型(如 "L0" | "L1" | "L2"、"KeepRaw" | "FoldToReceipt"、"staging" | "trial" | "adopted" | "retired"),未纳入 AST 自动化发现,而这些字面量在语义上分别与既有上下文策略及能力组合生命周期重叠,接入生产前须统一到既有词表或显式评审登记。
  • CI 阻断项实测: 本 PR 修改了 docs/architecture/rfcs/,虽然 scripts/check_rfc_bilingual.py --base origin/main --head HEAD 通过,且 canary premerge 选择的 15 项检查全部通过(返回 quality_receipt_missing,因尚未记录精确 diff 的 change-quality 回执),但 canary premerge 未自动触发 examples/docs-governance-smoke.py 与 scripts/generate_rfc_status_index.py --check,而这两项在 HEAD 上均实测 FAIL(基线 origin/main 均 PASS)。

本地验证汇总(精确头 8a6fa6c68ea8745325b615e668fb5caa26811295,wait_for_ci: false)

  • npm run typecheck:control-plane:PASS
  • node --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/verifier_hook_contract.test.ts:PASS(3/3)
  • 关联 TS 回归套件(yardstick_decision.test.ts、post_writeback_hook_transaction.test.ts、context_delivery.test.ts、progressive_context.test.ts、verifier_hook_contract.test.ts):PASS(90/90)
  • uv run --extra test python scripts/check_rfc_bilingual.py --base origin/main --head HEAD:PASS
  • uv run --extra test python examples/semantic-vocabulary-drift-smoke.py:PASS
  • uv run --extra test python -m ruff check tests/control_plane_ts loopx/control_plane/turn_driver docs/architecture/rfcs:PASS
  • uv run --extra test python -m mypy:PASS(17 source files)
  • uv run --extra test loopx check --scan-path ...(5 个改动文件公开边界扫描):PASS(0 errors)
  • uv run --extra test python -m pytest -q tests/canary/test_rfc_bilingual.py tests/architecture/test_rfc_status_index.py tests/architecture/test_contributor_task_board.py:PASS(55 passed;注:test_rfc_status_index.py 使用临时夹具而非仓库实时索引)
  • uv run --extra test python -m pytest -q tests/architecture/test_top_level_module_budget.py tests/architecture/test_control_plane_import_boundaries.py tests/architecture/test_content_digest_single_owner.py tests/architecture/test_semantic_vocabulary_drift.py:PASS(405 passed)
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main:直接检查 4/4、catalog canaries 6/6、risk profile smokes 8/8、公开边界 1/1 PASS;总状态因精确 diff 缺少 change-quality 回执返回 quality_receipt_missing(退出码 1)
  • uv run --extra test python scripts/generate_rfc_status_index.py --check:FAIL(HEAD 退出码 1;基线 d38052695c 退出码 0)
  • uv run --extra test python examples/docs-governance-smoke.py:FAIL(HEAD AssertionError: verifier-hook-co-design-v0.md;基线 d38052695c 退出码 0)
  • 反例探测(recommendVerifiedClose 传入全空 VerifiedScopeIdentity 与空引用):FAIL(误返回 FoldToReceipt)

我的整体评价 / Verdict

综合精确头 8a6fa6c68ea8745325b615e668fb5caa26811295 的设计与验证证据,PR 提出的四边界 Hook 协商与独立回执门控方向本身贴合控制面演进,但当前交付切片存在治理门禁退化与生产代码未接线问题,不能合入,建议 REQUEST_CHANGES。

  • 长程与用户体验影响(outcome_impact): long_horizon 为 not_yet_proven(verifier_hook_contract.ts 未接入任何运行时/Turn 驱动或上下文投影入口,且 recommendVerifiedClose 允许空身份折叠,尚无法证明真实长程任务下的端到端成本与验收增益);user_experience 为 not_applicable,且 visual_review 为 not_applicable(本次审查覆盖 docs/architecture/rfcs/...、loopx/control_plane/turn_driver/verifier_hook_contract.ts 与 tests/control_plane_ts/verifier_hook_contract.test.ts,未改动任何前端、Dashboard、Chat 或 CLI 渲染界面,无 UI 截屏范围未验证项)。
  • 可观测语义与代码体积(observable_semantics / code_volume / change_proportionality): 现有主干运行时行为虽未被未接线代码改变,但仓库文档治理语义已从基线 d38052695c 的 PASS 退化为 FAIL,且 recommendVerifiedClose 在空字段反例下存在折叠绕过,因此可观测语义为 not_yet_proven。142 行 .ts 代码与 73 行测试在当前无任何生产调用方、无宿主适配器、无 runtime_decode 防护的条件下属于过早固化(partly_avoidable / simplify_now / disproportionate),其中 compatibility_assessment 为 not_applicable(纯新增未调用文件,不涉及历史持久化格式迁移)。
  • 词表归属(semantic_alignment): 新增状态值目前为仅存在于未调用 TS 文件中的 local_only 联合类型(AST 词表脚本未覆盖 TS 内联联合,暂未在 vocabulary_v0.json 注册),但在概念上与既有 KeepRaw / FoldToReceipt(history-working-set-context-policy-v0.md)及 goal_capability_organization.ts 重叠,后续正式接线时须统一归口既有拥有者并补齐登记。
  • 复审与合入所需证据: (1) 修复 RFC 状态头(Accepted、Supersedes / closes、semantic mirror / 语义镜像)、更新 STATUS.md / STATUS.zh-CN.md 并在 docs/architecture/rfcs/README.md 补充 Delivery on main / Current boundary,确保 scripts/generate_rfc_status_index.py --check 与 examples/docs-governance-smoke.py 实测通过;(2) 移除尚未接线的 verifier_hook_contract.ts 与其单测使本 PR 成为自洽的设计 RFC,或者将其接入至少一个真实生产调用方、复用 progressive_context.ts / goal_capability_organization.ts 既有边界、补齐 runtime_decode.ts 非空身份/引用校验并新增负向单测;(3) 补齐精确 diff 的 canary premerge 与公开边界验证。
  • 声明与新鲜度: 本评审在绑定信息不可用(session_not_bound)的情况下以 self_reported 声明模型身份;未等待也未查询远端 GitHub Actions CI(wait_for_ci: false)。当前结果仅对应精确提交 8a6fa6c68ea8745325b615e668fb5caa26811295。

英文简短结论:
English verdict: REQUEST_CHANGES at head 8a6fa6c. Blocking findings: (1) RFC metadata breaks scripts/generate_rfc_status_index.py --check and examples/docs-governance-smoke.py (Proposed status, missing Supersedes/closes, missing semantic-mirror links, and stale STATUS.md); (2) loopx/control_plane/turn_driver/verifier_hook_contract.ts has zero production callers (scope_fit/proportionality gap) and duplicates/splits ownership from progressive_context.ts and goal_capability_organization.ts; (3) recommendVerifiedClose accepts empty identity and reference strings to return FoldToReceipt. Local verification: npm run typecheck:control-plane, verifier_hook_contract.test.ts (3/3), semantic-vocabulary-drift-smoke.py, check_rfc_bilingual.py, ruff, mypy, loopx check, and canary premerge checks (15/15; change-quality receipt missing) passed; generate_rfc_status_index.py --check and docs-governance-smoke.py failed against a passing origin/main baseline.

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

动机 / Motivation

在长程求解任务中,控制面与宿主维护者在启用多轮探索与独立验收时,往往只能在粗糙的 Stop-Hook 兜底验证与同步逐工具拦截之间二选一;缺乏跨宿主的四边界验证 Hook 协同契约,也缺乏“子作用域须经独立 Oracle 回执且满足低重叠后才折叠”的 VerifiedClose 约束,因此本 PR 试图把验证接入收敛到既有 C1 与历史上下文边界之下。

如果不做任何改动,外部宿主(如 Codex、Claude Code、DSH、Antigravity)上的验证探测、子作用域折叠以及领域快尺(yardstick)试跑仍各自依赖局部协议或散落脚本,既难对齐能力协商档位,也容易让未验证的代理结果或跨作用域回执污染主干上下文。

  • 受影响对象(affected_caller_or_operator): 接入宿主 Hook 生命周期(启动、里程碑、压缩/子作用域与停止边界)并消费独立验收回执的 LoopX 控制面、宿主适配器与实验评估维护者。
  • 前后对比场景(before_after_scenario): 改动前,不同宿主各自实现启动上下文恢复、里程碑采样、压缩后恢复与停止验收,子工作折叠与快尺试跑缺少统一的不变式边界;理想改进是先建立双语架构提案再沿真实拥有者接线,而当前 PR 在最新精确头 1b6514a6c1773855dcb1a0f921f62f899e6dd63a 上虽已将 VerifiedClose 补强为经 VerifiedCloseReader 校验引用非空且可读,但仍缺少对 VerifiedScopeIdentity 六元组身份非空的校验,且依然在没有任何生产调用方的情况下于控制面保留未接线的 TypeScript 契约文件与仅作类型声明的 QuotaGoalBoundaryReference,同时新增 RFC 头部未满足仓库治理检查,导致主干 docs-governance-smoke.py 与 generate_rfc_status_index.py --check 持续从基线通过退化为失败。
  • 可观测结果(observable_outcome): 相对上一轮评审头 8a6fa6c68ea8745325b615e668fb5caa26811295,最新头 1b6514a6c1773855dcb1a0f921f62f899e6dd63a 补充了 VerifiedCloseReader 可读性与引用非空校验(单测增至 5/5 通过)及 turn_envelope.ts 中的 QuotaGoalBoundaryReference 类型定义;但全仓生产代码对 verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 仍无任何运行时调用方,recommendVerifiedClose 在全空或空白 VerifiedScopeIdentity 配合可读引用时仍返回 FoldToReceipt,且两个 RFC 治理门禁在当前精确头上依旧失败。
  • 非目标(non_goals): 本次变更不改变 C1 准入、传输或结算所有权,不实现具体宿主适配器(Codex、DSH、Claude Code、Antigravity)运行时代码,不启用新默认开关,也不开展跨宿主或同宿主模型效果/缓存对照实验。

改动思路 / Approach

本次对精确头 1b6514a6c1773855dcb1a0f921f62f899e6dd63a 执行全包独立复审(rereview_pull_request_exact_head),先区分上一轮(审查 6011637514、8a6fa6c68ea8745325b615e668fb5caa26811295)后的局部修复,再按整包标准裁决当前合并可行性。

从控制面所有权看,本 PR 提出了一个跨宿主验证 Hook 协商与子作用域验证折叠方案:策略默认关闭(enabled !== true 返回 null),启用后按宿主实际观测能力协商 L0 / L1 / L2,并坚持 pre_tool_use 默认关闭;在子作用域结束时,最新改动通过 VerifiedCloseReader(readReceipt + canReadEvidence)和 hasReference() 检查 request.receipt_ref、receipt.oracle_evidence_ref、receipt.source_ref、receipt.summary_ref(以及 failed 路径下的 counterexample_ref)均非空白且可读,否则回退 KeepRaw;此外在 loopx/control_plane/quota/turn_envelope.ts 新增 QuotaGoalBoundaryReference 类型以呼应启动与恢复共用 C1 /goal_boundary 指针的设计约束。

然而从架构与比例性(architecture_assessment)角度重新审视当前精确头,8a6fa6c68e -> 1b6514a6c1 的增补并未消除结构性所有权与接入边界问题:verifier_hook_contract.ts 及其新加入 turn_envelope.ts 的 QuotaGoalBoundaryReference 均没有任何生产运行时调用方,recommendVerifiedClose 对 VerifiedScopeIdentity 仍缺少 hasReference 或 runtime_decode 非空约束(空或空白身份配合可读引用仍返回 FoldToReceipt),FoldToReceipt / KeepRaw 继续脱离既有上下文策略拥有者 progressive_context.ts 与 context_delivery.ts,DomainPluginTrial 继续与 goal_capability_organization.ts 平行定义阶段类型,且 RFC 生命周期头与索引门禁尚未修复;当前 PR 仍应先修正 RFC 治理头与索引、移除未接线的生产 TypeScript 契约文件(或将其真正接入 progressive_context.ts / 宿主边界并补齐身份非空与解码校验),不应把无运行时调用方的孤立契约代码合入主干。 当前 PR 边界(current_pr_boundary):仅建议保留并修全双语 RFC 设计与目录索引,或将代码切片收口为带真实生产调用方、统一拥有者与完整身份/引用解码校验的最小端到端变更;在未完成上述收口与治理修复前,宿主适配器接入、真实缓存收益测量和生产开关均保留在后续切片。

与既有实现对比,仓库在 loopx/control_plane/quota/progressive_context.ts 与 docs/architecture/rfcs/history-working-set-context-policy-v0.md §5.1 中已明确将 KeepRaw / FoldToReceipt / EpochReset 归属为共享 TypeScript 投影拥有者;在 loopx/control_plane/capabilities/goal_capability_organization.ts 中已实现 goal_capability_improvement_plan_v0 及 planCapabilityImprovement 试跑—反馈—回滚追踪;在 loopx/control_plane/work_items/yardstick_decision.ts 中已实现 WorkYardstickProfile 与 proxy_order_reversed 判定;在 loopx/control_plane/quota/context_selection.ts 中已实现 capturedContextSelection 选择器。本 PR 仅用 import type 引用了 WorkYardstickProfile 与 QuotaGoalBoundaryReference,新测试直接在测试文件中调用 capturedContextSelection,生产路径对 verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 的运行时调用仍为 0。

提案边界 RFC 设计职责 本 PR 在 1b6514a6c1 覆盖现状 既有所属拥有者
Start / resume 通过原始 C1 capture 摘要与 /goal_boundary 读取作用域与停止条件 新增纯类型 QuotaGoalBoundaryReference(无运行时构造/消费),测试直接调 capturedContextSelection turn_envelope.ts / context_selection.ts / progressive_context.ts
Milestone probe 异步采样并回传平台期/快尺反转 仅联合类型(无生产实现) yardstick_decision.ts / stride_policy.ts
Compaction / subscope 独立 Oracle 回执、原件与摘要均可读且非空后才允许 FoldToReceipt recommendVerifiedClose 已补引用非空与 canReadEvidence,但身份六元组仍允许空串,且 0 生产调用方 history-working-set-context-policy-v0.md §5.1 (progressive_context.ts)
Stop / Domain plugin 独立 Oracle 验收及内容寻址试跑准入 DomainPluginCandidate/DomainPluginTrial 仅类型(0 生产调用方) settlement.ts / goal_capability_organization.ts

具体改动 / Changes

上一轮审查至本次精确头的增量变化(8a6fa6c68ea8745325b615e668fb5caa26811295..1b6514a6c1773855dcb1a0f921f62f899e6dd63a)

增量提交(Require readable verifier evidence and bind solver constraints)修改 5 个文件(+95 / -23):

  1. 解决情况(已修复引用可读性与空引用): verifier_hook_contract.ts(第 101–145 行)引入 VerifiedCloseReader(readReceipt + canReadEvidence)和 hasReference(),对 request.receipt_ref、receipt.oracle_evidence_ref、receipt.source_ref、receipt.summary_ref 以及 failed 分支的 counterexample_ref 强制要求非空白且 canReadEvidence(ref) === true;verifier_hook_contract.test.ts 新增可读性负向单测验证空/不可读引用保留 KeepRaw。
  2. 增量引入的局部补充: 在 loopx/control_plane/quota/turn_envelope.ts(第 74–77 行)新增 export type QuotaGoalBoundaryReference(capture_sha256: string; pointer: "/goal_boundary"),在 verifier-hook-co-design-v0.md 与 .zh-CN.md 第 10 行、第 43 行补充启动/恢复读取 /goal_boundary 与引用可读性规则描述,并在 verifier_hook_contract.test.ts 新增调用 capturedContextSelection 验证 /goal_boundary 的第 5 条单测。
  3. 仍未修复的问题: 未修改 RFC 头部 RFC status: Proposed、缺少 Supersedes / closes、缺少 semantic mirror / 语义镜像、未更新 STATUS.md / STATUS.zh-CN.md 与 README.md 边界描述;verifier_hook_contract.ts 与新加的 QuotaGoalBoundaryReference 仍没有任何生产调用方;recommendVerifiedClose 对 VerifiedScopeIdentity 六元组身份字段依然缺少非空校验。

完整 PR 改动清单(相对基准 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d,6 个文件,+403 / -0)

  1. 文档与索引(3 个文件,+116/-0): 新增 docs/architecture/rfcs/verifier-hook-co-design-v0.md(57 行)与 docs/architecture/rfcs/verifier-hook-co-design-v0.zh-CN.md(57 行),并在 docs/architecture/rfcs/README.md 增加条目链接(+2 行);未更新 STATUS.md / STATUS.zh-CN.md。
  2. 控制面 TypeScript 源码(2 个文件,+163/-0): 在 loopx/control_plane/quota/turn_envelope.ts 第 74–77 行新增纯类型导出 QuotaGoalBoundaryReference(+4 行);新增 loopx/control_plane/turn_driver/verifier_hook_contract.ts(159 行)。
  3. TypeScript 单测(1 个文件,+124/-0): 新增 tests/control_plane_ts/verifier_hook_contract.test.ts(5 条单测),也是全仓唯一导入 verifier_hook_contract.ts 的文件。

关键代码讲解

  • VerifiedCloseReader 与 hasReference(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L101-L108): 新增 VerifiedCloseReader 端口定义 readReceipt 与 canReadEvidence,hasReference 校验 typeof ref === "string" && ref.trim().length > 0,要求权威读端对引用字符串做非空白判断再读取。
  • recommendVerifiedClose(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L112-L145): 先用 hasReference(request.receipt_ref) 决定是否调用 reader.readReceipt;随后以 !== 逐一比对 receipt?.identity 与 request.identity 的 6 个字段(goal_id、todo_id、parent_epoch_ref、child_scope_ref、candidate_sha、verifier_version),不相等或缺失回执返回 KeepRaw;当 receipt.verdict === "failed" 时若 counterexample_ref 非空白且 canReadEvidence 为真则透传 counterexample_ref 并保持 KeepRaw,否则仅返回 { action: "KeepRaw" };当 verdict === "passed"、open_obligations === false、overlap === "low" 且 [oracle_evidence_ref, source_ref, summary_ref] 全部满足 hasReference 与 canReadEvidence === true 时返回 FoldToReceipt。残留缺陷在于第 119–126 行只检查两端身份全等而不检查六个身份字段是否非空白,因此双端均为空/空白字符串且引用可读时仍会返回 FoldToReceipt;此外若外部非类型化调用传入缺失 request.identity,直接读取 expected.goal_id 也缺少 runtime_decode.ts 对象防护。
  • QuotaGoalBoundaryReference(loopx/control_plane/quota/turn_envelope.ts#L74-L77): 定义了固定 pointer: "/goal_boundary" 与 capture_sha256: string 的只读类型,但整个控制面与宿主层没有任何函数构造、解码或消费该类型;verifier_hook_contract.ts 仅以 import type 引入,verifier_hook_contract.test.ts 则直接调用既有 capturedContextSelection 验证原始 JSON 指针选择。
  • negotiateVerifierHooks 与未接线类型集合(verifier_hook_contract.ts): 沿用上一轮逻辑,当 policy.enabled !== true 返回 null,启用后按 observed capabilities 协商 L0 / L1 / L2 与 pre_tool_use;DomainPluginCandidate / DomainPluginTrial、VerifierHookEvent 等仍仅有类型声明,全仓 0 生产调用方。

规范基线映射(spec_basis)

依据基准 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d 上的规范入口 docs/architecture/rfcs/README.md(及其引用的 docs/development/README.md Scope-Fit Review 与 history-working-set-context-policy-v0.md §5.1)映射精确头 1b6514a6c1773855dcb1a0f921f62f899e6dd63a:

  • RFC-INDEX-HEADER -> not_met:docs/architecture/rfcs/README.md 要求合入 RFC 使用 Accepted 生命周期状态、声明 Supersedes / closes、包含 semantic mirror / 语义镜像 互链并通过 generate_rfc_status_index.py --write 同步 STATUS.md;当前头仍为 Proposed、缺 Supersedes / closes 与 semantic mirror / 语义镜像 字样、未同步 STATUS.md,README.md 条目亦缺少 Delivery on main / Current boundary 说明。
  • RFC-BILINGUAL-PAIR -> implemented:英文与中文镜像在本 PR 中同步增改,并通过 scripts/check_rfc_bilingual.py --base origin/main --head HEAD。
  • RFC-MATURITY-SEPARATION -> not_met:docs/architecture/rfcs/README.md 与 docs/development/README.md 要求将设计提案与已实现运行时边界严格隔离,禁止将无生产调用方的控制面模块留置主干并须复用既有拥有者;当前精确头仍在 loopx/control_plane/turn_driver/ 保留 0 生产调用方的 verifier_hook_contract.ts(并新增同样 0 运行时调用方的 QuotaGoalBoundaryReference 导出),RFC 仍将成熟度标为 TypeScript contract,且 FoldToReceipt 与插件试跑阶段仍未接入 progressive_context.ts 与 goal_capability_organization.ts。

对主干的风险 / Risks

阻塞发现(Findings)

  1. [P1 · 阻塞] RFC 生命周期头、镜像声明与派生索引仍破坏仓库文档治理门禁(未修复)

    • Problem: 最新提交 1b6514a6c1 仅修改了 RFC 正文第 10、43 行,未修复 RFC 头部元数据与目录索引,导致主干文档治理脚本在精确头上继续失败。
    • Evidence: 在精确头 1b6514a6c1773855dcb1a0f921f62f899e6dd63a 实测 uv run --extra test python scripts/generate_rfc_status_index.py --check 退出码 1,报错 verifier-hook-co-design-v0.md: status 'Proposed' does not begin with a lifecycle state (Accepted, Superseded, Retired, Rejected) 与 missing '**Supersedes / closes:**' declaration;实测 uv run --extra test python examples/docs-governance-smoke.py 退出码 1,在 check_rfc_language_mirrors() 第 202 行抛出 AssertionError: verifier-hook-co-design-v0.md(缺少 "semantic mirror",且中文镜像缺少 "语义镜像")。此前基线 d38052695c 两项均退出 0。此外 docs/architecture/rfcs/README.md 仍缺少同级条目的 Delivery on main / Current boundary 段落。
    • Impact: 合入主干后会立即使 scripts/generate_rfc_status_index.py --check 与 examples/docs-governance-smoke.py 持续失败。
    • Fix: 在 verifier-hook-co-design-v0.md 与 .zh-CN.md 头部将 RFC status 改为 Accepted / 已接受(Delivery maturity 如实标为 Proposal),补全 **Supersedes / closes:** none / **替代 / 关闭:** 无 与 semantic mirror / 语义镜像 互链,运行 uv run --extra test python scripts/generate_rfc_status_index.py --write 更新 STATUS.md 与 STATUS.zh-CN.md,并在 docs/architecture/rfcs/README.md 补全 Delivery on main / Current boundary,重跑上述两条校验脚本至退出 0。
  2. [P1 · 阻塞] 控制面新增的 verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 仍无任何生产调用方且分裂既有所有权(未修复)

    • Problem: 尽管新提交在 turn_envelope.ts 导出了 QuotaGoalBoundaryReference 并新增了 capturedContextSelection 单测,但 verifier_hook_contract.ts 与该新类型在生产代码中依然没有任何运行时调用者,且继续在错误目录平行定义既有拥有者的语义。
    • Evidence: 全仓搜索 verifier_hook_contract 与 QuotaGoalBoundaryReference(覆盖 loopx/、tests/、packages/、apps/、scripts/)确认:QuotaGoalBoundaryReference 仅被 verifier_hook_contract.ts 以 import type 引入,verifier_hook_contract.ts 仅被 tests/control_plane_ts/verifier_hook_contract.test.ts 导入,全仓 0 个生产运行时调用方。新测试第 5 条是测试文件直接调用 context_selection.ts 的 capturedContextSelection,并未经过 verifier_hook_contract.ts 或 turn_envelope.ts 的新运行时路径。同时 FoldToReceipt / KeepRaw 的所有者是 history-working-set-context-policy-v0.md §5.1(progressive_context.ts + context_delivery.ts),能力试跑生命周期的所有者是 goal_capability_organization.ts(goal_capability_improvement_plan_v0)。
    • Impact: 在没有真实宿主适配器或投影调用方落地前,向 loopx/control_plane/turn_driver/ 与 turn_envelope.ts 预埋未验证、无调用方的导出契约,违反 scope_fit、repository_reuse 与 change_proportionality,并累积过早耦合与迁移成本。
    • Fix: 最简修复是收敛本 PR 为合规的双语架构 RFC(移除未接线的 verifier_hook_contract.ts、测试文件及纯编译期占位类型 QuotaGoalBoundaryReference,必要接口保留在 RFC 文档中);若坚持在当前 PR 交付代码,则须删除孤立平行类型(DomainPluginTrial 等),将 recommendVerifiedClose / Hook 能力协商真正接入至少一条 progressive_context.ts / turn_envelope.ts 或宿主适配器读回生产路径并补齐端到端验证。
  3. [P1 · 阻塞] recommendVerifiedClose 虽已校验引用非空与可读性,但对 VerifiedScopeIdentity 六元组仍缺少非空校验,空身份可触发 FoldToReceipt(部分修复、仍有缺口)

    • Problem: 1b6514a6c1 修复了空引用与不可读证据,但 recommendVerifiedClose(第 117–126 行)对 VerifiedScopeIdentity 六个字段仍只检查 observed.<field> !== expected.<field>,未复用 hasReference 或 runtime_decode.ts 校验身份字段非空。
    • Evidence: 在精确头 1b6514a6c1 使用 node --no-warnings --experimental-strip-types 执行反例测试:当 request.identity 与 receipt.identity 同时传入 { goal_id: "", todo_id: " ", parent_epoch_ref: "", child_scope_ref: "", candidate_sha: "", verifier_version: "" },配合非空且 canReadEvidence === true 的 receipt_ref: "receipt:21"、oracle_evidence_ref: "oracle:result"、source_ref: "capture:raw-child"、summary_ref: "capture:child-receipt"、verdict: "passed"、open_obligations: false、overlap: "low" 时,recommendVerifiedClose 返回 {"action":"FoldToReceipt","receipt_ref":"receipt:21","source_ref":"capture:raw-child","summary_ref":"capture:child-receipt"} 而非 KeepRaw。同时边界入口仍未使用 runtime_decode.ts(requireJsonObject、requireNonEmptyString)。
    • Impact: 若上游未绑定作用域的身份对象退化为空串或空白串,即可在看似合法的 FoldToReceipt 返回中绕过作用域与 candidate_sha / verifier_version 绑定;且缺乏统一 runtime_decode 防护使畸形输入会在读取 expected.goal_id 时直接抛错而非稳健落回 KeepRaw。
    • Fix: 若保留实现代码,必须在身份比对前对 VerifiedScopeIdentity 六个字段全量执行非空白校验(或使用 runtime_decode.ts 解码请求与回执并保持缺省回退 KeepRaw),同时在 verifier_hook_contract.test.ts 补充空/空白身份负向测试用例;若按 Finding 2 收敛为纯 RFC PR,则同步消除此运行时缺陷。

边界隔离与权限语义检查

  • 默认关闭隔离(default_off_isolation): negotiateVerifierHooks({ enabled: false, pre_tool_use: true }, ...) 返回 null,且生产代码无任何调用点导入 verifier_hook_contract.ts 或读取 QuotaGoalBoundaryReference,既有默认执行、上下文投影、调度与结算行为均未改变(既有 TS 关联套件 175/175 全通过)。但权威控制开关尚未接入任何 Goal 配置边界。
  • 权限与生命周期命名(authority_semantics): RFC 将 Delivery maturity 标为 TypeScript contract,并在 verifier_hook_contract.ts 导出 adopted / retired 等 DomainPluginTrial 阶段,在零生产运行时调用方与零持久化状态转换的现状下,命名和成熟度标签高于当前代码实际提供的能力。

语义与 CI 对齐

  • 语义词表扫描边界: scripts/generate_semantic_inventory.py --changed-from origin/main(基线 b375539271b4cb9f34386a77211a944ce6e05ffe)扫描 18 份快照报告 supported candidates: 0,examples/semantic-vocabulary-drift-smoke.py 通过(29/29 词表、56/56 拥有者符号均通过)。由于该扫描器仅提取 Python Enum/Literal/命名多值集合与 TypeScript as const 数组,verifier_hook_contract.ts 中的内联 TS 字符串联合类型处于扫描盲区之外,后续若进入生产接线仍须与 progressive_context.ts 及 goal_capability_organization.ts 的注册词表对齐。
  • 门禁脚本对齐(wait_for_ci: false): 本复审不轮询远端 GitHub Actions。canary premerge 在精确头 1b6514a6c1 执行 4 项直接检查、9 项目录金丝雀、8 项风险烟雾测试与 1 项公开边界扫描全部通过(总状态因缺少精确 diff 的 change-quality 回执返回 quality_receipt_missing,退出码 1);但 canary premerge 不会覆盖 scripts/generate_rfc_status_index.py --check 与 examples/docs-governance-smoke.py,这两项在精确头上均实测失败。

本地验证汇总(精确头 1b6514a6c1773855dcb1a0f921f62f899e6dd63a,wait_for_ci: false)

  • npm run typecheck:control-plane:PASS
  • node --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/verifier_hook_contract.test.ts:PASS(5/5 passed)
  • 关联 TS 回归套件(verifier_hook_contract.test.ts、yardstick_decision.test.ts、post_writeback_hook_transaction.test.ts、context_delivery.test.ts、progressive_context.test.ts、turn_envelope.test.ts、context_selection.test.ts):PASS(180/180 passed)
  • uv run --extra test python scripts/check_rfc_bilingual.py --base origin/main --head HEAD:PASS
  • uv run --extra test python examples/semantic-vocabulary-drift-smoke.py:PASS
  • uv run --extra test python -m ruff check tests/control_plane_ts loopx/control_plane/turn_driver loopx/control_plane/quota docs/architecture/rfcs:PASS
  • uv run --extra test python -m mypy:PASS(17 source files)
  • uv run --extra test loopx check --scan-path ...(6 个改动文件公开边界扫描):PASS(0 errors, 5 checks)
  • uv run --extra test python -m pytest -q tests/canary/test_rfc_bilingual.py tests/architecture/test_rfc_status_index.py tests/architecture/test_contributor_task_board.py tests/architecture/test_top_level_module_budget.py tests/architecture/test_control_plane_import_boundaries.py tests/architecture/test_content_digest_single_owner.py tests/architecture/test_semantic_vocabulary_drift.py:PASS(460 passed)
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main:direct_checks 4/4、catalog_canaries 9/9、risk_profile_smokes 8/8、public_boundary 1/1 均 PASS(总状态 quality_receipt_missing,退出码 1)
  • uv run --extra test python scripts/generate_rfc_status_index.py --check:FAIL(HEAD 1b6514a6c1 退出码 1;对比此前 PR 基线 d38052695c 退出码 0)
  • uv run --extra test python examples/docs-governance-smoke.py:FAIL(HEAD 1b6514a6c1 AssertionError: verifier-hook-co-design-v0.md 退出码 1;对比此前 PR 基线 d38052695c 退出码 0)
  • 反例探测(recommendVerifiedClose 传入全空/空白 VerifiedScopeIdentity 配合可读引用):FAIL(误返回 FoldToReceipt 而非 KeepRaw)

我的整体评价 / Verdict

对精确头 1b6514a6c1773855dcb1a0f921f62f899e6dd63a 执行全包复审后,确认作者修复了上一轮提出的 VerifiedClose 空引用与不可读证据遗漏,并补充了 /goal_boundary 相关文本与引用可读性单测;但上一轮其余阻塞项仍未解决,且 recommendVerifiedClose 对空身份字符串的校验缺口依然存在,整体仍应给出 REQUEST_CHANGES。

  • 长程与用户体验影响(outcome_impact): long_horizon 为 not_yet_proven(verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 仍没有任何生产运行时调用方,recommendVerifiedClose 仍允许全空/空白 VerifiedScopeIdentity 触发 FoldToReceipt,尚无法证明长程任务下真实宿主与投影收益);user_experience 为 not_applicable,且 visual_review 为 not_applicable(本次复审检查了全部 6 个改动文件,未修改任何前端、Dashboard、Chat 或 CLI 交互/渲染表面,无未检查 UI 截屏项)。
  • 可观测语义与代码体积(observable_semantics / code_volume / change_proportionality): 主干现有运行时行为虽未被未接线代码改变,但文档治理检查从基线 d38052695c 的 PASS 退化为 FAIL 状态至今未修复,且 recommendVerifiedClose 在空身份反例下仍能越过作用域绑定校验,故 observable_semantics 为 not_yet_proven。163 行生产目录 TS 代码(+124 行单测)在无生产调用方、无宿主适配器、无统一 runtime_decode 防护的条件下仍属过早固化(partly_avoidable / simplify_now / disproportionate),compatibility_assessment 为 not_applicable(新增文件/新增纯类型无存量格式迁移边界)。
  • 词表归属(semantic_alignment): 当前词表仍为停留在未调用 TS 文件内的 local_only 联合类型(AST 词表脚本未覆盖 TS 内联联合,vocabulary_v0.json 未受直接破坏),但后续接线时须统一到 progressive_context.ts 与 goal_capability_organization.ts 的注册词表。
  • 下一轮复审与合入所需证据: (1) 修复 RFC 头部字段(Accepted、Supersedes / closes、semantic mirror / 语义镜像)、运行 scripts/generate_rfc_status_index.py --write 同步 STATUS.md / STATUS.zh-CN.md 并在 docs/architecture/rfcs/README.md 补全 Delivery on main / Current boundary,使 generate_rfc_status_index.py --check 与 docs-governance-smoke.py 实测通过;(2) 要么移除尚未接线的 verifier_hook_contract.ts、QuotaGoalBoundaryReference 与其单测使本 PR 成为纯粹规范的双语设计 RFC,要么将其接入真实生产调用方与既有拥有者并补全 VerifiedScopeIdentity 非空 + runtime_decode 校验与负向单测;(3) 在最终提交后补齐精确 diff 的 canary premerge 与公开边界验证。
  • 声明与新鲜度: 本评审在绑定信息不可用(session_not_bound)的情况下以 self_reported 声明模型身份;未等待也未查询远端 GitHub Actions CI(wait_for_ci: false)。当前结果仅对应精确提交 1b6514a6c1773855dcb1a0f921f62f899e6dd63a。

英文简短结论:
English verdict: REQUEST_CHANGES at head 1b6514a. Compared with prior head 8a6fa6c, this update resolved empty/unreadable receipt/evidence refs via VerifiedCloseReader and hasReference (5/5 unit tests pass), but the core PR blockers remain: (1) RFC headers and derived index still fail scripts/generate_rfc_status_index.py --check and examples/docs-governance-smoke.py against the passing base d380526; (2) verifier_hook_contract.ts and the newly added compile-only QuotaGoalBoundaryReference in turn_envelope.ts still have zero production callers and split ownership from progressive_context.ts and goal_capability_organization.ts; (3) recommendVerifiedClose still compares the 6 VerifiedScopeIdentity fields only with !== and returns FoldToReceipt on empty/whitespace identities when refs are readable. Local checks: npm run typecheck:control-plane, 180/180 targeted TS tests, check_rfc_bilingual.py, semantic-vocabulary-drift-smoke.py, ruff, mypy (17 files), loopx check (6 files), 460/460 architecture pytest cases, and canary premerge suites (22/22 checks pass; exit 1 only on quality_receipt_missing) passed.

@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.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

维护者需要评议可关闭的 verifier hooks 契约,并确保日常文档校验能继续运行。 主干上的 RFC 检查以接受后的规范生命周期为输入。现有 Goal 与 settlement 继续由 C1 持有。 同一套 RFC 检查在 merge base 均通过,在当前头均失败。状态索引拒绝新增 Active RFC 的 Proposed 生命周期并报告缺少 Supersedes / closes。文档 smoke 在英文页报告缺少语义镜像标记。 补丁增加双语 RFC、tier 协商、VerifiedClose 建议和 C1 边界引用类型。Host 集成仍待验收。 范围是提案及当前纯 TypeScript 契约。

改动思路 / Approach

C1 决定授权及结算,外部 Oracle 提供验证票据,helper 只计算折叠建议。 这一提交可作为待评议的 TypeScript 契约。最先可验收的运行切片应使用原 Goal/Todo 上一次真实恢复,将精确 Oracle 票据、父边界回读和原 settlement 串起来。其运行证据留在对应实现。 沿用现有历史工作集的折叠语义,让请求和回执共享精确身份校验。

具体改动 / Changes

逐项检查当前头 1b6514a 和 merge base d380526,6 个文件,+403/-0。差异核对覆盖 Active RFC、双语稿、协商及建议函数、Turn envelope 的类型引用和配套测试。 评审依据为 d380526。 目标规范

关键代码讲解

  • rfc-active-governance 的接线使新增稿参与仓库现有治理。 RFC 头部
  • verifier-negotiation-off 由协商入口的关闭分支处理。 Tier 协商
  • verified-close-exact-identity 由票据读取后的身份比较处理,并核对 Oracle、源和压缩结果。 身份比较 · 拟议语义

对主干的风险 / Risks

[P1] 新增 Active RFC 使文档索引和镜像检查失败。 同一套 RFC 检查在 merge base 均通过,在当前头均失败。状态索引拒绝新增 Active RFC 的 Proposed 生命周期并报告缺少 Supersedes / closes。文档 smoke 在英文页报告缺少语义镜像标记。 经维护者接受后,按双语 Active RFC 模板登记生命周期、取代关系和语义镜像,保留当前交付成熟度并重新生成状态索引。尚待设计评议时,将提案留在项目认可的评议入口,待接受后再列入 Active RFC。

[P2] 不完整的身份可触发 VerifiedClose 折叠建议。 令请求与已通过票据的同一身份字段为空,其余字段保持有效,重复六次。Goal、Todo、父 epoch、子 scope、candidate SHA 和 verifier version 各自为空时都得到 FoldToReceipt。身份相等无法证明 Oracle 绑定了完整候选,按约定此时应保留原始记录。 在比较身份和输出推荐前拒绝任一端缺失、空或全空白的身份字段。用共享身份校验覆盖六项独立负例,并保留完整匹配仍可折叠的测试。

完整匹配且三段证据可读的已通过票据得到折叠推荐。跨 scope、不可读证据和有未清义务的情况均保留原始记录。 TypeScript 81 个测试和类型检查通过。预合并 4 个直接检查与 18 个选中检查通过,严格资格返回 quality_receipt_missing。两项另外执行的文档治理检查在当前头失败。 Host adapter、安装态回读和匹配预算下的收益属于后续验收。本轮运行了纯 TypeScript 入口和实际文档检查。

我的整体评价 / Verdict

请求修改。C1 决定授权及结算,外部 Oracle 提供验证票据,helper 只计算折叠建议。 这一提交可作为待评议的 TypeScript 契约。最先可验收的运行切片应使用原 Goal/Todo 上一次真实恢复,将精确 Oracle 票据、父边界回读和原 settlement 串起来。其运行证据留在对应实现。 当前头尚未满足 Active RFC 治理,也未通过不完整精确身份的契约负例。 修正两个边界后复跑文档与折叠负例。

English verdict: REQUEST_CHANGES at 1b6514a. Fix the Active RFC lifecycle and bilingual metadata, and reject all incomplete VerifiedClose identities before recommending a fold. Both governance checks regress on this head, and six isolated identity counterexamples produce FoldToReceipt.

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

动机 / Motivation

在长程求解任务中,控制面与宿主维护者在启用多轮探索与独立验收时,往往只能在粗糙的 Stop-Hook 兜底验证与同步逐工具拦截之间二选一;缺乏跨宿主的四边界验证 Hook 协同契约,也缺乏“子作用域须经独立 Oracle 回执且满足低重叠后才折叠”的 VerifiedClose 约束,因此本 PR 试图把验证接入收敛到既有 C1 与历史上下文边界之下。

如果不做任何改动,外部宿主(如 Codex、Claude Code、DSH、Antigravity)上的验证探测、子作用域折叠以及领域快尺(yardstick)试跑仍各自依赖局部协议或散落脚本,既难对齐能力协商档位,也容易让未验证的代理结果或跨作用域回执污染主干上下文。

  • 受影响对象(affected_caller_or_operator): 接入宿主 Hook 生命周期(启动、里程碑、压缩/子作用域与停止边界)并消费独立验收回执的 LoopX 控制面、宿主适配器与实验评估维护者。
  • 前后对比场景(before_after_scenario): 改动前,不同宿主各自实现启动上下文恢复、里程碑采样、压缩后恢复与停止验收,子工作折叠与快尺试跑缺少统一的不变式边界;理想改进是先合入合规的双语架构 RFC 再在真实拥有者上接线落地,而当前 PR 在最新精确头 72c77567b09f6ad69a0b56189db3ab3184086609 上虽然已修复 RFC 治理检查并补齐了 recommendVerifiedClose 的空身份与角色/作用域证据校验,但依然将没有任何生产调用方的 verifier_hook_contract.ts 与仅作编译期类型导出的 QuotaGoalBoundaryReference 放在控制面生产目录中,同时把 FoldToReceipt / KeepRaw 留在 turn_driver/ 而非既有拥有者 progressive_context.ts、保留零调用方零测试的平行 DomainPluginTrial 类型,且未在 docs/architecture/rfcs/README.md 声明当前无运行时交付边界。
  • 可观测结果(observable_outcome): 相对上一轮头 1b6514a6c1773855dcb1a0f921f62f899e6dd63a,最新头 72c77567b09f6ad69a0b56189db3ab3184086609 已使 scripts/generate_rfc_status_index.py --check 与 examples/docs-governance-smoke.py 双双实测通过(STATUS.md 更新为 Accepted (53)),并让 recommendVerifiedClose 在空身份和跨角色/错作用域证据下稳定返回 KeepRaw(单测 7/7 通过、全空身份实测返回 KeepRaw);但全仓生产代码对 verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 仍只有 0 个生产运行时调用方,DomainPluginCandidate / DomainPluginTrial 仍无任何调用方与测试,FoldToReceipt 仍未归口 progressive_context.ts。
  • 非目标(non_goals): 本次变更不改变 C1 准入、传输或结算所有权,不实现具体宿主适配器(Codex、DSH、Claude Code、Antigravity)运行时代码,不启用新默认开关,也不开展跨宿主或同宿主模型效果/缓存对照实验。

改动思路 / Approach

本次对精确头 72c77567b09f6ad69a0b56189db3ab3184086609 执行全包独立复审(rereview_pull_request_exact_head),逐项核验上一轮(审查 6011852973、1b6514a6c1773855dcb1a0f921f62f899e6dd63a)指出的 3 项阻塞项在最新提交 Require role- and scope-bound verifier evidence 中的实际修复与残余边界。

本轮确认已实质修复的前轮阻塞项:

  1. RFC 状态索引与镜像治理(原 P1 #1 已解决): 作者在 verifier-hook-co-design-v0.md 与 .zh-CN.md 头部补齐 Accepted (upon merge)、Supersedes / closes: none(替代 / 关闭:无)及 semantic mirror / 语义镜像 互链,并重新生成 STATUS.md 与 STATUS.zh-CN.md(Accepted (53) / 已接受 (53));generate_rfc_status_index.py --check 与 docs-governance-smoke.py 均从上一轮的 exit 1 恢复为 exit 0 通过。
  2. recommendVerifiedClose 空身份与证据角色/作用域绑定(原 P1 #3 已解决): 作者将 VerifiedCloseReader 升级为 readReceipt + readEvidence => VerifiedScopeEvidence | undefined(要求 { ref, role, identity } 三元一致),并在 recommendVerifiedClose 入口(第 140–144 行)校验 VerifiedScopeIdentity 六个字段全部非空白且 request.receipt_ref 非空白后才读取回执与证据;最新反例实测空/空白身份返回 {"action":"KeepRaw"} 且不触发权限读回,单测增至 7/7 全过。

然而从架构与比例性(architecture_assessment)及仓库 Scope-Fit Review 规则审视当前完整精确头,原第 2 项结构性阻塞仍未消除:loopx/control_plane/turn_driver/verifier_hook_contract.ts(181 行)与 loopx/control_plane/quota/turn_envelope.ts 新增的 QuotaGoalBoundaryReference(第 74–77 行)在全仓生产代码中依然只有 0 个运行时调用方,FoldToReceipt / KeepRaw 仍停留在 turn_driver/ 而未接入既有上下文策略拥有者 quota/progressive_context.ts,DomainPluginCandidate / DomainPluginTrial(第 169–181 行)继续在测试外零引用地平行定义于 capabilities/goal_capability_organization.ts 之外,且 docs/architecture/rfcs/README.md 第 204–205 行未补充 Delivery on main / Current boundary 说明来隔离“提案设计”与“运行态契约”;因此当前 PR 仍需收敛为纯合规双语 RFC(移除未接线的生产 TS 契约、单测与占位类型)或真正接入至少一条真实生产调用链并清理孤立类型。 当前 PR 边界(current_pr_boundary):对本 PR 而言,最清洁且可立即合入的边界是“保留已修通治理检查的双语 RFC 与 STATUS.md 索引,补齐 docs/architecture/rfcs/README.md 的 Delivery on main: Proposal only / Current boundary 声明,并将未接线的 verifier_hook_contract.ts、单测及 QuotaGoalBoundaryReference 移出生产源码目录直到真实宿主或 progressive_context.ts 调用方同步落地”;宿主适配器实现、真实缓存收益与生产开关继续保留在后续切片。

与既有实现对比,仓库在 loopx/control_plane/quota/turn_envelope.ts 第 73 行已有 QUOTA_GOAL_BOUNDARY_ARTIFACT = "quota_should_run.goal_boundary" 并由 loopx/control_plane/quota/adaptive_children.ts 第 13、196 行在生产中实际消费;在 docs/architecture/rfcs/history-working-set-context-policy-v0.md §5.1 已明确将 {KeepRaw, FoldToReceipt, EpochReset} 归属给共享 TypeScript 投影拥有者 progressive_context.ts + context_delivery.ts + turn_envelope.ts;在 loopx/control_plane/capabilities/goal_capability_organization.ts 第 51 行已有 goal_capability_improvement_plan_v0;在 loopx/control_plane/work_items/yardstick_decision.ts 已有 WorkYardstickProfile。当前精确头在生产目录保留 185 行新增 TS 代码,却没有任何真实生产者或消费者触发其中任何一条函数或类型。

提案边界 RFC 设计职责 72c77567b0 代码与文档现状 既有所属拥有者与差距
Start / resume 通过原始 C1 capture 摘要与 /goal_boundary 读取作用域与停止条件 turn_envelope.ts 新增纯类型 QuotaGoalBoundaryReference(0 运行时调用),测试直接调用 capturedContextSelection adaptive_children.ts 已消费 QUOTA_GOAL_BOUNDARY_ARTIFACT,但新类型无生产调用者
Milestone probe 异步采样并回传平台期/快尺反转 仅联合类型 VerifierTransition(无生产实现) yardstick_decision.ts / stride_policy.ts
Compaction / subscope 独立非空作用域、角色/引用/身份均绑定的 FoldToReceipt / KeepRaw recommendVerifiedClose 校验逻辑与 7 条单测自洽,但 0 生产调用方 应归属 quota/progressive_context.ts(history-working-set-context-policy-v0.md §5.1)
Stop / Domain plugin 独立 Oracle 验收及内容寻址试跑准入 DomainPluginCandidate / DomainPluginTrial 0 生产调用方且 0 测试引用 平行重复 capabilities/goal_capability_organization.ts
RFC 索引治理 区分设计接受状态与 main 上真实交付边界 STATUS.md 与双语镜像检查已通过,但 README.md 缺 Delivery on main / Current boundary docs/architecture/rfcs/README.md 第 50–56、204–205 行

具体改动 / Changes

上一轮审查至本次精确头的增量变化(1b6514a6c1773855dcb1a0f921f62f899e6dd63a..72c77567b09f6ad69a0b56189db3ab3184086609)

增量提交(Require role- and scope-bound verifier evidence)修改 6 个文件(+100 / -27):

  1. RFC 头部与索引修复: 更新 docs/architecture/rfcs/verifier-hook-co-design-v0.md 与 .zh-CN.md(- **RFC status:** Accepted (upon merge)、**Supersedes / closes:** none、**Language mirror:** [中文版 — semantic mirror](...) 及正文第 44 行补充非空作用域与角色/引用/身份绑定要求),并同步更新 docs/architecture/rfcs/STATUS.md(Accepted (52) -> Accepted (53))与 STATUS.zh-CN.md(已接受 (52) -> 已接受 (53))。
  2. recommendVerifiedClose 强校验收口: 在 loopx/control_plane/turn_driver/verifier_hook_contract.ts 第 101–167 行引入 VerifiedScopeEvidence、scopeIdentityFields、matchesScope 与 matchesEvidence,在入口阻断空白 VerifiedScopeIdentity / receipt_ref,并要求 oracle_evidence、source、summary、counterexample 四类证据同时匹配 ref、role 与六元组 identity。
  3. 单测补齐: 在 tests/control_plane_ts/verifier_hook_contract.test.ts 第 108–145 行新增两条负向单测(跨角色/错引用/错作用域拒绝,以及空白身份不触发 readReceipt/readEvidence),使该文件单测从 5 条增至 7 条。

完整 PR 改动清单(相对基准 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d,8 个文件,+478 / -2)

  1. 文档与索引(5 个文件,+122/-2): docs/architecture/rfcs/verifier-hook-co-design-v0.md(58 行)、docs/architecture/rfcs/verifier-hook-co-design-v0.zh-CN.md(58 行)、docs/architecture/rfcs/README.md(+2 行,第 204–205 行)、docs/architecture/rfcs/STATUS.md(+2/-1)、docs/architecture/rfcs/STATUS.zh-CN.md(+2/-1)。
  2. 控制面 TypeScript 源码(2 个文件,+185/-0): loopx/control_plane/quota/turn_envelope.ts 第 74–77 行新增 QuotaGoalBoundaryReference(+4 行);新增 loopx/control_plane/turn_driver/verifier_hook_contract.ts(181 行)。
  3. TypeScript 单测(1 个文件,+171/-0): 新增 tests/control_plane_ts/verifier_hook_contract.test.ts(7 条单测),也是全仓唯一导入 verifier_hook_contract.ts 的文件。

关键代码讲解

  • matchesScope 与 matchesEvidence(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L120-L132): matchesScope 校验六元组身份字段逐一相等;matchesEvidence 先用 hasReference(ref) 过滤空白字符串,再通过 reader.readEvidence(ref) 核验返回对象的 evidence.ref === ref、evidence.role === role 且 matchesScope(identity, evidence.identity),消除了上一轮只判断布尔可读性而允许角色互换或跨作用域借用的问题。
  • recommendVerifiedClose(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L136-L167): 入口第 140–144 行先核验 request.identity 六个字段和 request.receipt_ref 全量满足 hasReference(typeof ref === "string" && ref.trim().length > 0),否则直接返回 { action: "KeepRaw" },既不访问权威存储也不再把全空/空白身份折叠为 FoldToReceipt。通过入口后依次校验回执身份匹配、failed 分支的 counterexample 证据角色绑定,以及 passed + !open_obligations + overlap === "low" + 三类证据全部通过 matchesEvidence。残留结构问题是该函数及其导出的 14+ 个类型至今无任何生产路径调用,且 FoldToReceipt 归属在 turn_driver/ 而非 progressive_context.ts。
  • QuotaGoalBoundaryReference(loopx/control_plane/quota/turn_envelope.ts#L74-L77): 位于既有生产常量 QUOTA_GOAL_BOUNDARY_ARTIFACT 下方,但全仓除 verifier_hook_contract.ts 第 3 行以 import type 引入外没有任何生产者或运行时读取方,甚至 verifier_hook_contract.test.ts 第 152 行也是直接内联 { capture_sha256, pointer: "/goal_boundary" } as const 字面量并调用 context_selection.ts 的 capturedContextSelection。
  • DomainPluginCandidate 与 DomainPluginTrial(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L169-L181): 定义了 staging / trial / adopted / retired 四态联合类型,不仅没有任何生产调用方,连 verifier_hook_contract.test.ts 也未引用它们,同时与既有能力组合模块 goal_capability_organization.ts 平行分叉。

规范基线映射(spec_basis)

依据基准 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d 上的规范入口 docs/architecture/rfcs/README.md(及其引用的 docs/development/README.md Scope-Fit Review 与 history-working-set-context-policy-v0.md §5.1)映射精确头 72c77567b09f6ad69a0b56189db3ab3184086609:

  • RFC-INDEX-HEADER -> implemented:双语 RFC 头部已补齐 Accepted (upon merge)、Supersedes / closes 与 semantic mirror / 语义镜像,STATUS.md / STATUS.zh-CN.md 已同步为 Accepted (53),generate_rfc_status_index.py --check 与 docs-governance-smoke.py 均在当前头实测通过。
  • RFC-BILINGUAL-PAIR -> implemented:英文与中文 RFC 镜像成对更新,并通过 scripts/check_rfc_bilingual.py --base origin/main --head HEAD。
  • RFC-MATURITY-SEPARATION -> not_met:docs/architecture/rfcs/README.md 第 50–56 行要求以 Delivery on main 与 Current boundary 明确隔离设计接受状态与实际交付边界,docs/development/README.md 第 131–137 行明确禁止将无真实生产调用方、仅靠单测覆盖的新模块留置控制面生产源码目录;当前头 README.md 第 204–205 行仍缺这两个成熟度说明条目,RFC 第 5 行标注 Delivery maturity: TypeScript contract,生产目录仍保留 185 行零调用方的 .ts 代码与未接入拥有者的 FoldToReceipt / DomainPluginTrial 类型。

对主干的风险 / Risks

阻塞发现(Findings)

  1. [P1 · 阻塞] 控制面生产目录保留零生产调用方的 verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 并分裂既有拥有者(原 Finding #2 仍未修复)

    • Problem: loopx/control_plane/turn_driver/verifier_hook_contract.ts(181 行)与 loopx/control_plane/quota/turn_envelope.ts 新增的 QuotaGoalBoundaryReference(第 74–77 行)仍然没有任何生产运行时调用者,且把属于 progressive_context.ts 与 goal_capability_organization.ts 的概念放在 turn_driver/。
    • Evidence: 在精确头 72c77567b0 执行全仓搜索 rg -n "verifier_hook_contract|QuotaGoalBoundaryReference|recommendVerifiedClose|negotiateVerifierHooks|verifier_hook" loopx tests packages apps scripts examples:生产代码仅有 turn_envelope.ts:74(定义)、verifier_hook_contract.ts:3(import type 引入 QuotaGoalBoundaryReference)、verifier_hook_contract.ts:20,136(导出函数定义),所有生产运行时模块(turn_driver/executor.py、turn_driver/loop_controller.ts、quota/progressive_context.ts、quota/adaptive_children.ts、capabilities/goal_capability_organization.ts、packages/、apps/)调用数为 0;唯一导入方仅是 tests/control_plane_ts/verifier_hook_contract.test.ts,其中第 169–181 行的 DomainPluginCandidate / DomainPluginTrial 连测试也未引用。同时 history-working-set-context-policy-v0.md §5.1 已将 FoldToReceipt / KeepRaw 归属 progressive_context.ts,goal_capability_organization.ts 已拥有 goal_capability_improvement_plan_v0。
    • Impact: 违反 scope_fit(无活跃生产调用方的纯测试覆盖模块不应进入生产路径,且无仓库/拥有者接受的 coverage-only 契约记录)、repository_reuse(unjustified_duplication)与 change_proportionality(simplify_now),会在没有真实消费者验证接口形状前冻结未接入的导出与双份生命周期类型。
    • Fix: 选择两条清晰路径之一完成收口:(a) 最简纯 RFC 方案(推荐): 移除 loopx/control_plane/turn_driver/verifier_hook_contract.ts、tests/control_plane_ts/verifier_hook_contract.test.ts 与 turn_envelope.ts 第 74–77 行无消费类型 QuotaGoalBoundaryReference,保留已过治理检查的双语 RFC 与 STATUS.md(若需示意签名可留在 RFC 正文中);或 (b) 端到端最小接线方案: 为 negotiateVerifierHooks / recommendVerifiedClose 接入至少一条真实生产读回路径(如 progressive_context.ts 与宿主能力协商读回),将 FoldToReceipt / KeepRaw 放回 progressive_context.ts,并删除零引用孤立类型 DomainPluginCandidate / DomainPluginTrial。
  2. [P2 · 阻塞(语义与交付边界隔离)] docs/architecture/rfcs/README.md 缺少 Delivery on main / Current boundary 说明,与 Delivery maturity: TypeScript contract 及 adopted/retired 命名不匹配

    • Problem: 新增 RFC 在索引页与成熟度声明上未按仓库约定隔离“已接受的设计提案”与“零生产调用方的当前现实”。
    • Evidence: docs/architecture/rfcs/README.md 第 50–56 行明确定义 Delivery on main 与 Current boundary 用来说明真实落地成熟度,第 190–220 行的同级 RFC 均包含这两项列表,唯独第 204–205 行的 [Verifier Hook Co-Design v0] 缺失;同时 verifier-hook-co-design-v0.md 第 5 行标注 Delivery maturity: TypeScript contract,verifier_hook_contract.ts 第 177–181 行导出 adopted / retired 阶段类型,但当前分支生产运行时调用为 0。
    • Impact: 导致 authority_semantics(命名/成熟度表述高于实际零运行代码能力)与 RFC-MATURITY-SEPARATION 不满足。
    • Fix: 在 docs/architecture/rfcs/README.md 第 204–205 行补齐 - **Delivery on \main`:** Proposal only; no runtime verifier hook adapter or caller is wired.与- Current boundary: ...;若按 Finding 1(a) 移除 .ts雏形,将verifier-hook-co-design-v0.md第 5 行及中文第 5 行同步改为Proposal(或若按 1(b) 接线,如实写明仅接线的精确范围),并重跑 generate_rfc_status_index.py --check与docs-governance-smoke.py`。

前轮修复确认与边界隔离检查

  • 已修复项复核:
    • scripts/generate_rfc_status_index.py --check:由 1b6514a6c1 的 exit 1 变为 PASS(exit 0)。
    • examples/docs-governance-smoke.py:由 1b6514a6c1 的 AssertionError 变为 PASS(docs-governance-smoke ok)。
    • recommendVerifiedClose 空白身份反例探测:传入全空/空白 VerifiedScopeIdentity 在 72c77567b0 实测返回 {"action":"KeepRaw"}(1b6514a6c1 曾误返回 FoldToReceipt),角色互换/错作用域/空引用负向单测均通过。
  • 默认关闭隔离(default_off_isolation): negotiateVerifierHooks({ enabled: false, pre_tool_use: true }, ...) 返回 null,且生产代码无任何路径导入 verifier_hook_contract.ts 或使用 QuotaGoalBoundaryReference,既有默认运行时行为保持不变(既有 TS 套件 175 条全部通过)。
  • 权限语义(authority_semantics): 尽管 RFC 声明观测不能篡改 C1/Todo/结算,但 Delivery maturity: TypeScript contract 与未测试零调用方的 DomainPluginTrial(adopted/retired)结合缺失的 README.md Delivery on main 声明,仍构成名实不符(misleading)。

语义与 CI 对齐

  • 语义词表扫描边界: scripts/generate_semantic_inventory.py --changed-from origin/main(基线 b375539271b4cb9f34386a77211a944ce6e05ffe)扫描 18 个快照报告 supported candidates: 0,examples/semantic-vocabulary-drift-smoke.py 通过(29/29 词表、56/56 拥有者符号均通过)。需提示 verifier_hook_contract.ts 使用内联 TS 字符串联合类型(tier、overlap、verdict、action、role、stage、kind、boundary),处于该脚本 AST 扫描盲区之外;如保留并接线 TS 代码,须与 progressive_context.ts 及 goal_capability_organization.ts 词表统一归口。
  • CI 策略说明(wait_for_ci: false): 本复审按仓库本地优先策略不轮询远端 GitHub Actions CI。canary premerge 执行 4/4 直接检查、9/9 目录金丝雀、8/8 风险烟雾与 1/1 公开边界检查全部通过(因缺少精确 diff 的 change-quality 回执返回 quality_receipt_missing,退出码 1)。

本地验证汇总(精确头 72c77567b09f6ad69a0b56189db3ab3184086609,wait_for_ci: false)

  • uv run --extra test python scripts/generate_rfc_status_index.py --check:PASS(exit 0)
  • uv run --extra test python examples/docs-governance-smoke.py:PASS(docs-governance-smoke ok)
  • uv run --extra test python scripts/check_rfc_bilingual.py --base origin/main --head HEAD:PASS
  • uv run --extra test python examples/semantic-vocabulary-drift-smoke.py:PASS(29/29 vocabularies, 56/56 owner symbols)
  • npm run typecheck:control-plane:PASS
  • node --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/verifier_hook_contract.test.ts:PASS(7/7 passed)
  • 关联 7 个 TS 套件联合执行(verifier_hook_contract、yardstick_decision、post_writeback_hook_transaction、context_delivery、progressive_context、turn_envelope、context_selection):PASS(182/182 passed)
  • 反例探测(recommendVerifiedClose 传入全空/空白 VerifiedScopeIdentity):PASS(返回 {"action":"KeepRaw"},未调用 readReceipt/readEvidence)
  • uv run --extra test python -m ruff check tests/control_plane_ts loopx/control_plane/turn_driver loopx/control_plane/quota docs/architecture/rfcs:PASS
  • uv run --extra test python -m mypy:PASS(17 source files)
  • uv run --extra test loopx check --scan-path ...(全部 8 个改动文件公开边界扫描):PASS(0 errors, 5 checks)
  • uv run --extra test python -m pytest -q tests/canary/test_rfc_bilingual.py tests/architecture/test_rfc_status_index.py tests/architecture/test_contributor_task_board.py tests/architecture/test_top_level_module_budget.py tests/architecture/test_control_plane_import_boundaries.py tests/architecture/test_content_digest_single_owner.py tests/architecture/test_semantic_vocabulary_drift.py:PASS(460 passed)
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main:direct_checks 4/4、catalog_canaries 9/9、risk_profile_smokes 8/8、public_boundary 1/1 均 PASS(总状态 quality_receipt_missing,退出码 1)
  • 全仓生产调用方检查(rg -n "verifier_hook_contract|QuotaGoalBoundaryReference|recommendVerifiedClose|negotiateVerifierHooks|verifier_hook" loopx tests packages apps scripts examples):FAIL(verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 在生产路径均为 0 调用方,DomainPluginCandidate / DomainPluginTrial 连测试也未引用)

我的整体评价 / Verdict

对精确头 72c77567b09f6ad69a0b56189db3ab3184086609 复审后确认,上一轮指出的 RFC 索引与双语镜像治理失败 以及 recommendVerifiedClose 空白身份/跨角色证据校验缺陷 已完全修复并通过本地全部对应测试与脚本;但 生产源码目录仍保留零生产调用方、分裂 progressive_context.ts / goal_capability_organization.ts 所有权的 verifier_hook_contract.ts 与编译期占位 QuotaGoalBoundaryReference(且 docs/architecture/rfcs/README.md 缺少 Delivery on main / Current boundary 声明),按控制面 scope_fit、repository_reuse 与 change_proportionality 门禁仍需先完成收口,建议 REQUEST_CHANGES。

  • 长程与用户体验影响(outcome_impact): long_horizon 为 not_yet_proven(verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 仍无任何生产运行时调用方,DomainPluginTrial 也无任何执行/测试路径,尚未在真实 Turn 或上下文投影链路上验证成效);user_experience 为 not_applicable,且 visual_review 为 not_applicable(本次复审覆盖全部 8 个改动文件,未修改任何前端、Dashboard、Chat 或 CLI 渲染界面,无 UI 截屏遗漏)。
  • 可观测语义与代码体积(observable_semantics / code_volume / change_proportionality): 现有主干运行时行为与 RFC 文档治理检查均已确认无退化(175 条既有 TS 单测、460 条架构测试、RFC 治理脚本全通过),但因新增 TS 契约毫无生产调用方,其真实路径可观测语义仍属 not_yet_proven。185 行控制面生产目录 TS 代码与 171 行测试在零生产调用方与零宿主适配器的状态下属 partly_avoidable / simplify_now / disproportionate,其中 compatibility_assessment 为 not_applicable(纯新增未调用文件与纯编译期类型,不涉及存量持久化协议兼容)。
  • 词表归属(semantic_alignment): 当前词表仍停留在未调用 TS 文件中的 local_only 内联字符串联合(AST 扫描报 0 候选),正式接入生产时必须并入 progressive_context.ts 与 goal_capability_organization.ts 的注册词表。
  • 下一轮复审与合入所需证据: (1) 按 Finding 1 抉择其一:要么删除未接线的 verifier_hook_contract.ts、verifier_hook_contract.test.ts 与未消费类型 QuotaGoalBoundaryReference,使本 PR 成为纯粹的架构设计 RFC;要么至少接入一条真实生产调用方、把 FoldToReceipt 归口 progressive_context.ts 并移除零引用平行类型 DomainPluginTrial;(2) 按 Finding 2 在 docs/architecture/rfcs/README.md 第 204–205 行补充 Delivery on main 与 Current boundary 描述并统一 RFC 第 5 行成熟度标签;(3) 重跑 generate_rfc_status_index.py --check、docs-governance-smoke.py、check_rfc_bilingual.py 与精确 diff 的 canary premerge。
  • 声明与新鲜度: 本评审在绑定信息不可用(session_not_bound)的情况下以 self_reported 声明模型身份;未等待也未查询远端 GitHub Actions CI(wait_for_ci: false)。当前结果仅对应精确提交 72c77567b09f6ad69a0b56189db3ab3184086609。

英文简短结论:
English verdict: REQUEST_CHANGES at head 72c7756. Two prior blockers from 1b6514a are verified resolved: (a) scripts/generate_rfc_status_index.py --check and examples/docs-governance-smoke.py now pass with updated Accepted RFC headers, semantic-mirror links, and STATUS.md; (b) recommendVerifiedClose now rejects blank VerifiedScopeIdentity fields up front (returning KeepRaw in counterfactual probe without calling readReceipt/readEvidence) and binds VerifiedScopeEvidence by ref, role, and identity (7/7 unit tests pass; 182/182 across 7 TS suites pass). However, two blockers remain: (1) scope_fit / repository_reuse / change_proportionality (simplify_now): loopx/control_plane/turn_driver/verifier_hook_contract.ts (181 lines) and QuotaGoalBoundaryReference in turn_envelope.ts still have zero runtime production callers across loopx/, packages/, apps/, and scripts/, split FoldToReceipt/KeepRaw ownership away from progressive_context.ts, and leave unused DomainPluginCandidate/DomainPluginTrial outside goal_capability_organization.ts; (2) authority_semantics / RFC-MATURITY-SEPARATION: docs/architecture/rfcs/README.md lacks Delivery on main / Current boundary lines while RFC line 5 states Delivery maturity: TypeScript contract. Local checks: check_rfc_bilingual.py, semantic-vocabulary-drift-smoke.py, typecheck:control-plane, ruff, mypy (17 files), loopx check (8 files), 460/460 architecture pytest cases, and canary premerge (4 direct + 18 selected checks; exit 1 only on quality_receipt_missing) all passed.

@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.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

维护者需要知道当前 Hook 方案可检验的范围,以及未来由哪个已有机制接续。上一头的 RFC 治理和空身份折叠问题已实测修复。 当前需要准确展示已交付范围,并避免把尚无实际调用方的能力试跑阶段固化成并行公共契约。

状态索引和语义镜像已修复。架构入口在两条相邻 RFC 之间新增 Verifier Hook 链接,正文已有成熟度说明,但入口缺少规范要求的主干交付状态和当前边界,读者须进入正文才能知道两种 helper 尚无生产接线。 本次评审限于 RFC 与 TypeScript 契约,运行态接线另需验证。

改动思路 / Approach

保留能独立验证的协商和折叠条件。C1 管权限和结算,独立 Oracle 负责证据,工作集接线后才应用建议。在 RFC 清单条目补充 Delivery on main 与 Current boundary,指明已验证的 TypeScript 契约和仍待验证的 Host、Oracle 与历史工作集接线。 保留 RFC 的生命周期设计,将两个未使用的类型随实际能力组合消费方一起引入,并复用已有 trial basis;当前可执行的 tier 协商和 VerifiedClose 拒绝条件可以保留。

新增的 DomainPluginCandidate 和 DomainPluginTrial 只在声明处出现,现有测试也没有使用。已有 capability trial planner 从版本、配置、effect、rollback 与反馈绑定判断是否建议试跑;新增 staging、trial、adopted、retired 类型只携带自由字符串引用,当前没有生产者把它与已有 trial basis 建立关系。

具体改动 / Changes

完整评审头 72c77567b09f6ad69a0b56189db3ab3184086609,基线 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d,共 8 个文件,+478/-2。状态索引和语义镜像已修复。架构入口在两条相邻 RFC 之间新增 Verifier Hook 链接,正文已有成熟度说明,但入口缺少规范要求的主干交付状态和当前边界,读者须进入正文才能知道两种 helper 尚无生产接线。 新增的 DomainPluginCandidate 和 DomainPluginTrial 只在声明处出现,现有测试也没有使用。已有 capability trial planner 从版本、配置、effect、rollback 与反馈绑定判断是否建议试跑;新增 staging、trial、adopted、retired 类型只携带自由字符串引用,当前没有生产者把它与已有 trial basis 建立关系。 当前索引 · 基线规范 · 既有能力试跑 owner

关键代码讲解

  • rfc-active-governance。Active RFC、新双语镜像和生成索引均可正常验证。
  • verified-close-exact-identity。拒绝不完整身份后才读取票据,并按引用、角色及作用域绑定证据。36 项空值、空白或缺失身份检查以及 12 项证据绑定负例全部保留原文。完整匹配仍能返回折叠建议,关闭策略返回空。RFC 生成索引及语义镜像通过。 折叠建议
  • verifier-negotiation-off。关闭分支返回空,现有 C1 和历史权威路径未接到新 helper。
  • rfc-delivery-boundary。架构入口缺少交付范围和当前边界。 规范
  • capability-trial-ownership。未使用的试跑阶段类型与已有决策的证据绑定须收口。 新类型

对主干的风险 / Risks

[P2] 架构索引缺少当前交付边界。 状态索引和语义镜像已修复。架构入口在两条相邻 RFC 之间新增 Verifier Hook 链接,正文已有成熟度说明,但入口缺少规范要求的主干交付状态和当前边界,读者须进入正文才能知道两种 helper 尚无生产接线。 在 RFC 清单条目补充 Delivery on main 与 Current boundary,指明已验证的 TypeScript 契约和仍待验证的 Host、Oracle 与历史工作集接线。

[P2] 暂缓没有生产者或消费者的试跑类型。 新增的 DomainPluginCandidate 和 DomainPluginTrial 只在声明处出现,现有测试也没有使用。已有 capability trial planner 从版本、配置、effect、rollback 与反馈绑定判断是否建议试跑;新增 staging、trial、adopted、retired 类型只携带自由字符串引用,当前没有生产者把它与已有 trial basis 建立关系。 保留 RFC 的生命周期设计,将两个未使用的类型随实际能力组合消费方一起引入,并复用已有 trial basis;当前可执行的 tier 协商和 VerifiedClose 拒绝条件可以保留。

当前八文件增量的 119 项 TypeScript、类型检查、双语和文档治理通过。预合并 4 项直接检查、18 项选定检查通过。严格资格为 quality_receipt_missing,真实宿主与成果/成本尚待验证。

我的整体评价 / Verdict

请求有界修改。文档状态和精确身份两项旧缺陷已修复。现有证据支持保留已测试的纯决策契约。先补索引与未使用的试跑类型边界,再在各自 owner 下交付未来的运行态接线。

English verdict: REQUEST_CHANGES at 72c7756. The former governance and blank-identity failures are fixed. Document the actual main-branch boundary in the RFC index and keep the unconsumed domain-trial lifecycle out of production exports until it can reuse the existing trial basis. Both tested pure decisions can remain.

Comment thread docs/architecture/rfcs/README.md Resolved

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

动机 / Motivation

在长程求解任务中,控制面与宿主维护者在启用多轮探索与独立验收时,往往只能在粗糙的 Stop-Hook 兜底验证与同步逐工具拦截之间二选一;缺乏跨宿主的四边界验证 Hook 协同契约,也缺乏“子作用域须经独立 Oracle 回执且满足低重叠后才折叠”的 VerifiedClose 约束,因此本 PR 试图把验证接入收敛到既有 C1 与历史上下文边界之下。

如果不做任何改动,外部宿主(如 Codex、Claude Code、DSH、Antigravity)上的验证探测、子作用域折叠以及领域快尺(yardstick)试跑仍各自依赖局部协议或散落脚本,既难对齐能力协商档位,也容易让未验证的代理结果或跨作用域回执污染主干上下文。

  • 受影响对象(affected_caller_or_operator): 接入宿主 Hook 生命周期(启动、里程碑、压缩/子作用域与停止边界)并消费独立验收回执的 LoopX 控制面、宿主适配器与实验评估维护者。
  • 前后对比场景(before_after_scenario): 改动前,不同宿主各自实现启动上下文恢复、里程碑采样、压缩后恢复与停止验收,子工作折叠与快尺试跑缺少统一的不变式边界;理想改进是先合入合规的双语架构 RFC 再在真实拥有者上接线落地,而当前 PR 在最新精确头 4a67ad5a110ed7b73b715e2315334aa462a9cc44 上虽进一步将 candidate_sha 收口为复用 content_digest.ts 的规范 sha256:<64 hex> 摘要校验,却完全未触动上一轮已经明确阻塞的两大问题——docs/architecture/rfcs/README.md 第 204–205 行依然缺少 Delivery on main 与 Current boundary 声明,且控制面生产目录仍保留零运行时调用方的 verifier_hook_contract.ts、仅作编译期导出的 QuotaGoalBoundaryReference、以及零测试零调用方的平行类型 DomainPluginCandidate / DomainPluginTrial(FoldToReceipt 亦未归口 progressive_context.ts)。
  • 可观测结果(observable_outcome): 相对上一轮头 72c77567b09f6ad69a0b56189db3ab3184086609,最新提交 4a67ad5a110ed7b73b715e2315334aa462a9cc44 在 RFC §3 与 recommendVerifiedClose 中复用 ENVELOPED_SHA256_PATTERN 拦截非摘要的分支名或标签(verifier_hook_contract.test.ts 增至 8/8 通过,反例探测均在读取权威前返回 KeepRaw);但上一轮审查 6011989660 的两项阻塞以及两条仍未解决的评审线程(README.md:205 缺失主干交付边界、verifier_hook_contract.ts:180 存在未消费的 DomainPluginTrial 类型)均原封不动存在,全仓生产路径对 verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 仍只有 0 个运行时调用方。
  • 非目标(non_goals): 本次变更不改变 C1 准入、传输或结算所有权,不实现具体宿主适配器(Codex、DSH、Claude Code、Antigravity)运行时代码,不启用新默认开关,也不开展跨宿主或同宿主模型效果/缓存对照实验。

改动思路 / Approach

本次对精确头 4a67ad5a110ed7b73b715e2315334aa462a9cc44 执行全包独立复审(rereview_pull_request_exact_head),先评估最新增量提交 Bind verified close to immutable candidate digests,再对 6011989660 及现有未解决评审线程涉及的全量阻塞项进行逐一复核。

本轮增量改动评估(72c77567b0 -> 4a67ad5a11):
作者将 VerifiedScopeIdentity.candidate_sha 明确约束为 sha256:<64 lowercase hexadecimal digits> 不可变内容摘要,并在 verifier_hook_contract.ts 第 3、144 行复用既有单一规范所有者 loopx/control_plane/content_digest.ts 的 ENVELOPED_SHA256_PATTERN(在 readReceipt / readEvidence 之前拒绝分支名、标签、裸 64 位十六进制串等输入),同时将 RFC 第 44 行双语同步并补齐第 8 条单测。这部分摘要单一所有者复用和防误读拒绝逻辑本身严谨且实测通过。

然而从架构与比例性(architecture_assessment)及仓库 Scope-Fit Review 规则审视当前完整精确头,最新提交并未解决上一轮已经指出的两项阻塞与两条未解决线程:loopx/control_plane/turn_driver/verifier_hook_contract.ts(184 行)与 loopx/control_plane/quota/turn_envelope.ts 新增的 QuotaGoalBoundaryReference(第 74–77 行)在全仓生产代码中依然只有 0 个运行时调用方,FoldToReceipt / KeepRaw 仍停留在 turn_driver/ 而未接入既有上下文策略拥有者 quota/progressive_context.ts,DomainPluginCandidate / DomainPluginTrial(第 172–184 行)依然没有任何测试或生产调用方并平行重复 capabilities/goal_capability_organization.ts,且 docs/architecture/rfcs/README.md 第 204–205 行仍缺少 Delivery on main / Current boundary 边界说明;因此本 PR 仍不能合入,应先移除未接线的生产 TS 代码、单测与未消费类型以纯 RFC 落地(或在当前 PR 中至少接入真实生产调用方、归口拥有者并删除孤立类型),同时在 README.md 补全交付成熟度边界。 当前 PR 边界(current_pr_boundary):对当前设计阶段的 PR 而言,唯一干净可立即合入的边界是“保留已通过治理检查与摘要约束对齐的双语 RFC 与 STATUS.md 索引,在 docs/architecture/rfcs/README.md 第 204–205 行补全 Delivery on main: Proposal only 与 Current boundary,并把零生产调用方的 verifier_hook_contract.ts、单测及占位类型 QuotaGoalBoundaryReference 移出生产源码目录直到真实宿主或 progressive_context.ts 调用方同步落地”(或者相反地在保留源码时至少打通一条真实生产调用方、将 FoldToReceipt 归口 progressive_context.ts 并删除未消费的 DomainPluginCandidate / DomainPluginTrial)。

与既有实现对比,本轮作者在 verifier_hook_contract.ts 第 3 行正确复用了 ../content_digest.ts 的 ENVELOPED_SHA256_PATTERN(避免正则分叉,test_content_digest_single_owner.py 通过),但围绕核心业务所有权的关键结构分裂仍然未变:QUOTA_GOAL_BOUNDARY_ARTIFACT 在 loopx/control_plane/quota/adaptive_children.ts 有真实生产消费而 QuotaGoalBoundaryReference 为 0 运行时调用;history-working-set-context-policy-v0.md §5.1 指定的 FoldToReceipt / KeepRaw 所有者是 progressive_context.ts 而非 turn_driver/;capabilities/goal_capability_organization.ts 已拥有试跑决策逻辑,而 DomainPluginCandidate / DomainPluginTrial 仍滞留在 verifier_hook_contract.ts 尾部无任何消费者。

提案边界 RFC 设计职责 4a67ad5a11 代码与文档现状 既有所属拥有者与差距
Start / resume 通过原始 C1 capture 摘要与 /goal_boundary 读取作用域与停止条件 turn_envelope.ts 新增纯类型 QuotaGoalBoundaryReference(0 运行时调用),测试直接调用 capturedContextSelection adaptive_children.ts 已消费 QUOTA_GOAL_BOUNDARY_ARTIFACT,新类型仍无生产调用方
Milestone probe 异步采样并回传平台期/快尺反转 仅联合类型 VerifierTransition(无生产实现) yardstick_decision.ts / stride_policy.ts
Compaction / subscope sha256:<64 hex> 不可变 candidate_sha、非空作用域与角色绑定的 FoldToReceipt / KeepRaw 本轮复用 ENVELOPED_SHA256_PATTERN 校验逻辑正确且 8 条单测通过,但全仓 0 生产调用方 应归属 quota/progressive_context.ts(history-working-set-context-policy-v0.md §5.1)
Stop / Domain plugin 独立 Oracle 验收及内容寻址试跑准入 DomainPluginCandidate / DomainPluginTrial(第 172–184 行)0 生产调用方且 0 测试引用 平行重复 capabilities/goal_capability_organization.ts(未解决线程 README 同步滞后)
RFC 索引治理 区分设计接受状态与 main 上真实交付边界 STATUS.md 与双语治理检查通过,但 README.md:204-205 仍缺 Delivery on main / Current boundary docs/architecture/rfcs/README.md 第 50–56、204–205 行

具体改动 / Changes

上一轮审查至本次精确头的增量变化(72c77567b09f6ad69a0b56189db3ab3184086609..4a67ad5a110ed7b73b715e2315334aa462a9cc44)

增量提交(Bind verified close to immutable candidate digests)修改 4 个文件(+28 / -4):

  1. 双语 RFC 摘要格式收敛: docs/architecture/rfcs/verifier-hook-co-design-v0.md 与 .zh-CN.md 第 44 行明确 candidate_sha 为 sha256:<64 lowercase hexadecimal digits>(sha256:<64 位小写十六进制字符>),并在读取回执前检查格式,分支名、标签等非摘要标识保持 KeepRaw。
  2. 复用单一摘要正则拥有者: loopx/control_plane/turn_driver/verifier_hook_contract.ts 第 3 行导入 ../content_digest.ts 的 ENVELOPED_SHA256_PATTERN,第 75 行补充 JSDoc,第 144 行在调用 reader.readReceipt 之前执行 ENVELOPED_SHA256_PATTERN.test(expected.candidate_sha)。
  3. 补充负向单测: tests/control_plane_ts/verifier_hook_contract.test.ts 更新合法夹具 candidate_sha 为 "sha256:" + "a".repeat(64),并新增第 8 条单测验证 "main"、"candidate:26"、裸 64 位 hex、63 位 hex、非 hex 与大写 hex 均在不触及 readReceipt/readEvidence 的前提下返回 KeepRaw。
  4. 未处理的上一轮阻塞与未解决线程: 未修改 docs/architecture/rfcs/README.md(对应上一轮 Finding #2 与未解决线程);未移除也未接线 verifier_hook_contract.ts、QuotaGoalBoundaryReference 及未使用的 DomainPluginCandidate / DomainPluginTrial(对应上一轮 Finding #1 与未解决线程)。

完整 PR 改动清单(相对基准 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d,8 个文件,+506 / -2)

  1. 文档与索引(5 个文件,+122/-2): docs/architecture/rfcs/verifier-hook-co-design-v0.md(58 行)、docs/architecture/rfcs/verifier-hook-co-design-v0.zh-CN.md(58 行)、docs/architecture/rfcs/README.md(+2 行,第 204–205 行)、docs/architecture/rfcs/STATUS.md(+2/-1)、docs/architecture/rfcs/STATUS.zh-CN.md(+2/-1)。
  2. 控制面 TypeScript 源码(2 个文件,+188/-0): loopx/control_plane/quota/turn_envelope.ts 第 74–77 行新增 QuotaGoalBoundaryReference(+4 行);新增 loopx/control_plane/turn_driver/verifier_hook_contract.ts(184 行)。
  3. TypeScript 单测(1 个文件,+196/-0): 新增 tests/control_plane_ts/verifier_hook_contract.test.ts(8 条单测),是全仓唯一导入 verifier_hook_contract.ts 的文件。

关键代码讲解

  • ENVELOPED_SHA256_PATTERN 复用与 recommendVerifiedClose 入口门控(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L1-L4, L138-L147): 复用 content_digest.ts 第 2 行的 /^sha256:[0-9a-f]{64}$/,在读取回执和证据前先确认 request.identity 六字段全部非空白、expected.candidate_sha 匹配 ENVELOPED_SHA256_PATTERN 且 request.receipt_ref 非空白,不满足直接返回 { action: "KeepRaw" },避免把可变分支名/tag 误当不可变候选摘要。
  • 尚未接线的控制面模块与类型集合(loopx/control_plane/turn_driver/verifier_hook_contract.ts#L1-L184 & loopx/control_plane/quota/turn_envelope.ts#L74-L77): 全文件 negotiateVerifierHooks、recommendVerifiedClose、QuotaGoalBoundaryReference 仍无任何生产调用方;尾部的 DomainPluginCandidate / DomainPluginTrial(第 172–184 行)甚至没有任何测试引用。

规范基线映射(spec_basis)

依据基准 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d 上的规范入口 docs/architecture/rfcs/README.md(及其引用的 docs/development/README.md Scope-Fit Review 与 history-working-set-context-policy-v0.md §5.1)映射精确头 4a67ad5a110ed7b73b715e2315334aa462a9cc44:

  • RFC-INDEX-HEADER -> implemented:双语 RFC 头部已补齐 Accepted (upon merge)、Supersedes / closes 与 semantic mirror / 语义镜像,STATUS.md / STATUS.zh-CN.md 已同步为 Accepted (53),generate_rfc_status_index.py --check 与 docs-governance-smoke.py 均通过。
  • RFC-BILINGUAL-PAIR -> implemented:英文与中文 RFC 镜像成对更新(包括第 44 行摘要格式补充),scripts/check_rfc_bilingual.py --base origin/main --head HEAD 通过。
  • RFC-MATURITY-SEPARATION -> not_met:docs/architecture/rfcs/README.md 第 50–56 行要求在索引条目以 Delivery on main 与 Current boundary 隔离设计提案与已实现边界,docs/development/README.md 第 131–137 行禁止在没有真实调用方时把仅靠单测覆盖的新模块留置控制面生产源码目录;当前头 README.md 第 204–205 行仍缺这两项说明,RFC 第 5 行仍标注 Delivery maturity: TypeScript contract,且生产目录仍保留 188 行零生产调用方的 TS 代码、未归口的 FoldToReceipt 与零测试的 DomainPluginTrial 类型。

对主干的风险 / Risks

阻塞发现(Findings)

  1. [P1 · 阻塞] 控制面生产目录仍保留零生产调用方的 verifier_hook_contract.ts、QuotaGoalBoundaryReference 与零测试平行类型 DomainPluginTrial(原 Finding #1 未修复)

    • Problem: 尽管第 4 次提交强化了 candidate_sha 摘要格式检查,但 loopx/control_plane/turn_driver/verifier_hook_contract.ts(184 行)与 loopx/control_plane/quota/turn_envelope.ts 第 74–77 行的 QuotaGoalBoundaryReference 在全仓生产代码中依然没有任何运行时调用方,且 FoldToReceipt 与 DomainPluginTrial 继续脱离各自既有的真实拥有者。
    • Evidence: 在精确头 4a67ad5a110ed7b73b715e2315334aa462a9cc44 执行全仓检索 rg -n "verifier_hook_contract|QuotaGoalBoundaryReference|recommendVerifiedClose|negotiateVerifierHooks|DomainPluginTrial|DomainPluginCandidate" loopx tests packages apps scripts:命中仅限于 verifier_hook_contract.ts 自身导出、turn_envelope.ts:74(纯类型定义)与 tests/control_plane_ts/verifier_hook_contract.test.ts,全仓生产代码调用数为 0;其中 DomainPluginCandidate / DomainPluginTrial(第 172–184 行)连单测也完全没有引用。同时 history-working-set-context-policy-v0.md §5.1 已明确将 KeepRaw / FoldToReceipt 归属给 quota/progressive_context.ts,capabilities/goal_capability_organization.ts 已拥有试跑决策逻辑,远端评审线程 verifier_hook_contract.ts:180 亦保持未解决且未过时状态。
    • Impact: 违反 scope_fit(无活跃生产调用方的纯测试模块不应滞留生产路径)、repository_reuse(unjustified_duplication)与 change_proportionality(simplify_now),在没有真实生产消费者前提前冻结跨模块导出与并行生命周期类型。
    • Fix: 二选一彻底收口:(a) 最简纯 RFC 方案(推荐): 删除 loopx/control_plane/turn_driver/verifier_hook_contract.ts、tests/control_plane_ts/verifier_hook_contract.test.ts 与 turn_envelope.ts 第 74–77 行无消费类型 QuotaGoalBoundaryReference,保留已过治理检查的双语 RFC 与 STATUS.md;或 (b) 端到端最小接线方案: 将 negotiateVerifierHooks / recommendVerifiedClose 真正接入至少一条生产路径(如 progressive_context.ts 与宿主能力读回),将 FoldToReceipt / KeepRaw 归口 progressive_context.ts,并移除零调用零测试的 DomainPluginCandidate / DomainPluginTrial。
  2. [P2 · 阻塞] docs/architecture/rfcs/README.md 仍缺少 Delivery on main / Current boundary 声明,成熟度边界与命名语义失配(原 Finding #2 未修复)

    • Problem: 新增 RFC 在架构总索引条目中仍缺少仓库规范要求的当前主干交付范围与边界说明,使 README.md 与 Delivery maturity: TypeScript contract / adopted 生命周期命名之间继续存在口径错位。
    • Evidence: docs/architecture/rfcs/README.md 第 50–56 行明确定义 Delivery on main 与 Current boundary 用途,第 190–220 行同级条目均成对声明这两行,而第 204–205 行的 [Verifier Hook Co-Design v0] 仍为空白链接(对应远端未解决且未过时的评审线程);同时 verifier-hook-co-design-v0.md 第 5 行仍标注 Delivery maturity: TypeScript contract,verifier_hook_contract.ts 第 180–184 行仍导出无生产调用方的 adopted / retired 阶段。
    • Impact: 不满足 RFC-MATURITY-SEPARATION 与 authority_semantics(misleading),读者在索引入口无法获知当前在 main 上零生产接入的真实状态。
    • Fix: 在 docs/architecture/rfcs/README.md 第 204–205 行补充 - **Delivery on \main`:**与- Current boundary:两行(若采纳 Finding 1(a) 移出.ts文件则标为Proposal only,且同步将 EN/ZH RFC 第 5 行改为 Proposal;若采纳 1(b) 接线则如实写出已接线的精确范围与未验证项),随后重跑 generate_rfc_status_index.py --check与docs-governance-smoke.py`。

边界隔离与语义对齐

  • 本轮增量亮点(candidate_sha 摘要校验): recommendVerifiedClose 复用 content_digest.ts 的 ENVELOPED_SHA256_PATTERN 在进入存储读取前拒绝非规范 sha256:<64 hex> 字符串(5 条 digest_probe 反例均输出 {"action":"KeepRaw"} 且未访问权威存储),test_content_digest_single_owner.py(包含于 460 条架构测试)通过。
  • 默认关闭隔离(default_off_isolation): negotiateVerifierHooks({ enabled: false, pre_tool_use: true }, ...) 返回 null,生产代码对 verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 调用数为 0,现有运行时默认行为保持完全隔离(既有 175 条控制面 TS 单测全通过)。
  • 语义词表扫描边界: scripts/generate_semantic_inventory.py --changed-from origin/main(基线 4ae2844cd03dd2d027eda68d5b870e2b652f6ac3)扫描 25 个快照报告 supported candidates: 0,examples/semantic-vocabulary-drift-smoke.py 通过(29/29 词表、56/56 拥有者符号)。因脚本仅扫描 Python Enum/Literal/集合与 TS as const 数组,若后续保留并接线 TS 代码,须将状态字面量与既有拥有者词表对齐。
  • CI 策略说明(wait_for_ci: false): 不等待或查询远端 GitHub Actions CI;本地 canary premerge 4 项直接检查、9 项金丝雀、8 项风险烟雾与 1 项公开边界扫描全通过(因缺乏精确 diff 的 change-quality 回执返回 quality_receipt_missing,退出码 1)。

本地验证汇总(精确头 4a67ad5a110ed7b73b715e2315334aa462a9cc44,wait_for_ci: false)

  • uv run --extra test python scripts/generate_rfc_status_index.py --check:PASS(exit 0)
  • uv run --extra test python examples/docs-governance-smoke.py:PASS(docs-governance-smoke ok)
  • uv run --extra test python scripts/check_rfc_bilingual.py --base origin/main --head HEAD:PASS
  • uv run --extra test python examples/semantic-vocabulary-drift-smoke.py:PASS(29/29 vocabularies, 56/56 owner symbols)
  • npm run typecheck:control-plane:PASS
  • node --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/verifier_hook_contract.test.ts:PASS(8/8 passed)
  • 关联 8 个 TS 套件联合执行(verifier_hook_contract、yardstick_decision、post_writeback_hook_transaction、context_delivery、progressive_context、turn_envelope、context_selection、content_digest):PASS(183/183 passed)
  • digest_probe 反例探测(""、" "、"main"、"candidate:26"、裸 64 位 hex):PASS(5/5 返回 {"action":"KeepRaw"} 且 0 权威读取)
  • uv run --extra test python -m ruff check tests/control_plane_ts loopx/control_plane/turn_driver loopx/control_plane/quota docs/architecture/rfcs:PASS
  • uv run --extra test python -m mypy:PASS(17 source files)
  • uv run --extra test loopx check --scan-path ...(全部 8 个改动文件公开边界扫描):PASS(0 errors, 5 checks)
  • uv run --extra test python -m pytest -q tests/canary/test_rfc_bilingual.py tests/architecture/test_rfc_status_index.py tests/architecture/test_contributor_task_board.py tests/architecture/test_top_level_module_budget.py tests/architecture/test_control_plane_import_boundaries.py tests/architecture/test_content_digest_single_owner.py tests/architecture/test_semantic_vocabulary_drift.py:PASS(460 passed in 59.26s)
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main:direct_checks 4/4、catalog_canaries 9/9、risk_profile_smokes 8/8、public_boundary 1/1 均 PASS(总状态 quality_receipt_missing,退出码 1)
  • 全仓生产调用方扫描(rg -n "verifier_hook_contract|QuotaGoalBoundaryReference|recommendVerifiedClose|negotiateVerifierHooks|DomainPluginTrial|DomainPluginCandidate" loopx tests packages apps scripts):FAIL(verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 均为 0 生产调用方,DomainPluginCandidate / DomainPluginTrial 连测试也未引用)

我的整体评价 / Verdict

对精确头 4a67ad5a110ed7b73b715e2315334aa462a9cc44 完成第 4 轮独立复审后确认,新提交补充的 candidate_sha 摘要格式门控复用 content_digest.ts 规范合理且本地全部 8 条单测与 460 条架构校验通过;但由于上一轮审查 6011989660 及两条尚未解决的评审线程所指核心问题——控制面生产源码目录仍保留 0 生产调用方且分裂拥有者的 verifier_hook_contract.ts / QuotaGoalBoundaryReference / DomainPluginTrial,以及 docs/architecture/rfcs/README.md 仍缺 Delivery on main / Current boundary 边界说明——均仍未修正,整体维持 REQUEST_CHANGES。

  • 长程与用户体验影响(outcome_impact): long_horizon 为 not_yet_proven(verifier_hook_contract.ts 与 QuotaGoalBoundaryReference 仍无任何生产运行时调用方,DomainPluginTrial 无任何测试或执行路径,尚无真实长程任务接线与成效证明);user_experience 为 not_applicable,且 visual_review 为 not_applicable(本次审查全部 8 个改动文件,未修改任何前端、Dashboard、Chat 或 CLI 渲染表面)。
  • 可观测语义与代码体积(observable_semantics / code_volume / change_proportionality): 现有主干运行时(175 条既有 TS 单测、460 条架构测试)与 RFC 文档治理检查均确认无退化,但新增 TS 契约毫无生产路径调用,故 observable_semantics 为 not_yet_proven。188 行控制面生产目录 TS 代码与 196 行测试在零生产调用方条件下仍属 partly_avoidable / simplify_now / disproportionate,compatibility_assessment 为 not_applicable(纯新增未调用文件与编译期类型,无存量协议兼容变更)。
  • 词表归属(semantic_alignment): candidate_sha 正则已正确复用 content_digest.ts 单一所有者;其余内联 TS 状态字面量仍属未接入生产的 local_only 类型,正式接线时需并入 progressive_context.ts 与 goal_capability_organization.ts 词表。
  • 下一轮复审与合入所需证据: (1) 解决未决阻塞线程与 Finding 1:删除零生产调用方的 verifier_hook_contract.ts、verifier_hook_contract.test.ts 与未消费类型 QuotaGoalBoundaryReference 以纯 RFC 合入,或者接入真实生产调用方、将 FoldToReceipt 归口 progressive_context.ts 并移除零测试零调用的 DomainPluginCandidate / DomainPluginTrial;(2) 解决未决线程与 Finding 2:在 docs/architecture/rfcs/README.md 第 204–205 行补充 Delivery on main 与 Current boundary 并校准 RFC 第 5 行成熟度声明;(3) 重跑 generate_rfc_status_index.py --check、docs-governance-smoke.py、check_rfc_bilingual.py 与精确 diff 的 canary premerge。
  • 声明与新鲜度: 本评审在绑定信息不可用(session_not_bound)的情况下以 self_reported 声明模型身份;未等待也未查询远端 GitHub Actions CI(wait_for_ci: false)。当前结果仅对应精确提交 4a67ad5a110ed7b73b715e2315334aa462a9cc44。

英文简短结论:
English verdict: REQUEST_CHANGES at head 4a67ad5. Commit 4a67ad5 cleanly reuses ENVELOPED_SHA256_PATTERN from content_digest.ts to reject non-digest candidate_sha strings before reading authority (8/8 unit tests, 183/183 across 8 TS suites, 5/5 digest counterfactual probes, generate_rfc_status_index.py --check, docs-governance-smoke.py, check_rfc_bilingual.py, semantic-vocabulary-drift-smoke.py, ruff, mypy, loopx check, 460/460 pytest checks, and canary premerge 4 direct + 18 selected checks all pass; exit 1 only on quality_receipt_missing). However, both remaining blockers from review 6011989660 and both open review threads remain unaddressed: (1) scope_fit / repository_reuse / change_proportionality (simplify_now): verifier_hook_contract.ts (184 lines) and QuotaGoalBoundaryReference in turn_envelope.ts still have zero runtime production callers, FoldToReceipt/KeepRaw sits outside progressive_context.ts, and DomainPluginCandidate/DomainPluginTrial remain unreferenced even in tests outside goal_capability_organization.ts; (2) RFC-MATURITY-SEPARATION / authority_semantics: docs/architecture/rfcs/README.md lines 204-205 still lack Delivery on main / Current boundary lines while RFC line 5 states Delivery maturity: TypeScript contract.

@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.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

面向接入宿主 Hook、需要保留子工作原始证据的控制面维护者。宿主使用独立回执折叠子工作时,需要在证据不可用或下轮仍有依赖时保留原始上下文。同一个合格回执和读取请求,返回 undefined 时得到 KeepRaw,实际文件读取抛出 ENOENT 时错误穿过推荐器。RFC §3 规定不可读引用须保留原始内容。 规范 digest 的检查先于证据读取;普通路径未激活新模块。 本次验证 RFC、源合同与实际本机文件错误。安装 Host Hook、模型缓存及匹配成本成果未实测。提案将验证归入 C1、历史工作集和 capability portfolio。实际宿主接入及匹配成本下的成果仍待验证。 历史工作集规范

改动思路 / Approach

C1 管控制面和结算;history/progressive 管上下文,portfolio 管采用。新增合同和 trial 类型尚未接入。 Propose RFC and qualify a minimal existing consumer before claiming a production source contract. 先交付双语设计并指明首个可验收的读取者。若本轮保留可执行切片,由已有 progressive context owner 接入读回、不可用回退和原回执重放。逐工具 Hook 仍须显式启用。

具体改动 / Changes

按现有投影所有权、证据不可用、关闭时保持现有行为三条核对。完整核查 f9aa58e 对共同祖先 d380526 的 9 个文件,+508/−2。相对前次评审,新校验已修复无版本候选。独立验证中,旧头对无版本输入读取四次并推荐折叠,当前头零次读取并返回 KeepRaw。前后均接受规范且证据匹配的 digest。最新提交只在架构测试登记两个 canonical digest 消费点,运行代码和 RFC 与前一头逐字节相同。 前一头到当前头

关键代码讲解

  • negotiateVerifierHooks 依据显式开关与已观察到的能力决定档位。关闭时没有新增路径,逐工具能力还需明确启用。 档位协商
  • recommendVerifiedClose 先查 digest,再根据作用域读取独立回执和 evidence。matchesEvidence 直接调用证据读者。 证据路径

对主干的风险 / Risks

[P2] 实际读取错误绕过 KeepRaw。 同一个合格回执和读取请求,返回 undefined 时得到 KeepRaw,实际文件读取抛出 ENOENT 时错误穿过推荐器。RFC §3 规定不可读引用须保留原始内容。 若错误归一化由适配器负责,请在首个真实读取者中明确执行并补回归。 规范

[P2] 新合同没有可验收的现有消费者。 新推荐器只由新增测试调用。DomainPluginTrial 没有 producer 或 consumer。建议本轮交付双语 RFC,或让一个已有 history owner 从实际受控来源读回原结果。 既有入口 试跑类型 前一头评审

[P2] 手工索引缺少交付与范围。 请补 Delivery on main 和 Current boundary,明确合同、待接入 Host 及首个验收切片。自动索引检查通过,手工条目仍只有两个链接。 当前条目

当前头含新合同及 canonical digest owner 的 156 项检查、TypeScript typecheck、RFC 双语、生成索引和 Docs Governance 通过。相同现有 owner 检查基线和候选各 131 项通过。 独立真实文件错误反例失败。本次验证 RFC、源合同与实际本机文件错误。安装 Host Hook、模型缓存及匹配成本成果未实测。

我的整体评价 / Verdict

请求修改。保留当前候选 digest 的修复。先明确实际读取失败的处理和已有 owner 的接入边界,再决定保留代码或缩到纯 RFC,同时让目录准确说明交付阶段。

English verdict: REQUEST_CHANGES at f9aa58e. The digest fix works. Actual reader failures still escape KeepRaw, the production contract has no live consumer, and the manual RFC entry lacks delivery and boundary rows.

@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.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

维护 verifier Hook 的人需要让子工作读回在权限变化时仍能保留原始证据。 前一头的推荐器在产品源码,真实 ENOENT 会中断调用。 相同合格回执和证据,文件缺失会保留 KeepRaw。已有记录被权限隔离后,实际读取仍抛出 EACCES。 当前把推荐器移入测试夹具,源模块只保留类型。ENOENT 回退和手工 RFC 索引均已修复。 这次评审覆盖设计、TypeScript 类型和可执行夹具。真实宿主、缓存、模型成果和成本留给 RFC 首个接入切片。

改动思路 / Approach

沿用原 history working-set 读取、独立回执与 C1 结算 owner。 当前交付类型、设计和夹具。首个实装仍使用原 history owner。 先把可用、不存在、权限拒绝和读取程序错误分开,再让既有读者接入。 现有历史工作集规范

具体改动 / Changes

准确头 4a96dd75b8dd58961561b026dcdcc1a191c6c2d0 和基线 d38052695c2c8a2e67cdb2c1eb6f4c6651eabd4d,10 文件 +557/-2。按保留原证据、关闭态隔离和首个接入切片核对 §3/§5。当前手工索引写清类型、夹具和接入边界。独立回执尚未接入产品,合同导出的 Goal 引用只规定内容哈希和路径。实际读取测试保持同一合法身份、同一类型和证据次序,只改对应文件能否被读。真实 ENOENT 在回执和原始 evidence 两处都返回 KeepRaw。可读对照仍折叠,TypeError 原样可见。产品源码模块无运行时出口,Turn envelope 只多了类型。 RFC 第 3 节 索引

对主干的风险 / Risks

[P2] 真实不可读引用仍会中断 KeepRaw。 真实权限拒绝在 readReceipt 和 readEvidence 都抛 EACCES,目录替代记录在两处都抛 EISDIR。夹具没有返回 KeepRaw,和同一提案对不可读引用的语义不符。 在 reader 边界把权限拒绝和无可用记录的错型路径明确建模为 unavailable,返回 KeepRaw。保留解析、程序错误等非预期故障的可见性,增加两个层级的真实文件反例。 读取夹具

当前 192 项 TypeScript 测试通过,严格类型检查、双语 RFC、索引检查均通过。基线相邻套件 179 过,另有一项已有 digest 消费清单故障,当前头包含对应登记。

我的整体评价 / Verdict

请求修改。保留类型与测试夹具分离、索引说明和 ENOENT 修复。补齐真实不可读时的回退,让未来接入沿用统一语义。实装后仍需验证原始回执恢复以及同一 C1 身份的重放。

English verdict: REQUEST_CHANGES at 4a96dd7. ENOENT preserves the raw scope, and the production module is type-only. Actual permission-denied or wrong-kind records still throw at both reader boundaries, contrary to the fixture's unreadable-reference contract. Treat those as unavailable while preserving unexpected diagnostics.

@mergify

mergify Bot commented Nov 26, 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, @huangruiteng.

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 26, 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>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…ilable -> KeepRaw

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/verifier-hook-co-design-20261122 branch from 4a96dd7 to 1a4253e Compare November 26, 2026 15:20
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 26, 2026

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

动机 / Motivation

本轮针对精确头 1a4253e8d8a63446330f5482ef96751c5cd97dc8 完成整包复审。Control-plane maintainers, host adapter authors (Codex, DSH Cordis, Claude Code, Antigravity, generic CLI/Pi), and history working-set maintainers preparing opt-in multi-boundary verification and independent Oracle-backed child-scope folding.

Before PR #9262, cross-host start/milestone/compaction/stop verifier coordination and VerifiedClose evidence binding existed only across disparate scripts without an accepted specification or shared TypeScript contract; at exact head 1a4253e, the bilingual RFC and STATUS index pass all governance checks, loopx/control_plane/turn_driver/verifier_hook_contract.ts and turn_envelope.ts export zero runtime code, and the isolated fixture in tests/control_plane_ts/fixtures/verifier_hook_contract.ts enforces L0/L1/L2 opt-in negotiation, canonical sha256:<64 hex> candidate digests, nonblank 6-field scope and role matching, and KeepRaw fallback on ENOENT/EACCES/EPERM/EISDIR/ENOTDIR while surfacing SyntaxError and TypeError.

At exact head 1a4253e, generate_rfc_status_index.py --check, check_rfc_bilingual.py, docs-governance-smoke.py, semantic-vocabulary-drift-smoke.py, npm run typecheck:control-plane, strict standalone tsc on test+fixture, 216/216 tests across 8 control-plane TS suites, 461/461 pytest cases across RFC/architecture suites, loopx check (9 files), and canary premerge standard (22/22 checks) all pass; independent Node runtime probe confirms Object.keys(verifier_hook_contract) is empty ([]) and off/invalid/EACCES/EPERM/EISDIR/ENOTDIR inputs resolve cleanly to null or KeepRaw while EIO/SyntaxError/TypeError remain observable.

  • 非目标(non_goals): Does not wire host hook adapters (Codex, DSH, Claude Code, Antigravity), modify C1 admission/transport/settlement logic, wire FoldToReceipt into progressive_context.ts runtime paths, change any runtime default, or run cross-host/same-host benchmark experiments.
  • 剩余缺口(remaining_gap): Live integration connecting one verified child return into progressive_context.ts / history working-set recovery, real host hook adapter qualification on installed host builds, and matched-budget Stop-Hook causal comparison benchmarks remain pending subsequent slices.
  • 下一步(next_step): Wire the first live verified child-return slice through the existing history working-set reader (progressive_context.ts) with C1 settlement replay on the same Goal/Todo and installed host output verification.
  • 切分依据(boundary_reason): Landing the bilingual RFC, type-only contract (with zero runtime exports in loopx/), and executable filesystem-backed fixture as a self-contained prerequisite isolates protocol agreement from host/history runtime integration and can be cleanly reviewed and reversed.
  • 规范基线: 基于基准提交 a9c275052a54076cfd2e2fb15271a121e20c2360 的规范入口 docs/architecture/rfcs/README.md 逐条核对:RFC-STATUS-INDEX、RFC-BILINGUAL-PAIR、RFC-MATURITY-SEPARATION、SCOPE-FIT-FIXTURE、CONTENT-DIGEST-OWNER、UNREADABLE-KEEPRAW 均已在精确头满足。

改动思路 / Approach

将全部可执行推荐与协商逻辑隔离到测试夹具并将生产目录收敛为纯编译期类型(零运行时导出),同时复用既有内容摘要与快尺所有权并完成双语 RFC 治理检查,当前边界契合前置设计阶段且可安全独立合入。

当前 PR 边界(current_pr_boundary): 本 PR 交付合规双语 RFC、STATUS 索引、纯类型 TS 接口与受测契约夹具(零生产运行时代码);后续切片再把首条真实子作用域回传接入 progressive_context.ts 与宿主适配器并补充同宿主对照验证。

相比前序阻塞轮次(4a96dd75b8 等):

  1. 作者与维护者已将 negotiateVerifierHooks 和 recommendVerifiedClose 全部移出生产源码,隔离到 tests/control_plane_ts/fixtures/verifier_hook_contract.ts,使 loopx/control_plane/turn_driver/verifier_hook_contract.ts 成为纯 type-only 契约文件(实测 Object.keys(contract) 为 []),loopx/control_plane/quota/turn_envelope.ts 仅在现有 QUOTA_GOAL_BOUNDARY_ARTIFACT 下新增 4 行纯类型 QuotaGoalBoundaryReference。
  2. 已删除未使用的 DomainPluginCandidate 与 DomainPluginTrial,GoalVerifierProfile.yardstick 直接复用 work_items/yardstick_decision.ts 的 WorkYardstickProfile,recommendVerifiedClose 复用 content_digest.ts 的 ENVELOPED_SHA256_PATTERN。
  3. 针对上一轮遗留的 EACCES / EISDIR 问题,在最新提交 1a4253e8d8 中通过 unavailableFsCodes = new Set(["ENOENT", "EACCES", "EPERM", "EISDIR", "ENOTDIR"]) 使 readAvailable 在缺失、无权限与错型路径读取时统一映射为 KeepRaw,同时保持 SyntaxError、TypeError 与其他未列入 errno(如 EIO)原样可见。

具体改动 / Changes

相对于共同祖先 a9c275052a54076cfd2e2fb15271a121e20c2360,共修改 9 个文件(+655 / -2):

  • 双语 RFC 与索引(5 个文件,+129/-2):
    • docs/architecture/rfcs/verifier-hook-co-design-v0.md 与 .zh-CN.md:头部状态 Accepted (upon merge)、Supersedes / closes: none、明确标注 History working-set integration and host qualification are pending,§3 完整规定 sha256:<64 hex> 与不可读文件系统错误返回 KeepRaw、解析/意外读取错误保持可见。
    • docs/architecture/rfcs/STATUS.md 与 STATUS.zh-CN.md:由 generate_rfc_status_index.py 更新为 Accepted (55) / 已接受 (55)。
    • docs/architecture/rfcs/README.md:第 204–209 行补充 Delivery on main 与 Current boundary。
  • 控制面纯类型接口(2 个文件,+106/-0):
    • loopx/control_plane/turn_driver/verifier_hook_contract.ts(102 行,全为 import type / export type,无任何运行时代码)。
    • loopx/control_plane/quota/turn_envelope.ts(第 76–79 行新增纯类型 QuotaGoalBoundaryReference)。
  • 测试夹具与单测(2 个文件,+423/-0):
    • tests/control_plane_ts/fixtures/verifier_hook_contract.ts(97 行:negotiateVerifierHooks、recommendVerifiedClose、readAvailable、matchesScope、matchesEvidence)。
    • tests/control_plane_ts/verifier_hook_contract.test.ts(326 行,覆盖关闭隔离、L0/L1/L2、显式 pre_tool_use、6 元组空白身份 0 读取拦截、非规范摘要拒绝、角色/引用/作用域错绑、真实磁盘 ENOENT / EISDIR / ENOTDIR / chmod 0o000 EACCES -> KeepRaw、可读控制组 FoldToReceipt、坏 JSON SyntaxError 与 TypeError 透传以及 /goal_boundary 选择)。

对主干的风险 / Risks

无阻塞主干风险。

  • 默认关闭与零运行时影响: loopx/ 内不产生任何运行时 JavaScript,生产路径调用数为 0,既有 202 条控制面相关 TS 单测与 461 条架构 pytest 用例全通过。
  • 非阻塞后续建议(follow-up): docs/architecture/rfcs/README.md 第 207–209 行使用现在时概括首个 live slice 目标,后续接通历史工作集时建议在 Current boundary 同步保持状态时态明确(目前第 206 行 Delivery on main 及 RFC 第 5 行已明确待接入状态);EPERM 与 EIO 为合成 error.code 反例验证,非 root 环境实测了 ENOENT/EISDIR/ENOTDIR/EACCES (chmod 0o000) 与坏 JSON SyntaxError。

本地验证汇总(精确头 1a4253e8d8a63446330f5482ef96751c5cd97dc8,wait_for_ci: false)

  • npm run typecheck:control-plane:PASS
  • 独立严格 tsc --noEmit(verifier_hook_contract.test.ts + 夹具):PASS
  • 8 个控制面 TS 套件联合测试(verifier_hook_contract、content_digest_single_owner、turn_envelope、context_delivery、progressive_context、context_selection、yardstick_decision、post_writeback_hook_transaction):PASS(216 passed, 0 failed, 0 skipped in 3.34s)
  • Node 运行时与反例探测(Object.keys(verifier_hook_contract) === []、ENOENT/EACCES/EPERM/EISDIR/ENOTDIR -> KeepRaw、EIO 抛出、null 身份与大写 SHA256: -> KeepRaw、关闭态 -> null):PASS
  • scripts/generate_rfc_status_index.py --check / scripts/check_rfc_bilingual.py --base a9c275052a --head HEAD / examples/docs-governance-smoke.py(隔离 HOME):PASS
  • scripts/generate_semantic_inventory.py --changed-from a9c275052a(supported candidates: 0)与 examples/semantic-vocabulary-drift-smoke.py(34/34 词表、62/62 拥有者符号):PASS
  • ruff check(涉及 TS/RFC/架构测试目录):PASS
  • mypy --follow-imports=silent:PASS(17 个配置源文件 0 错误;未过滤 mypy 在基线与当前头均为 6 个无关既有文件共 50 个错误)
  • pytest -q(test_rfc_bilingual.py 与 6 个核心架构测试文件):PASS(461 passed in 72.61s)
  • loopx check --scan-path ...(全部 9 个改动文件):PASS(0 errors, 5 checks)
  • loopx canary premerge --from-git-diff --git-diff-base a9c275052a --profile standard:PASS(4 项直接检查、9 项金丝雀、8 项风险烟雾、1 项公开边界扫描全部通过,merge_gate_passed: true)

我的整体评价 / Verdict

在精确头 1a4253e8d8a63446330f5482ef96751c5cd97dc8 完成整包独立验证:所有 6 条既有评审线程与历史阻塞项均已实质关闭,文档治理、纯类型接口隔离、摘要与快尺复用、以及真实文件权限/错型退回 KeepRaw 与异常透传均已验证通过,给出 APPROVE。

English verdict: APPROVE at head 1a4253e. All prior blockers and all 6 review threads are resolved: bilingual RFC headers and STATUS indexes pass governance validation; runtime negotiation and close recommendation logic is bounded to tests/control_plane_ts/fixtures/verifier_hook_contract.ts while verifier_hook_contract.ts emits zero runtime exports; dead plugin trial types were removed and canonical owners (ENVELOPED_SHA256_PATTERN, WorkYardstickProfile, QUOTA_GOAL_BOUNDARY_ARTIFACT) are reused; and ENOENT, EACCES, EPERM, EISDIR, and ENOTDIR map to KeepRaw while preserving SyntaxError, TypeError, and unexpected I/O errors (typecheck:control-plane, 216/216 TS tests across 8 suites, 461/461 pytest checks, docs-governance, semantic-vocabulary-drift, ruff, mypy --follow-imports=silent, loopx check, and canary premerge 22/22 all passed; wait_for_ci: false).

@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.2-sol · OpenAI · runtime_reported · xhigh

[P2] 当前验收变更时仍可推荐折叠旧回执。 保持 Goal、Todo、epoch、child scope、候选 SHA 和 oracle 版本。独立证据原样可读,仅验收条件从 R1 变为 R2。 六字段身份匹配继续返回 FoldToReceipt,读取边界未验证当前验收与回执依据相同。新要求可能需要从原始材料复核。 复用 C1 的权威验收依据(例如当前 acceptance_digest),把它绑定到请求、回执和适用证据,或者在可信读者协议中显式执行同等的失效检查。缺失或不同时保留 KeepRaw,把旧回执留作历史。 在同一候选、六项身份和磁盘回执下,只切换验收摘要,要求原摘要仍可 FoldToReceipt,变更后 KeepRaw。保留版本不匹配与权限拒绝的对照。
当前身份类型 · 既有验收摘要 owner

动机 / Motivation

维护长程 Goal 的人可以调整验收要求,随后还需要从原候选与验证记录继续工作。

原候选在旧验收下合格时可以压缩历史;如果验收新增一项,接续时需要识别旧回执的适用范围。 相同候选、验证器版本和原回执下,只切换测试请求的当前验收摘要,两次都得到 FoldToReceipt。改动验证器版本的对照得到 KeepRaw。

本提交交付双语 RFC、纯类型和测试夹具。宿主 Hook、真实历史集接线、生产结算与模型对照仍待后续验收。

既有历史工作集的 A3 要求在变更版本、未完成检查或反证时得到相应决定。A8 保留关闭路径,A7 的真实回执重放属于下一阶段。本轮按基线 a9c275052a54076cfd2e2fb15271a121e20c2360 的规范核验。历史工作集规范

改动思路 / Approach

本轮保留原做法,把 Hook 调用和历史接线留给各自 owner,只落实双语设计、纯类型与测试夹具。验证身份需要覆盖当前验收依据。优先复用 C1 已有摘要或可信读者的新旧依据对照即可,无须扩展宿主功能与持久化结构。以前的空身份、不可读文件与索引问题在当前头已收敛。

具体改动 / Changes

  • 五个文档与索引文件说明启动、探测、压缩或子范围以及停止四个边界,并列明后续真实宿主与模型对照。重新生成的双语状态索引及镜像检查通过。双语 RFC 入口
  • QuotaGoalBoundaryReference 以原 capture 加固定指针表达目标边界。Verifier Hook 模块只导出类型,并复用快尺 WorkYardstickProfile。Node 实际加载该模块得到零运行时导出。
  • 夹具以三个角色读回 Oracle、原始来源和摘要。真文件缺失、权限拒绝或文件类型不符时保留原始历史,解析和程序错误仍可见。连续两次读回完全相同的 R1 文件,在 R2 仍推荐折叠,说明候选和验证器完整绑定不足以确认需求版本。实际分支

对主干的风险 / Risks

当前 216 项 TypeScript 测试通过,基线与当前头的 200 项已有用例逐项一致。类型检查、双语和文档治理、语义词表检查均通过。标准预检 4 项直接、18 项执行全部通过。本地最初缺失 TypeScript 依赖,按锁文件安装后重跑通过。当前缺口影响以后接入的历史折叠判断,现有生产路径仍保持关闭。

我的整体评价 / Verdict

REQUEST_CHANGES。 让已通过的回执证明当前验收依据,再定稿这版契约。修复可在现有身份或可信读者边界完成。纯类型和测试夹具未改动已交付界面。实际宿主和历史工作集采用未验证。

English verdict: REQUEST_CHANGES at 1a4253e. The executable contract folds the same passed receipt after an independent acceptance revision changes. Bind the current acceptance basis and KeepRaw on mismatch. Existing tests, default-off parity and standard premerge passed. No live host or history wiring is claimed.

…copeIdentity

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

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

动机 / Motivation

需要接入独立验证 Hook 并在受支持会话边界折叠已完成子工作历史的控制面与宿主适配器维护者。

此前版本在目标标识缺失验收摘要字段时,若候选内容与验证器版本未变、仅目标验收规则从旧版本升为新版本,推荐器仍会把旧版已通过回执判定为可折叠;当前精确头将规范验收摘要纳入作用域标识后,相同条件下只保留旧摘要推荐折叠,切换至新验收摘要立即拒绝折叠并保留原始证据回读。若停留在旧设计不补全这一约束,后续宿主集成一旦按作用域推荐折叠,就会静默把按旧版验收条件通过的结果当作新验收要求下的有效凭证,导致漏检新约束。定稿双语协同设计 RFC 与纯类型契约模块(零运行时导出),并在独立测试夹具中对缺失、不可读、路径类型错误、角色错绑、摘要格式错误以及验收版本漂移均确定返回 KeepRaw。本 PR 不改写现有运行时结算或上下文投递链路,也不实现具体的 Codex、Claude 或 DSH 宿主 Hook 挂载与线上模型效果对比。真实历史工作集 owner 接线、各宿主运行时 Hook 回调适配器以及线上多模型对照实验仍待后续集成 PR 完成与验收。

改动思路 / Approach

将纯类型协议留在 turn_driver 契约文件、把可执行的推荐逻辑和文件系统读回示例隔离在测试夹具中,并在 quota 边界文件仅增补一条指针类型别名,既先锁定不变量又不向未接线的生产主干提前引入运行时依赖。仅交付双语 RFC 及状态索引更新、一条只读边界引用类型别名、纯类型 VerifiedClose 与 Hook 事件契约、以及测试目录内的参考实现与 15 项自动化用例;不触及生产执行路径。

在结构分工上,Start 阶段通过只读边界引用精确指向捕获快照中的目标约束指针;VerifiedClose 阶段由调用方传入当前权威作用域标识,推荐器在触达回执或证据读取器之前先行校验不可变候选内容摘要与当前目标验收摘要格式,任何字段空白、格式不符、角色错位、文件不可读(ENOENT、EACCES、EPERM、EISDIR、ENOTDIR)或作用域字段不等都退回原始作用域。与 turn_envelope 既有边界常量及 content_digest 唯一正则 owner 的配合直接复用已有定义,避免在契约或测试里复制第二套摘要正则或自造目标边界字段。

flowchart LR
  Req["VerifiedCloseRequest (exact head cfa7c3589b)"] --> Pre["格式与非空预检 (BARE_SHA256 / ENVELOPED_SHA256)"]
  Pre -->|"空白或摘要格式非法"| Raw1["KeepRaw (0 次读者 IO)"]
  Pre -->|"格式有效"| Rec["reader.readReceipt(receipt_ref)"]
  Rec -->|"缺失/权限拒绝/作用域或 acceptance_digest 不匹配"| Raw2["KeepRaw"]
  Rec -->|"verdict == failed + 匹配反例"| RawC["KeepRaw + counterexample_ref"]
  Rec -->|"verdict == passed 且低重叠无未决"| Ev["逐项校验 oracle/source/summary 角色与作用域"]
  Ev -->|"全部一致且可读"| Fold["FoldToReceipt"]
  Ev -->|"任一缺失/不可读/错绑"| Raw3["KeepRaw"]
Loading

(说明:上图基于静态源码分支绘制,用于说明 cfa7c3589bd93f0034db834c1b659260f93c2751 中 recommendVerifiedClose 的控制流与停止分支,不代表生产运行时真实宿主挂载。)

具体改动 / Changes

本 PR 共变更 9 个文件(+741/-2):5 个双语 RFC 与索引文件、2 个控制面纯类型声明文件以及 2 个测试夹具与单元测试文件。参考规范为 eebc7b9d29646dc757b8c76ecb21b5742caa7201 中的 docs/architecture/rfcs/history-working-set-context-policy-v0.md(提交版本 eebc7b9d29646dc757b8c76ecb21b5742caa7201):A3、A5、A6、A8 已在纯类型契约与夹具边界落地并通过对应负向测试;A1、A7、A10、A12 因真实宿主和历史工作集尚未接线而在本阶段按范围声明保留为 deferred。

关键代码讲解

  1. VerifiedScopeIdentity:绑定 goal_id、todo_id、parent_epoch_ref、child_scope_ref、candidate_sha、规范 acceptance_digest(直接复用 outcome_requirements.ts 产出的 64 位小写十六进制摘要语义)与 verifier_version,使作用域不仅锁定候选内容与验证器版本,也绑定当前有效的目标验收契约摘要。
  2. recommendVerifiedClose:通过 scopeIdentityFields 纳入 acceptance_digest,并在调用 reader.readReceipt 前以 content_digest.ts 的 ENVELOPED_SHA256_PATTERN 与 BARE_SHA256_PATTERN 同时验证候选摘要和验收摘要格式;对文件缺失、权限拒绝或路径类型错误捕获为不可用返回 KeepRaw,而 SyntaxError、TypeError 等解析或契约异常保持上抛可见。
  3. QuotaGoalBoundaryReference:紧邻既有常量 QUOTA_GOAL_BOUNDARY_ARTIFACT 导出只读类型,固定使用 capture_sha256 与 "/goal_boundary" 指针表达目标边界引用,零运行时载荷改动。
  4. acceptance revision drift R1 -> R2 用例:基于磁盘文件回执证明 R1 请求触发 FoldToReceipt,仅将当前请求中的 acceptance_digest 切换为 R2 即触发 KeepRaw,同时保留 verifier_version 失配与 EACCES 对照。

对主干的风险 / Risks

  • Scope-Fit 覆盖边界:本 PR 为显式声明的仅契约与夹具覆盖阶段(coverage-only),verifier_hook_contract.ts 通过 node --experimental-strip-types 验证导出的运行时键集合为空数组 [],turn_envelope.ts 也仅新增类型别名;当前主干生产代码没有运行时 Hook 调用点,也不存在默认行为切换或隐式激活。
  • 验证矩阵与基线归因:
    • PASS:npm run typecheck:control-plane(零错误);verifier_hook_contract.test.ts(15/15 通过,含 4 项文件系统的缺失/错型/EACCES 子测试)、targeted 控制面 5 套件(verifier_hook_contract + content_digest_single_owner + turn_envelope 共 106/106;context_delivery + native_context_lifecycle 共 38/38);Node 独立反事实矩阵验证 4 种输入(R1 折叠、R2 KeepRaw、带前缀格式错误零 IO KeepRaw、过期证据 KeepRaw)。
    • PASS:scripts/check_rfc_bilingual.py --base origin/main --head HEAD、scripts/generate_rfc_status_index.py --check、examples/docs-governance-smoke.py、架构与 Canary pytest(489 passed + 23 passed)、ruff check loopx、loopx check(9 变更文件公开边界 0 错误)、Goal canary premerge --tier standard(4/4 direct + 9/9 catalog + 8/8 risk + 1/1 boundary,0 失败)。
    • FAIL(基线已有、与本 PR 无关):全量 npm run test:control-plane 在 cfa7c3589bd93f0034db834c1b659260f93c2751 运行 6950 项测得 6827 pass / 26 fail / 97 skip。该 26 项失败全部集中在 managed_claim_execution_conformance.ts 与 canonical_task_lease_renew.test.ts 中对旧 45 分钟租约过期时间(10:45:00Z)及 observeFencedExecution 的断言(因合入基线 a9c275052a54076cfd2e2fb15271a121e20c2360 及主干 50b4cc9de43498b57c8589c1bda03a787762416a 均已继承 #9487 提交 6268621e5e 将默认租约 TTL 调为 3 小时 13:00:00Z 而测试未同步更新)。在同一机器以相同命令对 50b4cc9de43498b57c8589c1bda03a787762416a 与 cfa7c3589bd93f0034db834c1b659260f93c2751 执行这 5 个关联套件与 canonical_task_lease_renew.test.ts,得到完全一致的退出码 1、失败数 26/2 与规范化失败签名,而本 PR 零改动 coordination/ 或租约逻辑。
  • 非阻塞观察:测试文件第 387–397 行的 Control 2 读者包装里自己捕获 EACCES 转返回 undefined,不过同文件第 236–274 行已直接用无捕获 readJsonFile 验证过 readAvailable 内建对 EACCES 的捕获,因此不构成覆盖漏洞;后续正式宿主适配器应依赖底层边界统一识别不可用错误而非各自重复包装。当前远端合并状态因相对 origin/main 落后若干提交而显示 BEHIND,但 MERGEABLE 且无合并冲突、无未解决评论线程。

我的整体评价 / Verdict

对长程能力(long_horizon)为 improved:在候选与验证器不变时补齐目标验收摘要一致性检查,阻断过期验收折叠并保留原始证据回读;对终端用户体验(user_experience)为 not_applicable(本次改动仅涉及双语 RFC 文档、纯类型定义与 TypeScript 控制面单测夹具,不包含前端界面或渲染输出。无渲染层改动需要核验(命令行与控制面内核无 UI 变更)。)。语义对齐判定为 aligned(reuse_existing:复用了 content_digest 唯一正则、outcome_requirements 摘要语义、WorkYardstickProfile 与 QUOTA_GOAL_BOUNDARY_ARTIFACT,未新建运行时枚举或全局注册项,无需调整词表与 CI)。代码体量仅增加约两百行纯类型与独立测试夹具,比例合宜、默认关闭隔离完整、权威边界不夸大生命周期承诺。基于对精确提交 cfa7c3589bd93f0034db834c1b659260f93c2751 的实测复核,所有既有阻塞问题已修毕且未发现新的阻塞缺陷,建议准予批准。

English verdict: APPROVE at cfa7c35. VerifiedScopeIdentity now binds canonical acceptance_digest and rejects R1-to-R2 acceptance drift back to KeepRaw while preserving zero runtime exports and clean targeted, RFC, governance, and standard premerge validation (with 26 control-plane lease TTL failures independently confirmed pre-existing on origin/main).

@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.2-sol · OpenAI · runtime_reported · xhigh

没有发现阻塞项。未运行真实宿主、模型或远端 CI。

动机 / Motivation

设计可选 verifier Hook 的宿主接入者,以及依赖独立 Oracle 回执的工作集 owner。 对照上一提交与当前提交,在磁盘保持同一候选、Oracle 版本和回执,只修改验收摘要,同时检查某个证据引用的独立验收变化。 当前提交在验收 R1 可推荐折叠,R2 只读取旧回执即保留原文,非法摘要不读取回执,单份 R2 证据不能同 R1 回执混用。 本次边界为 RFC、类型和可执行契约夹具。真实 Hook 接入、采样、模型和成本验证属于后续切片。 旧六字段回执会在候选内容固定但当前验收改变时继续推荐折叠,原始比较材料可能过早被移出。 先交付明确的类型契约和可执行反例,用当前 Goal 验收摘要绑定决策,保持正式宿主接入边界。 对照契约 对照修订 a9c275052a54076cfd2e2fb15271a121e20c2360。

  • V1 只有精确可读、作用域一致的回执才能推荐折叠。 通过。
  • V2 原始证据保持可读,不可用读取保留原始范围。 通过。
  • V3 首个已经接入的 Host 必须验证真实 C1 结算和历史读回;本轮只交付类型及契约夹具。 留待首个宿主切片。

改动思路 / Approach

生产改动仅导出类型。暂由契约夹具验证推荐,实际 Goal 权威、工作集交付与 EpochReset 继续由既有 owner 持有。 先固定验收摘要、角色和保留原件的语义,供后续宿主落地复用。 现有工作集策略要求精确验证、保留原件及区分已验证折叠与真正 EpochReset。 上一轮指出的六字段缺口已通过同一磁盘回执和验收变化独立复测。 对仓库经验采用其中的最小真实路径方法,分别核对正常操作、失败和恢复后的结果。

具体改动 / Changes

精确提交 cfa7c3589bd93f0034db834c1b659260f93c2751,9 个文件 +741/−2。九个文件新增主要由类型、配对 RFC 和真实文件反例组成,执行夹具没有进入生产。

  • recommendVerifiedClose。验收摘要变更使旧回执失效。文件不可用返回 KeepRaw,程序错误仍可见。 代码
  • VerifiedScopeIdentity。增加权威 acceptance_digest,把候选、验收、Oracle 和上下文绑定到同一个身份。 代码
  • QuotaGoalBoundaryReference。复用捕获摘要绑定和原有 Goal boundary 路径,无运行时调用。 代码

144 项 TypeScript 验证通过,另用两份源码的同一磁盘输入确认验收变化、缺失回执、禁用和预工具门槛。 定向回归测试

对主干的风险 / Risks

上一提交对 R2、非法摘要和单份 R2 摘要证据仍建议折叠。现头三项均保留原文,R1 和缺失回执的正反对照保持。 标准本地预检 18 项执行检查均通过。 只读 merge-tree 和签署检查通过。未运行真实宿主、模型或远端 CI。

语义与 CI 对齐

在真实触发下保留调用方所选的范围。当前提交在验收 R1 可推荐折叠,R2 只读取旧回执即保留原文,非法摘要不读取回执,单份 R2 证据不能同 R1 回执混用。 运行当前夹具、真实磁盘回执配对、双语和标准预检。 复用现有词汇,约束由既有源码拥有者执行。

我的整体评价 / Verdict

APPROVE。 沿用已验证的类型和证据契约,首个实际 Host 接线时沿原 C1 读取和现有工作集 owner 验证读取及恢复。 当前方案补齐首次集成所需的验收失效条件。真实多轮效果和用户路径仍需后续验证。 复用 C1 捕获和既有工作集动作,新增身份字段限未接入生产的 TypeScript 契约。 批准范围是 RFC 和当前可执行接口,实际 Host 的首次有用结果和缓存效果仍待资格验证。

English verdict: APPROVE at cfa7c35. A file-backed counterfactual now folds only under the original acceptance digest and keeps raw for changed acceptance, invalid digest, or mismatched evidence. This qualifies the RFC and executable interface fixture; real host adoption and measured benefit remain pending.

@huangruiteng
huangruiteng merged commit a6cb882 into main Nov 27, 2026
37 of 54 checks passed
@huangruiteng
huangruiteng deleted the codex/verifier-hook-co-design-20261122 branch November 27, 2026 05: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