Skip to content

refactor(protocol): retire legacy action packet from new quota output - #4794

Merged
huangruiteng merged 22 commits into
loopx-project:mainfrom
songoow:codex/pr05-packet-compat-preparation
Sep 21, 2026
Merged

huangruiteng merged 22 commits into
loopx-project:mainfrom
songoow:codex/pr05-packet-compat-preparation

Conversation

@songoow

@songoow songoow commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Fresh quota decisions previously wrote protocol_action_packet from six paths even though its action, interaction, lane, scheduler and spend facts are already owned by typed contracts. Discussion #4738 PR-05 requires a reader-first, writer-second retirement: stop fresh writes, migrate bundled consumers, retain named v0 history readers, and keep signature failures closed.

This PR implements that full slice:

  • removes all fresh packet writes from ordinary, paused, live projection, retained-selection reentry and unsettled-host recovery paths, plus the unused builder;
  • keeps protocol_action_packet_fields(), Markdown/Effect/Envelope v0 readers, residue/opaque fallback and canonical host-signature verification for historical inputs;
  • migrates current smokes and consumers to interaction_contract, work_lane_contract, scheduler_hint and the existing signed action dimensions;
  • adds frozen v1.1.0 decision/Envelope objects, corruption cases, real CLI replay, installed-resource checks and an exact-reader version verifier;
  • documents the first-release cutover, supported bundled consumers, external-client pin/migrate choice, reader lifetime and coordinated rollback.

The current-main integration preserves retained explicit Todo selection and receipt/replan reconciliation. The retained-selection path rebuilds the typed interaction contract without recreating the legacy packet. Its integration regression verifies the retained disposition, packet-free source and Envelope, equal source/Envelope signature documents, and unchanged host primary action.

Current exact head: f2381b794920fb551072e39d90bfb9d9bec7e574 on main@61b8311b77e43a984d3612a5e8ff8d600327ab03.

Local validation on this exact head (remote CI was not queried or awaited):

  • focused Python packet-retirement/selection set: 273 passed;
  • newly affected settlement CLI cases: 3 passed;
  • focused native TypeScript Envelope/Effect/history set: 31/31 passed;
  • control-plane TypeScript typecheck passed; mypy passed for 22 source files;
  • Ruff on all changed Python paths and git diff --check passed;
  • real quota-without-legacy-packet source smoke passed;
  • risk-based pre-merge gate: 19/19 passed, public-boundary scan clean;
  • exact-diff change-quality receipt: cqr_8c36541c1be51a9bf573 (valid, pass).

This does not delete historical v0 readers, rewrite stored records, prove unknown external/private archives, retire another legacy field, or claim global F6. Runtime/control-plane change; maintainer review and merge are required.

Signed-off-by: song <22676124+songoow@users.noreply.github.com>
…pat-preparation

Signed-off-by: song <22676124+songoow@users.noreply.github.com>
…ions

Signed-off-by: song <22676124+songoow@users.noreply.github.com>
Signed-off-by: song <22676124+songoow@users.noreply.github.com>
Signed-off-by: song <22676124+songoow@users.noreply.github.com>
Signed-off-by: song <22676124+songoow@users.noreply.github.com>
Signed-off-by: song <22676124+songoow@users.noreply.github.com>
@songoow
songoow marked this pull request as draft September 20, 2026 07:47
@songoow songoow changed the title test(compat): prepare protocol action packet reader coverage refactor(protocol): retire legacy action packet from new quota output Sep 20, 2026
Signed-off-by: song <22676124+songoow@users.noreply.github.com>
Signed-off-by: song <22676124+songoow@users.noreply.github.com>
…05-packet-compat-preparation

Signed-off-by: song <22676124+songoow@users.noreply.github.com>
Signed-off-by: song <22676124+songoow@users.noreply.github.com>
Signed-off-by: song <22676124+songoow@users.noreply.github.com>
Signed-off-by: song <22676124+songoow@users.noreply.github.com>
@songoow
songoow marked this pull request as ready for review September 20, 2026 09:42
@songoow
songoow requested a review from steven-kid as a code owner September 20, 2026 09:42

@songoow songoow left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

动机

本次审阅对象是 exact head 1b541b72e1e06a51f8ea632ae8e0dfd837bd2338。Discussion #4738 的 PR-05 要求按 reader-first、writer-second 方式退休 protocol_action_packet:新输出停止写入,当前消费者迁移到类型化契约,合法历史格式继续读取,非法签名继续拒绝,并明确升级与回滚边界。

旧实现从 ordinary、paused、live projection 和 unsettled-host recovery 六处写入一个可由 interaction_contractwork_lane_contractscheduler_hint 推导的摘要。保留它会让每次动作语义变化继续同步维护一份观察性表达。更小的 #4775 只能消除一次中间重复渲染,无法删除这份兼容写入职责;因此本 PR 的完整迁移是有独立价值、可回滚且范围合适的交付。

改动思路

实现沿用现有 owner:quota 仍决定是否运行,interaction/lane/scheduler 仍投影义务与命令,TurnEnvelope 与 host 仍验证规范签名。新输出只删除观察字段及其 capsule witness,没有引入替代 summary、feature flag、第二套状态或新的授权来源。

兼容面保留在既有 reader:protocol_action_packet_fields()、历史 Markdown/Effect/Envelope 读取、verified reconstruction、residue、opaque fallback 和 host canonical-hash 检查继续存在。迁移边界写为“首次包含 #4794 的正式发行版”;已发布 v1.1.0 不变,外部客户端若依赖旧字段需先迁移到类型化契约或继续使用 v1.1.0。有效 v0 格式在 v0 reader 生命周期内继续受支持;未来删除 reader 需另做破坏性迁移。

具体改动

  1. should_run.pyshould_run_packet.pylive_decision.pyunsettled_host_turn.py 删除六个现行写入点,interaction_contract.py 删除失去调用者的 builder;有序语义投影和历史 renderer 保留。
  2. 受影响 smoke 改读结构化 contract,并将默认输出回归重命名为 quota-without-legacy-packet-smoke.py;冷路径比较使用具名 synthetic legacy input,不重新要求 quota 生产旧字段。
  3. 退休台账的 Python 使用面由 5 收紧为 1,TypeScript 保留两个兼容 reader;没有提高预算、缩小扫描根或掩盖 reader。
  4. 固定四组由真实 v1.1.0 源码 607c11d75 生成的 decision/Envelope 原始对象和哈希。当前 reader 直接读取固定字节,24 个 action/spend/witness/signature 篡改变体必须失败。
  5. verify_protocol_packet_migration.py 要求准确且未修改的 v1.1.0 checkout,复核八组新输出和四组历史对象;错误 revision 在 replay 前被拒绝。真实 CLI replay、required-read + capability-intent、安装后 wheel 和打包 TS/JSON 资源均经过验证。

正向路径是:quota 产生类型化 action/obligation → packet-free payload → Envelope 规范文档 → host 验证并取得相同 primary action/required reads/CLI commands。负向路径是:读取历史 v0/residue/opaque packet 时它只作为 observation;任何签名缺失、action/spend/witness 被改写或 reader revision 不匹配都会 fail closed。

对主干的风险

最大风险是仓库外客户端直接读取旧字段。PR 没有声称兼容未知客户端,而是明确了 bundled consumer 集合、v1.1.0 pin/migrate 路径和 reader 生命周期。八组完整 base/head payload 在只移除旧字段后相等;规范签名文档在只移除对应 witness 后相等,没有排除 action、permission、receipt 或 command 子对象。

本地证据包括:最终聚焦 Python 套件 218 passed;TS compatibility/Envelope/Effect 31 passed;历史模块 29 cases,其中 24 个篡改拒绝;实际 v1.1.0 reader/host 完成 8 fresh + 4 frozen readback;安装 wheel 验证普通/暂停输出、打包资源、真实 bridge 与 host admission。exact-head 最新 Python Tests replacement run、DCO、dependency review、PostgreSQL、Frontstage 与 release workflow 均成功;同一 head 上一条 Python Tests run 因 PR 从 Draft 切到 Ready 被取消,其 merge-gate 分类失败已由后续成功运行取代。当前 main 的 merge-tree 无冲突。

残余风险只包括明确排除的完整私有 archive 与未知外部客户端;它们不在本 PR 的兼容承诺中。分支暂时包含 #4793 的共享 CI 修复 ancestry,相关逻辑也有独立测试与 PR;#4793 合入后该共享 diff 会自然从本 PR 消失。

我的整体评价

APPROVE。 这是对 PR-05 目标的完整、比例合适实现:实际删除了六个写入职责与 builder,迁移当前消费者,保留并验证具名历史读取和签名拒绝,且把发行、外部消费者与回滚约束写成可执行契约。没有发现阻断项,也没有用新 wrapper、预算放宽或“字段出现次数下降”冒充退休完成。

English verdict: APPROVE — exact head 1b541b7 removes all fresh protocol_action_packet writers, preserves typed authority and bounded v0 history through real release/readback evidence, passes exact-head CI, and leaves no blocking finding.

@huangruiteng huangruiteng 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.

动机

本次审阅对象是 exact head 1b541b72e1e06a51f8ea632ae8e0dfd837bd2338。Discussion #4738 的 PR-05 要求以 reader-first、writer-second 方式退休新 quota 输出中的 protocol_action_packet:当前执行语义继续由 interaction_contractwork_lane_contractscheduler_hint 等类型化契约拥有;有效 v0 历史对象继续读取,非法签名继续拒绝,并明确升级、支持范围与回滚边界。

这个交付目标成立。旧字段是现行契约的派生观察,每次动作语义改变都要额外维护 writer、summary 与 capsule witness;只合并重复渲染(#4775)不能消除这份重复职责。本 PR 选择删除六个 fresh writer 与失去调用者的 builder,同时保留历史 reader,是比新增 flag 或同义 summary 更小的实现。

改动思路

新路径仍由 quota 决策、interaction/lane/scheduler 投影和 Envelope 签名组成,删除的只是 fresh payload 上的观察字段及其 capsule witness。历史路径保留 protocol_action_packet_fields()、Python/TS Envelope reconstruction、Effect observation、residue、opaque fallback 与 host canonical signature 检查;因此旧记录的 packet 不会重新授权任务,也不会绕过身份、租约、capability 或 spend gate。

迁移文档把切换边界定义为首个包含本变更的正式发行版,发布过的 v1.1.0 不变;依赖旧字段的外部客户端必须先迁移到类型化契约或继续固定 v1.1.0。有效 v0 格式按 reader 生命周期保留,未来删除 reader 需要另一个破坏性迁移。这个 contract 对支持与不支持的范围、历史对象不改写、协调回滚步骤说明得比较完整。

正向链路是:fresh quota/live/paused/recovery 构造 → 类型化 contracts → packet-free Envelope → Effect/host consumer。负向链路是:冻结的 v1.1.0 packet-bearing/opaque/residue 对象 → historical reader → canonical signature/host admission;任何 action、spend、signature 或 witness 篡改都必须失败。

具体改动

  1. should_run_packet.pyshould_run.pylive_decision.pyunsettled_host_turn.py 删除六处 fresh build_protocol_action_packet() 写入;interaction_contract.py 删除未再使用的 builder/import,但保留有序字段投影和 summary reconstruction。
  2. 默认 smoke 改名为 quota-without-legacy-packet-smoke.py,现有 smoke/测试改读类型化 contract;semantic vocabulary budget 收紧为 Python 1、TypeScript 2 个保留 compatibility reader。
  3. 新增真实 CLI replay、live required-read/capability-intent、Python/TS Envelope/Effect、冻结历史对象、24 组 tamper rejection 与版本化 v1.1.0 reader verifier;冻结 fixture 保留原始 hashes,不用当前 writer 重建期望。
  4. 协议、Envelope、Effect、status、架构 ledger 的双语材料同步披露新默认、消费者集合、历史支持、rollback 与不覆盖范围。

关键代码讲解

  • _build_quota_should_run_payload():仍按原顺序构造 interaction、scheduler、cooldown 和 cadence,只是不再在出口附加派生 packet;真实 CLI/replay 证明 action 与 settlement identity 保留。
  • build_live_quota_should_run_decision():required-read、pending capability intent 与 host recovery 仍重建类型化 contract。这个函数也是当前 blocker 所在:当前 main 在分支切出后新增了 retained-action-selection reentry,reviewed head 尚未包含它。
  • protocol_action_packet_fields():作为历史兼容与签名 reconstruction 的唯一有序字段投影保留,没有被按名字误删。
  • buildTurnEnvelope():fresh input 不再生成 packet witness;historical v0/residue/opaque input 仍保留可验证观察,host authority 仍来自签名后的类型化 action。

对主干的风险

分支自身的验证很强:252 个 focused Python tests 通过(59.21s),19 个 native TypeScript compatibility/Envelope tests 通过;focused Ruff、git diff --check 和 semantic vocabulary drift smoke 通过,budget 显示 protocol_action_packet.py=1/1.ts=2/2。这些结果覆盖 packet-free fresh output、真实 CLI replay、required-read/capability-intent、有效历史输入与 corruption rejection。

但当前 exact head 不能安全集成到当前 maingit merge-tree --write-tree --messages origin/main HEAD 返回 1,并在以下两个文件产生内容冲突:

  • loopx/control_plane/quota/live_decision.py
  • tests/control_plane/test_effect_turn_live_quota_decision.py

这不是可忽略的机械冲突。当前 main 新增的 _apply_retained_action_selection_reentry() 会保留上次显式 Todo 选择,并在重建 interaction contract 后仍写 payload["protocol_action_packet"]。如果冲突时整块采用 PR 侧,会丢掉 retained-action reentry;如果采用 main 侧,会恢复本 PR 宣称已退休的 fresh writer。分支内 252 个测试都无法覆盖一条分支中不存在的当前-main 路径。

语义与 CI 对齐

当前受影响契约是“所有 fresh quota/live/recovery writer 都不再输出 legacy packet”,而触发变化是 current main 新增了一条 fresh live reentry writer。最低修复是 rebase 到 current main,保留 retained Todo/replan reconciliation,只删除该路径的 packet write/import,并补一个集成回归,同时断言:retained selection 仍正确、fresh packet 缺席、source/Envelope signature document 相等、host authority action 不变。然后重跑上述 Python/TS 组、semantic drift 和 conflict-free merge-tree。远端 CI 按 capability 配置没有被用作本轮证据。

我的整体评价

迁移设计、历史兼容边界和分支内验证值得肯定:它复用现有类型化 authority owner,没有新增第二套状态或 replacement summary,代码体积也与协议迁移风险相称。我没有发现另一个分支内 runtime blocker。

但 exact-head review 必须对当前 main 成立;这里的冲突同时涉及新生产行为与本 PR 的核心退休声明,不能在未产生新 head、未补集成回归前批准。请按上面的最小修复 rebase;新 head 出来后需要重新执行完整 exact-head review。

English verdict: REQUEST_CHANGES - exact head 1b541b72e1e06a51f8ea632ae8e0dfd837bd2338 passes 252 Python tests, 19 native TypeScript tests, Ruff, diff, and semantic-drift checks, but conflicts with current main in retained-action reentry; rebase must preserve that behavior while removing its fresh legacy-packet write and add the integrated regression.

…pat-preparation

Signed-off-by: song <22676124+songoow@users.noreply.github.com>

# Conflicts:
#	loopx/control_plane/quota/live_decision.py
#	tests/control_plane/test_effect_turn_live_quota_decision.py
huangruiteng
huangruiteng previously approved these changes Sep 20, 2026

@huangruiteng huangruiteng 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.

1. 结论与精确版本

批准本次复审,绑定 exact head 1e6f42d6908bbaabacf32edfdffa002404c2e7ec

这次 head 已经解决上一轮的核心阻塞:它把当前 main 的 retained-action reentry 合进来,并在不恢复 protocol_action_packet 新写入的前提下保留选中动作、签名与 typed interaction/work-lane contract。git merge-tree --write-tree --messages origin/main HEAD 成功,当前不存在原先的集成冲突。

2. 动机、架构与行为变化

这不是单纯“省几个字段”,而是消除同一个 fresh quota decision 的双重语义来源:

  • 新的正常、暂停、capability-intent、required-read、live reentry 与 unsettled-host recovery 路径,只由 interaction_contractwork_lane_contractscheduler_hint 等 typed contract 表达动作与义务。
  • protocol_action_packet_v0 只保留为历史兼容读路径;有效、已签名的 v0 历史仍可读取,未知版本和篡改历史仍拒绝。
  • retained selection 在 _apply_retained_action_selection_reentry 中重新投影到 typed contract;回归测试证明它不会丢失,也不会重新生成 legacy packet。
  • 这是对所有 fresh output 生效的默认行为变化,不是假装成 default-off 能力。英文/中文迁移文档明确披露受影响 lane、外部 reader 迁移责任、首个发布边界与 v1.1.0 rollback/read baseline。

代码所有权保持清楚:quota/interaction state machine 继续拥有 fresh 决策,Python/TypeScript 的 packet reader 只是历史兼容适配,没有形成第二套 authority。

3. 关键代码与反例检查

我重点走读了以下边界:

  • loopx/control_plane/quota/live_decision.py::_apply_retained_action_selection_reentry:当前 main 的 retained selection 逻辑被保留,exact-head 回归覆盖 packet-free 且 signed 的 reentry。
  • loopx/control_plane/quota/should_run_packet.py::_build_quota_should_run_payload:fresh payload 不再附加 legacy packet,但 typed action、delivery、scheduler 与 settlement 字段仍完整。
  • loopx/control_plane/quota/unsettled_host_turn.py::_unsettled_host_turn_recovery:恢复动作仍通过 typed next action 表达,没有隐藏地恢复旧 writer。
  • loopx/control_plane/work_items/interaction_contract.py::protocol_action_packet_fields:仅保留已知 v0 历史读取/summary 兼容,不接受未知 schema 扩权。

仓库搜索确认 loopx/ 下已没有 fresh protocol_action_packet writer;剩余命中是 TypeScript Effect/TurnEnvelope reader、Python renderer/TurnEnvelope projection、兼容字段提取以及 vocabulary 登记。最强反例——“合入当前 main 后 retained selection 被覆盖或靠旧 packet 才能恢复”——已由 integrated regression 覆盖。

4. 验证证据

  • Python 精确范围:295 passed in 72.93s,覆盖 semantic vocabulary、Effect interpreter、live quota、blocked-successor、历史 packet、retirement CLI 与 TurnEnvelope。
  • 原生 TypeScript:31 tests passed,覆盖 packet compatibility、TurnEnvelope 与 Effect program。
  • 11 个受影响 public smokes 全部通过。
  • focused Ruff、compileall/py_compile、git diff --check 通过。
  • 用 freshly prepared exact v1.1.0 checkout (607c11d75…) 运行迁移 verifier:ok=true,12 个 reader cases、8 个 new outputs、4 个 frozen history 全部通过。
  • 风险型 premerge canary 最终 clean rerun 通过:direct checks、10/10 catalog canaries、8/8 risk-profile smokes、public/private boundary 均通过,merge_gate_passed=true,无 manual hold。
  • 一个较早 canary run 曾把 auto-research-quota-pause-smoke.py 标为 tracked-side-effect;单独复现后工作树保持 clean,随后从 clean start 完整重跑通过,结束时工作树仍 clean,因此没有把暂态 guard 结果掩盖成成功,也没有发现 exact-head 可复现缺陷。
  • 按本轮 capability 的 wait_for_ci=false,未读取或等待 remote CI;批准依据是上述 exact-head 本地必需证据。

5. 风险、兼容与后续边界

主要剩余风险是仓库外客户端仍硬编码 fresh protocol_action_packet。本 PR 已把它作为明确迁移成本披露,并保留 v1.1.0 pin/rollback 路径;不应为了未知外部依赖继续双写两个 authority surface。另一方面,本 PR 没有声称完成更大的 #4447 语义收敛工作,这个边界合理。

未来向检查已做:当前最有价值的小型重构就是删除重复 writer、复用现有 typed owner;继续抽象一套“新 packet”或现在删除历史 reader 都会扩大风险,所以本 PR 不需要额外框架或无证据清理。

English verdict: APPROVE — exact head 1e6f42d6908bbaabacf32edfdffa002404c2e7ec retires every fresh legacy packet writer, preserves signed retained-selection reentry and known-v0 readers, documents the default cutover, and passes the focused cross-runtime, migration, and full premerge validation set.

Signed-off-by: song <22676124+songoow@users.noreply.github.com>

@songoow songoow left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

动机

本次复审绑定 exact head 9fef0ff6b374cc23957c9707477817a7f3780ad9。Discussion #4738 的 PR-05 要求按 reader-first、writer-second 方式退休新 quota 输出中的 protocol_action_packet:新输出停止维护派生摘要,当前消费者使用 typed contracts,具名 v0 历史继续读取,签名篡改继续 fail closed。

旧实现从 ordinary、paused、live projection、retained-selection reentry 和 prior-turn recovery 多处写入同一观察字段。只合并重复渲染无法消除这份维护职责;本 PR 删除 fresh writer 与未使用 builder,同时保留有证据的历史 reader。

改动思路

quota、interaction、work-lane、scheduler 和 Envelope signature owner 不变。新路径只删除 fresh payload 的观察字段和 capsule witness,没有 replacement summary、feature flag 或第二套 authority。历史 protocol_action_packet_fields()、Markdown/Effect/Envelope reconstruction、residue、opaque fallback 与 host canonical-signature 校验继续存在。

版本边界是首个包含本变更的正式发行版;v1.1.0 不变。依赖旧字段的外部客户端需迁移到 typed contracts 或继续固定 v1.1.0。历史 reader 未来若删除,需要独立破坏性迁移。

具体改动

关键代码讲解

  • ordinary、paused、live required-read/capability-intent、retained-selection reentry 和 unsettled-host recovery 不再写 fresh packet。
  • current-main retained selection 与 receipt/replan reconciliation 完整保留;组合回归证明状态进入 action_selection_required,interaction 关闭执行,source/Envelope 都不含 packet,签名文档一致,host primary action 与 source 一致。
  • 当前 smoke/consumer 改读 interaction_contractwork_lane_contractscheduler_hint 等 typed owner。
  • 固定 v1.1.0 decision/Envelope 原始对象与哈希;24 个 action/spend/witness/signature corruption 变体必须拒绝。
  • 版本 verifier 要求准确且未修改的 v1.1.0 checkout,并复核 8 个 fresh 输出和 4 个 frozen 历史对象。

对主干的风险

最大风险是未知仓库外客户端仍读取旧字段;该范围已明确排除,并提供 migrate/pin/rollback 合同。仓库内实际扫描只剩 Python 1 个、TypeScript 2 个兼容 reader,fresh writer 为零。retained selection、required reads、pending capability intent、host recovery、Envelope 与安装 wheel 都经过真实路径验证。

本地验证包括 live-decision 26 项、retirement/history 30 项、native TypeScript 26 项、versioned readback 12 项、semantic drift、Ruff、typecheck 和 diff check。扩展 Python 组为 309 passed;另两个 prompt-upgrade 命令长度断言在 clean current main 上同样失败,未混入本 PR。最终 exact head 的项目快照报告 28 项 CI 全部成功。

语义与 CI 对齐

该 PR 删除的是派生 observation writer,不改变 action、receipt、identity、capability、lease 或 spend 的 typed authority。保留 protocol_action_packet_fields() 是历史签名 reconstruction 责任,不是 fresh writer。semantic budget 已收紧到真实 reader 集合,没有提高预算或缩小扫描范围。

我的整体评价

APPROVE conclusion。 PR-05 已完整实现:fresh writers 与 builder 实际删除,当前消费者迁移,具名历史与 corruption rejection 有版本化证据,当前主干 retained-selection 冲突也已闭合。未知外部客户端与完整私有 archive 仍是明确边界,不影响本次具名迁移。合并由维护者决定。

English verdict: APPROVE — exact head 9fef0ff6b374cc23957c9707477817a7f3780ad9 removes every fresh legacy-packet writer, preserves current-main retained-selection behavior and bounded v0 history, passes 12 versioned readbacks and all 28 exact-head checks, and leaves no blocking finding.

huangruiteng
huangruiteng previously approved these changes Sep 21, 2026

@huangruiteng huangruiteng 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.

动机

本次复审绑定 exact head 9fef0ff6b374cc23957c9707477817a7f3780ad9。PR-05 的目标是停止在 fresh quota output 中双写 protocol_action_packet,让 interaction_contractwork_lane_contractscheduler_hint、receipts 与签名继续作为唯一 typed authority,同时保留具名 v0 历史对象的读取和篡改拒绝。

这不是纯粹压缩 payload:旧 packet 是 typed decision 的派生观察,却要求 ordinary、paused、live projection、retained-selection reentry 和 prior-turn recovery 每条路径同步维护 writer、summary 与 witness。只删一处 renderer 或改名都不能消除第二份语义责任。当前方案直接删除 fresh writers,保留 bounded history readers,是完整且比例合适的迁移。

改动思路

fresh 路径继续沿既有 owner 运转:quota 产生决定,interaction/work-lane/scheduler 投影行动和义务,TurnEnvelope 对规范 action dimensions 签名,host 只从 typed contract 提取 authority。历史路径则保留 protocol_action_packet_fields()、Python/TypeScript Envelope/Effect compatibility、residue/opaque fallback 与 canonical signature validation;历史 witness 只能作为 observation,不能重新授权任务、写 scope 或 spend。

上一条 exact-head approval 绑定 1e6f42d6908bbaabacf32edfdffa002404c2e7ec。我做了失效检查:当前 head 以最新 origin/main@09f10c4e37b89c6ed25f2f2354f89d641662e83c 为 merge base,last-review-to-head 只改 test_effect_turn_live_quota_decision.py 的 13 行断言,没有改变 production、docs、fixtures 或历史 reader。因此之前的 whole-PR 架构/迁移证据仍满足原假设;本轮重点验证新增的 negative authority 断言并重新跑完整受影响组。

具体改动

关键代码讲解

  • live_decision.py::_apply_retained_action_selection_reentry 保留 current-main 的 retained Todo reconciliation,重建 typed interaction contract 后不再写 fresh packet。新断言进一步要求该反例必须是 mode=skipmust_attempt=falsedelivery_allowed=false
  • should_run_packet.py::_build_quota_should_run_payload 与 ordinary/paused/live/recovery siblings 删除 legacy builder 调用,但 typed action、delivery、scheduler、receipt 和 settlement identity 仍由原 owner 生成。
  • turn_envelope.ts::buildTurnEnvelope 对 fresh source 不再增加 packet witness;对 known v0/residue/opaque 历史输入继续保存可验证 observation,canonical signed dimensions 不变。
  • interaction_contract.py::protocol_action_packet_fields 仅保留为历史有序字段 reconstruction;build_protocol_action_packet 已删除,仓库扫描没有 fresh writer。

whole diff 为 43 个文件、+1708/-615。production 改动主要是删除 29 行 legacy writer/builder,较大体量集中在冻结 v1.1.0 历史 fixture、跨 runtime compatibility tests、迁移 verifier 与双语协议说明。它没有新增状态、CLI 或 replacement packet;这部分体量与“默认切换 + 历史读兼容 + tamper fail-closed”的风险相称。

对主干的风险

最强反例不是“字段还在不在”,而是:retained selection 在没有 packet 后是否会悄悄回到可执行状态,或保留写/spend authority。最新 commit 正面补上了这组检查;我实际执行的 exact-head 结果为:

  • focused Python quota/history/retirement/Envelope/semantic 组:首次因新 worktree 未安装 TypeScript parser 依赖出现 16 个环境失败;按仓库提示运行 npm ci --ignore-scripts 后完整重跑,255 passed in 61.01s,没有跳过或隐藏首次失败;
  • native TypeScript compatibility、TurnEnvelope、Effect:31 passed
  • semantic vocabulary drift smoke 通过,仍精确登记 Python 1/1、TypeScript 2/2 个 history readers,没有抬预算或缩扫描范围;
  • focused Ruff、control-plane typecheck、git diff --check 和当前-main merge-tree 全部通过,merge tree 为 26859bb0d7e92aa78c5e37e9dc32c3e8f0a6fac5

语义与 CI 对齐

这次默认变化已明确披露:首个包含本变更的发行版开始,fresh output 不再有 legacy packet;未知外部客户端需要迁移到 typed contracts 或 pin v1.1.0。它复用现有 vocabulary,不新建 authority 语义;known-v0 reader 是兼容责任,不是 fresh writer。当前 capability 要求 wait_for_ci=false,因此我没有读取或等待远端 CI,结论来自 repository-native local evidence。

剩余风险是仓库外客户端可能硬编码该字段。PR 已明确列出支持边界、迁移与 rollback,继续双写反而让两个 authority surface 永久漂移。未来如果要删除 historical readers,必须另做 breaking migration,不能把这一步偷偷并入当前 PR。

我的整体评价

APPROVE。 exact head 9fef0ff6b374cc23957c9707477817a7f3780ad9 完成 fresh writer retirement,保留 current-main retained-selection 行为和 bounded v0 history,并用新增反例证明 packet 缺席时 reentry 仍是 skip、无写 scope、无 spend。whole diff 的生产机制是净删除,兼容证据与文档体量虽大但有真实迁移成本支撑;未发现新的 blocker,也不需要再抽象一个替代 packet。

English verdict: APPROVE - Exact head 9fef0ff6b374cc23957c9707477817a7f3780ad9 removes every fresh legacy-packet writer, preserves typed retained-selection and bounded v0 history, proves reentry remains skip/no-write/no-spend without the packet, and passes 255 Python tests, 31 TypeScript tests, semantic drift, lint, typecheck, diff and merge-tree validation.

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>

@huangruiteng huangruiteng 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.

English verdict: APPROVE — no blocking findings on exact head f2381b794920fb551072e39d90bfb9d9bec7e574.

动机

PR-05 的目标是完成 reader-first、writer-second 的迁移:新 quota 输出不再重复写入由 interaction_contractexecution_obligationwork_lane_contractscheduler_hint 和签名 action dimensions 已经拥有的事实,同时继续读取存量 v0 对象。当前精确 HEAD 已覆盖所有六条 fresh writer 路径;这是可独立交付、可回滚的完整 cutover,而不是只删掉一处写入。

改动思路

新决策继续由现有 quota/interaction owner 产生,TurnEnvelope 继续由 TypeScript transaction 和 action signature 掌权;删除的只是重复的 prose summary writer。历史对象仍走 protocol_action_packet_fields 与 Envelope/Effect compatibility reader,verified/residue/opaque/missing 四种冻结形态均保持可读,任何 signature、action、spend 或 witness 篡改继续 fail closed。

具体改动

生产代码删除普通、暂停、live projection、retained selection 和 unsettled recovery 路径的 packet 写入及未使用 builder;bundled consumers 改读 typed contracts;文档明确 fresh-output 默认变化、外部客户端 pin/migrate 选择、reader lifetime 与回滚边界。新增冻结 v1.1.0 fixture、真实 CLI 首次/重放、host authority、corruption 和 semantic ratchet 覆盖。

关键代码讲解

  • loopx/control_plane/quota/should_run_packet.py:1381 _build_quota_should_run_payload:返回完整 typed quota payload,但不再追加 legacy packet。
  • loopx/control_plane/quota/live_decision.py:461 build_live_quota_should_run_decision:required reads、capability intent、retained selection 与 recovery 更新权威 typed fields,不再为中间状态重建摘要。
  • loopx/control_plane/quota/turn_envelope.py:67 build_turn_envelope:fresh payload 生成 packet-free capsule;历史 payload 仍通过 canonical TypeScript transaction 与签名校验。
  • loopx/control_plane/work_items/interaction_contract.py:286 protocol_action_packet_fields:仅保留 v0 历史重建/验证能力;fresh builder 已删除。

对主干的风险

主要风险是某个 bundled consumer 仍把 packet 当权威,或历史对象在兼容路径中获得未签名 authority。精确 HEAD 的本地证据覆盖 273 个 focused Python cases、3 个新增受影响 settlement CLI cases、31/31 个 focused TypeScript cases、真实 packet-free CLI smoke,以及四种冻结历史对象和六类 corruption;TypeScript typecheck、mypy、Ruff、git diff --check、公共边界检查和 19/19 pre-merge canary 均通过。远端 CI 按 wait_for_ci=false 未查询也未等待。

语义与 CI 对齐

这是已披露的 intentional output contraction:fresh JSON/Markdown/Envelope 唯一预期差异是缺少 protocol_action_packet,其余 action、required reads、write scope、spend、receipt/replay 与 signature 语义由现有 typed vocabulary 继续拥有;历史 v0 reader 不变。精确 diff 的 change-quality receipt 为 cqr_8c36541c1be51a9bf573

我的整体评价

未发现 blocking finding。实现选择删除重复 authority 并复用现有 owner,没有新增状态、CLI 选项或替代 summary;新增体量主要来自冻结 fixture、负向兼容测试和迁移文档,和首次 reader/writer cutover 的风险相称。残余风险是未知外部/私有客户端仍依赖 fresh packet,文档已给出 pin-or-migrate 边界。由于这是 runtime/control-plane 变更,审批结论为 APPROVE,但仍必须由另一位 maintainer 合并,不能由本次修复者 admin-bypass 自合并。

@huangruiteng
huangruiteng merged commit 37dbac9 into loopx-project:main Sep 21, 2026
17 of 23 checks passed
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