Skip to content

feat(alignment,quota,rfc): goal-oriented peer coordination RFC, M0 projection & automatic M1 Turn digest - #9502

Open
loopx-agent wants to merge 5 commits into
mainfrom
codex/goal-oriented-multi-agent-coordination-m0-20261127
Open

loopx-agent wants to merge 5 commits into
mainfrom
codex/goal-oriented-multi-agent-coordination-m0-20261127

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR delivers M0 + M1 of Goal-Oriented Multi-Agent Peer Coordination (EN RFC, 中文版) and resolves D1:

  1. M0 (Read-Only Peer Frontier & Opportunity Projection):
    • loopx/control_plane/goals/peer_coordination.ts projects bounded peer_frontiers (<=12) and deterministic collaboration_opportunities (<=8: shared_target_collision_risk, peer_verification_needed, peer_unleased_lane_attention, shared_domain_synergy, all grants_authority: false / read_only: true) from canonical file_v0/sqlite_v0 snapshots via loopx shared-goal-alignment / goal-alignment.
  2. M1 (Automatic, Conditional Default-On Turn-Envelope Digest & Resolved D1):
    • No manual CLI pull or opt-in flag needed on ordinary product paths: loopx quota should-run automatically evaluates goal.peer_coordination_digest.project (peer_coordination_digest.ts, peer_coordination_digest_source.py) and embeds peer_coordination_digest onto TurnEnvelope (v0 / v1 C1 + readyWorkOpening + progressive_context opening).
    • Smart signal tiering (D1 Resolved):
      • Busy Turn: only shared_target_collision_risk ("collision") and peer_verification_needed ("verify").
      • Idle Turn (caller_lanes == []): peer_verification_needed ("verify") and high-priority peer_unleased_lane_attention ("unleased") for idle wakeup.
      • shared_domain_synergy remains pull-only via loopx shared-goal-alignment.
    • Strict <=300 B cap & 0 B when inactive: Budgeted strictly at <=300 B serialized UTF-8 delta including the ,"peer_coordination_digest": field key (~75 tokens / <0.04% of a 200K context window). Omitted cleanly (0 B) on single-agent Goals (<2 registered agents), empty qualifying sets, unchanged cursors, --dry-run, scheduler skip actions, or explicit off overrides (coordination.peer_coordination_digest: "off" / LOOPX_PEER_COORDINATION_DIGEST=off).
    • Live cursor auto-commit & pruning: Live non-preview non-skipped Turns persist/prune seen IDs at <runtime_root>/goals/<goal_id>/peer-coordination-cursors/<agent_id>.json.

Verification (Local Worktree @adb6cc1fc9)

  • npm run typecheck:control-plane: passed
  • node --experimental-strip-types --test tests/control_plane_ts/shared_goal_alignment.test.ts tests/control_plane_ts/peer_coordination_digest.test.ts tests/control_plane_ts/turn_envelope.test.ts tests/control_plane_ts/content_digest_single_owner.test.ts: 131/131 passed
  • uv run --extra test python -m pytest tests/control_plane/test_shared_goal_alignment.py tests/control_plane/test_shared_goal_alignment_cli.py tests/control_plane/test_peer_coordination_digest.py: 72 passed (File & SQLite canonical parity + --dry-run / cursor / idle wakeup / opt-out)
  • uv run --extra test python -m pytest tests/control_plane/test_cli_output_budget.py: passed (0 B baseline growth; 123 passed, 1 skipped combined prior to M1 helper extraction; re-validated via canary premerge below)
  • uv run --extra test ruff check ...: passed
  • python3 scripts/generate_rfc_status_index.py --check, python3 examples/docs-governance-smoke.py, python3 scripts/check_rfc_bilingual.py --base origin/main --head HEAD: passed
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main: passed (6/6 direct checks including maintainability ratchet, 10/10 catalog canaries including cli-output-budget-regression-smoke.py & semantic-vocabulary-drift-smoke.py, 8/8 risk profile smokes, 1/1 public boundary check)

Note: Kept strictly OPEN for maintainer review (adb6cc1fc9e0fdbca5d5a03a16d002127b59671a, fast-forwarded over 43f0021102).

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

[P2] 损坏的 Peer lease epoch 被显示为活跃。File 与 SQLite 的 CLI 都把持久 Peer 租约 epoch=0 返回为 lease_active=true;相同记录绑定到调用方时,基线与当前头都拒绝。RFC 要求损坏的 Peer 记录降级为 null。活跃标记可能让调用方跳过核对已损坏的租约。 沿用调用方同一租约记录校验,验证 owner 和 epoch 后再返回 true,校验失败的 Peer 项返回 null。 源码

[P2] 空闲调用时丢失同一 P0 Peer 的无租约提醒。在两种 canonical 存储上,该 Peer 的 lease_active=false 且声明待验证。只有一个 Peer,未触及输出上限,CLI 仍只返回 peer_verification_needed。空闲分支的 else if 屏蔽了 peer_unleased_lane_attention,而有调用方通道时两种机会可以并存。 分别计算两种机会再使用统一排序及上限。若这是预期的互斥策略,请在中英文 RFC 中写明并提供同一双命中用例。 源码

动机 / Motivation

给同一 Goal 的 Peer 发现重叠工作和独立验证需求,保留只读与现有执行门禁。 基线 CLI 给出进展通道计数和与调用方有关的冲突,两个协同数组属于此次新增。 使用共享 Goal 对齐视图规划后续工作的 Peer 和维护者。

调用方可能据租约活跃状态决定先避让还是先核对,错误状态会影响下一步。 同一批 canonical 记录分别通过 File 和 SQLite 的真实 CLI 读取。已有字段逐项相等,读取前后 provider revision、Todo/租约和磁盘持久内容相同。相邻写域触发碰撞提示,外部仓库的同名目标没有误配。重复读回机会 ID 一致,15 条输入输出 12 条 Peer 前沿与 8 条机会,机会的 grants_authority 均为 false。 本地 TypeScript alignment/amendment 在基线 74 项、候选 76 项通过。候选 Python alignment/CLI/amendment 100 项通过,双语 RFC diff 校验通过。独立 CLI 覆盖每后端 6 个场景。 证据来自隔离 File/SQLite 与合成快照。M1–M3、现有部署及远端 CI 未验证。 基线契约

改动思路 / Approach

该改动沿用 canonical Todo/lease → Python 快照适配 → TypeScript 对齐 → CLI JSON/Markdown。沿用 shared goal alignment 和既有仓库、写域重合规则,无需引入新存储或第二个权限检查点。 正向读路径复用 canonical 快照。Peer 分支只检查状态和到期时间,漏掉调用方已验证的记录字段。空闲分支则把可同时为真的两个条件做成互斥。 把读取活跃租约所需的事实校验共用,移除 Peer 和 caller 的不一致。机会排序和上限保留在一个归约器内。

具体改动 / Changes

精确提交 e9e8b4b,本次对照目标 50b4cc9。14 个文件 +1138/−26,新增逻辑主要集中在 297 行匹配器,双语 RFC 与回归夹具占其余大头。

关键代码讲解

  • peerLeaseActive。目前的 Peer 活跃判断只调用 leaseIsActive,缺少 epoch 健全性。 源码

  • projectPeerCoordination。由同一快照构造两组只读数组。空闲分支目前只保留其中一类双命中机会。 源码

  • projectPeerCoordination 调用。将匹配器接入现有对齐协议。 源码

  • render_shared_goal_alignment_markdown。将数组机械渲染为终端摘要。 源码

  • m0-readonly-advisory-correctness(partial)。损坏 Peer 租约投影为 null,自身损坏沿原边界拒绝,四类机会按可观察输入决定,均只读。

对主干的风险 / Risks

File 和 SQLite 都把有效期未到、但 epoch 为 0 的 Peer 租约投影为 lease_active=true;同样的损坏记录属于调用方时,两版本 CLI 均退出 1 并给出 lease epoch must be a positive integer。两后端都能把 Peer 的非法到期时间正确降级为 null。另外,空闲调用方遇到同时无租约和待独立验证的 P0 Peer,只收到验证机会,遗漏了 RFC 同样定义的无租约提醒。 故障恢复信息会影响 Peer 对是否需要核对或避让的判断。修复后仅重跑定向回归即可区分。 复用租约 owner 与 epoch 的现有校验,将校验失败的 Peer 观察降级为 null;为无活动调用方分别计算独立验证与无租约,沿同一排序及上限裁剪。若协议要让二者互斥,应在双语 RFC 明确优先规则并调整验收。

我的整体评价 / Verdict

REQUEST_CHANGES。 请修复两个与 M0 双语契约不一致的分支。两种后端的旧字段和持久零写对照已通过。 先修正提供给 Peer 用来决定下一步的事实,再继续 M1 的持久摘要工作。

English verdict: REQUEST_CHANGES at e9e8b4b. The File and SQLite CLI trials exposed two M0 contract misses: invalid peer lease epochs read as active, and idle dual-match discovery drops the unleased-lane advisory. Existing fields and durable state remained stable.

@loopx-agent
loopx-agent force-pushed the codex/goal-oriented-multi-agent-coordination-m0-20261127 branch from e9e8b4b to 5cca062 Compare November 26, 2026 21:08

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

[P2] 无法识别的租约版本被当成未租用。File 与 SQLite 的真实 shared-goal-alignment 查询都给出 lease_active=false 和 peer_unleased_lane_attention。M0 的三态契约要求无法解释的记录为 null,此时不能产生“未租用”的建议。相同 fixture 换回已支持的 schema 后正常显示为 true。 在判断活跃性前区分缺失、可解析的已释放或过期记录、不可解释的租约记录。继续用原有 task-lease codec 判断已知记录,并让未知输入只降级该 peer。 源码

[P3] 输出上限约束不到配对计算。隔离 TypeScript 对照里,160 个 caller 与 160 个 peer 只返回 8 条机会,候选 reducer 的三次耗时为 123–131 ms。基线同调用约 0.2 ms。范围仅为同进程合成 reducer 计时,尚未测量真实 CLI 延时。 在扩大消费范围前,核验实际大队列成本,使配对、候选保留和排序与输出目标一致,同时维持目前的确定性优先级。 源码

动机 / Motivation

让同一 Goal 的 Agent 通过已有 alignment 读取彼此推进中的工作,发现碰撞和验证需求。 基线主要提供同伴计数和已绑定的 Todo ID,调用方需另读工作详情才能判断交集。 调用 shared-goal-alignment 或 goal-alignment 的同 Goal peers,以及复用其工作来源的 amendment 调用方。

错误的空闲位会把不可验证的任务放入协调建议,造成不必要的协调并削弱碰撞提示可靠性。 此前发现的 epoch=0 降级和闲置调用者双建议已由 File/SQLite 用例覆盖。已支持的活跃 lease 在两 provider 均正常输出 true。 精确基线的公开 alignment CLI 与 authority 测试 48 项通过,候选 60 项通过。候选 amendment CLI 和维护性共 36 项通过,TypeScript 93 项通过、4 项跳过,typecheck、双语 RFC diff 与索引校验通过。File/SQLite 反例各核对了有效与未知版本。 独立验证范围是精确源码、合成快照,以及 File/SQLite 原生 CLI。PostgreSQL 用例按自身环境条件跳过。M0 交付是 CLI 读取,后续 Turn digest、Inbox 协调、前端读取路径及真实大队列耗时需要相应验收。 验收契约

改动思路 / Approach

该改动沿用 loopx shared-goal-alignment → canonical Todo/lease snapshot → sharedGoalWorkFacts → projectPeerCoordination → JSON/Markdown。复用 canonical provider、租约活动性、仓库与 scope overlap 的现有 owner,Python 负责事实转发,使用同一投影支持 JSON 与 Markdown。 新增的 peer 三态需同时表达 true、false、null。当前活动性检查先把未知 schema 当作非 active,阻止了 peer 异常降级。 保持已有同 Goal 只读命令与现有 lease codec,先在该读模型区分未知和确定失效的 lease。

具体改动 / Changes

精确提交 5cca062,本次对照目标 6915df6。14 文件 +1548/-26。包括中英 RFC、单个 TS 匹配 reducer、canonical 源转发、CLI 展示及 File/SQLite 与 TS 回归。

关键代码讲解

  • read_shared_goal_work_source。以同一 provider revision 读 Todo 与 lease 快照。 源码

  • peerLeaseActive。把每个 peer 的租约投影为三态。 源码

  • projectPeerCoordination。匹配已读事实,确定建议排序与上限。 源码

  • projectSharedGoalAlignment。解码请求、保留现有字段及附加只读建议。 源码

  • unknown-peer-lease-remains-unknown(not_met)。无法解释的 peer lease 要保持 lease_active=null,不能被当作已知空闲。

对主干的风险 / Risks

同一合法活跃记录正常为 true。仅改为无法识别的 schema 后,File 与 SQLite 都误判为 false,并发出未租用建议。 错误的空闲 advisory 已在两个 provider 复现。合成大队列另暴露出有界输出之后的配对开销。 在现有活动性语义前先区分无记录和未支持的 schema,保持可验证的 false 与 unknown 分离。

语义与 CI 对齐

同一合法活跃记录正常为 true。仅改为无法识别的 schema 后,File 与 SQLite 都误判为 false,并发出未租用建议。 在现有活动性语义前先区分无记录和未支持的 schema,保持可验证的 false 与 unknown 分离。

我的整体评价 / Verdict

REQUEST_CHANGES。 请先保持不可解释 lease 的不确定性。此前两个修复均由当前入口回归覆盖。 同伴发现可减少重复探查。收益取决于对租约不确定性的诚实表达。

English verdict: REQUEST_CHANGES at 5cca062. The exact head fixes the previous two counterexamples, but both canonical providers still translate an unrecognized peer lease into an unleased advisory. Preserve the unknown state before shipping M0.

…RFC and M0 projection

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/goal-oriented-multi-agent-coordination-m0-20261127 branch from 5cca062 to 43f0021 Compare November 26, 2026 21:49

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

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

动机 / Motivation

让同一 Goal 的 Agent 通过已有 alignment 读取彼此推进中的工作,发现碰撞和验证需求。 基线主要提供同伴计数和已绑定的 Todo ID,调用方需另读工作详情才能判断交集。 调用 shared-goal-alignment 或 goal-alignment 的同 Goal peers,以及复用其工作来源的 amendment 调用方。

这次补上的是已实际出现的未知租约误报。按规范保留 null 能避免从同伴数据推断出可接手的任务。 File/SQLite 中已知活动租约为 true,无未租用建议。未知租约为 null,回应依然 read_only。160×160 相同范围合成 reducer 返回 8 条,本机三次 1.4–2.1 ms,上一候选同构输入的三次结果为 123–131 ms。 候选原生 alignment 与 provider 回归 64 项通过,amendment 定向用例通过。TypeScript 141 项通过、4 项跳过。typecheck、双语 RFC diff 和 RFC 索引通过。基线保留 read_only 并没有两组新增投影。 证据涵盖固定源码、真实 File/SQLite CLI 和合成 TS 对照。4 个 PostgreSQL 条件用例跳过。合成计时不覆盖真实大 Goal CLI I/O,M1–M3、安装和远程 CI 未纳入本次核验。 验收契约

改动思路 / Approach

该改动沿用 loopx shared-goal-alignment → canonical Todo/lease snapshot → sharedGoalWorkFacts → projectPeerCoordination → JSON/Markdown。Python 从同一 canonical provider 快照转发事实。TypeScript 保留决策和排序,目录前缀索引复用原有 scope 匹配,覆盖预期定序。 先验证已知 lease 格式,再判定是否活跃。索引只筛可能匹配的条目,最终 scope 匹配仍调用租约已有语义。输出按既定优先级截断。 复用已有的 canonical provider 与 scope 判定。按仓库、目标、域和路径做一次预计算,对前 8 项保留原有效信号和定序。

具体改动 / Changes

精确提交 43f0021,本次对照目标 6915df6。15 文件 +2376/-29。相较上一审,生产变化集中在 peer 三态编解码、基于现有 scope 语义的匹配索引和按排序截断,另有针对性回归。

关键代码讲解

  • read_shared_goal_work_source。以同一 provider revision 读 Todo 与 lease 快照。 源码

  • parseKnownTaskLease。先校验 lease 版本与字段,再区分活动、失效和未知。 源码

  • projectPeerCoordination。复用范围匹配语义并按既定偏序截断建议。 源码

  • projectSharedGoalAlignment。保留已有属性并增加只读协调投影。 源码

  • unknown-peer-lease-remains-unknown(implemented)。未知或损坏 peer lease 保持 null,caller 的执行许可不从 advisory 推导,机会排序和数量保持 RFC 定义。

对主干的风险 / Risks

File/SQLite 中未知 schema 和损坏 epoch 均不会发出未租用建议。Caller 的损坏 epoch 仍报错。额外 262,450 个合成 scope 对照未见过滤遗漏。 大 Goal 的真实 I/O 延迟与候选分布没有形成性能验收,M0 建议上限的观测来自同机合成数据。 先区分缺失、已知失效和无法解释的租约。索引只提前排除可证明不相交的候选,并保留已有规范匹配作为最终判断。

我的整体评价 / Verdict

APPROVE。 此前的租约 P2 已在两种持久化后端关闭。上一轮索引成本疑虑在同构合成对照中显著缓解。按 RFC 的 M0 只读边界通过。 协作建议可以帮助发现重复工作,实际 claim、写入与授权仍由原有入口独立决定。

English verdict: APPROVE at 43f0021. The exact head preserves unknown peer lease state on File and SQLite, keeps existing caller rejection, and matches the exhaustive scope oracle and prior ordering. This approves the M0 read projection. Large-goal CLI I/O and later milestones were outside the verified scope.

…ion digest and resolve D1

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent loopx-agent changed the title feat(alignment,rfc): add goal-oriented multi-agent peer coordination RFC and M0 projection feat(alignment,quota,rfc): goal-oriented peer coordination RFC, M0 projection & automatic M1 Turn digest Nov 27, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

动机 / Motivation

同一 Goal 的 Agent 应能在普通 Turn 看到即将撞车或需要核验的工作。现有 M0 提供按需查询,这个增量尝试保留 M0,并在最多 300 B 的摘要里提示高优机会。当前精确头 adb6cc1fc9e0fdbca5d5a03a16d002127b59671a 会让普通 quota should-run 直接退出,单 Agent 和配置 off 也受影响。

多人共享 Goal 的常规 quota/heartbeat caller,同时影响普通单 Agent 和显式 off 用户。 父提交的真实应运行判断成功,新头的普通 live 路径在形成输出前抛出导入错。 当前可读 M0 和 preview,live 出口整体失效,适配器还会跳过溢出的机会。

本次的目标是同 Goal 内提示发现。lease、审批和跨主机握手仍由各自的既有流程承担。

改动思路 / Approach

继续复用 canonical Todo/lease、sharedGoalWorkFacts 和 projectPeerCoordination。摘要应保持只读提示,游标应由同一次实际展示的项目驱动。提交阶段重新投影全部活跃候选会把未展示的项目记成已读。

重新读取和写入 active ID 引入已展示事实与原输出脱节。 仅收敛 M0 和 M1,延期 M2/M3。

具体改动 / Changes

相对基线 6915df67db6a8836df344a661f295006873a3ba8 共 26 个文件,+3754/-29。M0 负责机会发现,M1 增量为 14 个文件,+1405/-27,接入 TS 摘要、运行游标以及 TurnEnvelope v0/v1、progressive context 和双语 RFC。独立规格核对了既有管家 RFC 中 Separate request state from coordination and transport state 的边界。M1 的默认和容量是本次明确改变的行为。 基线 RFC

  • [P1] 普通 should-run 导入不存在的模块。 File/SQLite 各测单 Agent、多 Agent、显式 off,父提交 43f0021102 的六组真实 CLI 均成功,此头六组都退出 1。代码在输出前导入 peer_coordination_digest,精确提交只有 peer_coordination_digest_source.py,其提供的提交函数也不同名。M1 pytest 在 collection 因相同导入失效。请把实际 CLI 和测试接到已提交适配器,直接用干净 checkout 复跑。 CLI 导入点
  • [P2] 未展示的机会被写成已读。 在两种 canonical store 上直接调用已提交的适配器,三个合格机会只展示一项,含键 230 B,omitted=2。提交游标后文件有三个 seen ID,下一次同输入返回空摘要。普通 live CLI 先被 P1 阻断,这项反例走适配器。请只确认本次实际展示及历史仍有效的 ID,让被省略的项目可以在后续 Turn 出现。 游标写入点
  • [P3] 双语 RFC 的预览描述与实测不符。 两端 --dry-run 都显示摘要且没有创建游标。若保留此只读预览语义,两份 RFC 都应将“省略字段”改为“可显示但不写游标”。 M1 规范

对主干的风险 / Risks

39 项 TS 测试、64 项 M0 Python 测试及 diff hygiene 独立通过。两种后端的预览也通过。实盘回归与预览正例必须分开。当前摘要不授予 claim、lease、合并或写入权限,额外游标只服务于提醒展示。未完成此头的整套预合并、安装和长程成本测量。按本 Goal 策略未查询或等待托管 CI。

我的整体评价 / Verdict

REQUEST_CHANGES。 先恢复普通守卫的生产入口,再让游标只确认实际展示的机会。M0 的已有定向测试继续通过。M1 上线含义和 D1 的已关闭状态以这两条修复的实盘验收为准。

English verdict: REQUEST_CHANGES — adb6cc1fc9e0fdbca5d5a03a16d002127b59671a breaks live quota guards even with the digest disabled, and the cursor marks omitted opportunities as seen.

…n dry-run RFC

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

Copy link
Copy Markdown
Collaborator Author

Addressed all three findings from review PRR_kwDOStEbEs8AAAABaqZyPA on adb6cc1fc9 cleanly via commit b92b07db2e4d472e9bab21648520c615c79e4229 (branch remains fast-forward, PR stays OPEN):

  • [P1] Complete clean-checkout commit parity (loopx/cli_commands/quota.py, tests/control_plane/test_peer_coordination_digest.py):
    • Committed loopx/cli_commands/quota.py importing maybe_commit_turn_peer_coordination_cursor from ..control_plane.goals.peer_coordination_digest_source (and fixed UnboundLocalError on runtime_root across --dry-run/exception paths by passing context.runtime_root if context is not None else None and guarding runtime_root is None).
    • Committed tests/control_plane/test_peer_coordination_digest.py cleanly (git status --short completely empty).
    • Verified directly against an isolated clean git archive HEAD checkout (11 passed in 9.88s, confirming loopx imports from the archive directory).
  • [P2] Displayed-only incremental cursor advancement (peer_coordination_digest.ts, peer_coordination_digest_source.py):
    • projectPeerCoordinationDigest now returns displayed_opportunity_ids containing only items actually packed into digest.items.
    • maybe_commit_turn_peer_coordination_cursor computes (existing_seen & active_ids) | (displayed_ids & active_ids) via displayed_opportunity_ids_from_digest + commit_displayed_peer_coordination_cursor, so omitted > 0 overflowing items remain unseen and surface naturally on subsequent live Turns.
    • Added TypeScript and Python File/SQLite end-to-end progressive-turn regression tests.
  • [P3] Bilingual RFC --dry-run contract alignment (docs/architecture/rfcs/goal-oriented-multi-agent-coordination-v0.md & .zh-CN.md §5/§12 D1):
    • Aligned both EN and ZH RFCs with live CLI behavior: read-only preview (--dry-run) may display peer_coordination_digest without creating or advancing the persistent cursor.

Post-Commit Local Verification (b92b07db2e)

  • npm run typecheck:control-plane: PASS
  • Node TS tests (shared_goal_alignment, peer_coordination_digest, turn_envelope, content_digest_single_owner): 132/132 PASS
  • Python pytest (test_shared_goal_alignment.py, test_shared_goal_alignment_cli.py, test_peer_coordination_digest.py, test_cli_output_budget.py): 126 passed, 1 skipped (0 failed)
  • Isolated clean-checkout git archive HEAD pytest (test_peer_coordination_digest.py): 11/11 PASS
  • ruff check, generate_rfc_status_index.py --check, docs-governance-smoke.py, check_rfc_bilingual.py: PASS
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main: PASS (Direct 6/6, Catalog 10/10, Risk Smokes 8/8, Public Boundary 1/1, 0 failures)

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

需修订 b92b07db2e4d472e9bab21648520c615c79e4229,对照 6915df67db6a8836df344a661f295006873a3ba8。

  • [P2] 决策未交付时游标已经前移。 在 File 和 SQLite 上使用相同的真实 CLI 夹具。正常决策输出一条碰撞提示,游标仅记该项,下轮显示此前省略的核验提示。模拟已获准的决策捕获写盘失败时,首轮退出 1 并只返回 quota_decision_transport_failed,游标仍记下同一条未交付的碰撞提示。下轮直接显示核验提示,首次碰撞提示消失。 _execute_quota_command 在 _emit_quota_result 前调用游标写入,所以成功选入内存摘要会被误当成成功交付。将游标推进绑定到该呈现渠道实际成功交付的条目和原 Turn。捕获或发送失败时保留此前游标,并验证同一决策恢复、后续正常 Turn 及重复读回各自的幂等行为。 游标提交点 传输失败收据

动机

受影响的是在共享 Goal 的普通 Turn 中接收协作冲突和复核建议的 Agent。 以往 Agent 需主动读取共享工作。M1 把符合条件的少量建议放进首读,并用游标保留以后应显示哪些建议。 普通 Turn 能看到合格提示;预算截断、交付失败和只读预览保留未看到的提示,不增加权限。 仅隔离本地 File/SQLite 夹具、真实 CLI、TypeScript 单测及双语 RFC。托管 CI、生产 Goal 和各 App 宿主未执行。

改动思路

保留已有 canonical 快照、租约三态和 M0 只读查询。TypeScript 负责挑选与裁剪建议,Python 沿用 quota 的信封和捕获入口。实际送达归传输层判断,游标只负责接收方读取进度。 投影 游标 owner

具体改动

完整差异 26 文件 +3,985/-29,本次增量 7 文件。M1 acknowledgement after delivery 在成功输出时满足,捕获失败时仍未满足。D1 read-only preview 通过,两个后端的 --dry-run 都能预览且保持游标未创建。原三项中,干净检出的正常 CLI 导入、预算截断条目在下一轮浮现、EN/ZH §5 和 §12 的预览描述均已核对。 英文 RFC 中文 RFC 上轮结论

关键代码讲解

  • TS 机会计算只选符合角色与预算的条目,保留超限数量。 预算与返回值
  • commit_displayed_peer_coordination_cursor 只把本次给出的 ID 与仍活跃的历史 ID 合并。当前入参来自内存信封。 游标合并
  • emit_quota_result 在游标前移后才捕获并发布决策,失败时输出诊断。 发布

对主干的风险

默认启用只作用于符合条件的多 Agent Goal。显式关闭与单 Agent 路径均省略摘要及游标。协作建议不改变领取和写入权限。产物发布失败时,接收方可能永久错过有用的碰撞提示;普通成功路径测试覆盖不了此处。两后端的故障对照均显示下一轮跳到了原本被省略的核验提示。 启用条件 失败边界

我的整体评价

精确提交干净检出。Python 126 项通过、1 跳过,Node 132 项通过,控制面类型检查、双语 RFC 和 Git diff check 通过。正常 CLI 双后端首条摘要含键 230 B、omitted=1,下一轮显示原省略的核验提示;预览无游标写入。 这组修订关闭了原来的导入失败、正常输出时丢失溢出项和 RFC 预览描述不一致。当前 P2 保留,因为观察失败一次就导致有效协作提示丢失。应按成功发布确认游标,并给两种后端补发布失败与恢复的实际回归。PR 保持 OPEN。 回归用例

English verdict: REQUEST_CHANGES at b92b07db2e4d472e9bab21648520c615c79e4229. Clean checkout, over-budget item continuation on successful delivery, and read-only previews pass. Both File and SQLite still mark a colliding opportunity as seen when the CLI fails to publish its decision. Commit the cursor only for items actually delivered.

…put and turn

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

Copy link
Copy Markdown
Collaborator Author

Addressed the remaining [P2] finding from exact-head review on b92b07db2e via clean fast-forward commit 1168d9ffb44b5cc43e049c5efd2a0896188fcd0b (PR remains OPEN):

  • Post-delivery cursor binding (loopx/cli_commands/quota.py, quota_result_delivery.py):
    • Removed the pre-emit maybe_commit_turn_peer_coordination_cursor(...) call before _emit_quota_result(...).
    • Cursor advancement now runs inside _emit_and_prune_result(...) strictly after print_payload(...) succeeds with exit_code == 0, so capture write failures, socket handoff failures (quota_decision_transport_failed), native context errors, or stdout write failures preserve the existing cursor untouched.
  • Channel-delivered & Turn-bound idempotency (peer_coordination_digest_source.py, should_run_packet.py, quota_native_context.py):
    • Extended peer_coordination_cursor_v0 backwards-compatibly with delivered_turn_ids (replaying the exact same Turn ID skips re-emitting 0 B and never consumes omitted items meant for the next Turn).
    • Direct delivery commits only displayed_opportunity_ids actually present in the emitted view (extract_delivered_peer_coordination_digest); deferred reference/navigation wrappers (--prepared-capture-reference) do not advance the cursor early.
    • Saved-capture recovery & readback (quota context-read, quota context-project) advance the cursor idempotently via commit_recovered_peer_coordination_cursor(...) only after print_payload(...) succeeds on an ok: true, eof: true read delivering the digest (full capture, /peer_coordination_digest, "", or --initial-read) from a committed live Turn, while unrelated selectors (such as --select /heartbeat_receipt) and repeated readbacks stay idempotent.

Post-Edit Local Verification (1168d9ffb44)

  • pytest (test_shared_goal_alignment.py, test_shared_goal_alignment_cli.py, test_peer_coordination_digest.py, test_quota_decision_capture.py, test_cli_output_budget.py): 202 passed, 1 skipped (0 failed; test_peer_coordination_digest.py 17/17 passed across both File & SQLite failure/recovery/idempotency cases)
  • Isolated clean-checkout git archive HEAD pytest (test_peer_coordination_digest.py): 17/17 passed
  • npm run typecheck:control-plane & Node TS tests: 132/132 passed
  • ruff check, generate_rfc_status_index.py --check, docs-governance-smoke.py, check_rfc_bilingual.py: PASS
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main: PASS (Direct 4/4 + maintainability ratchet 2000 lines, Catalog 10/10, Risk Smokes 8/8, Public Boundary 1/1, 0 failures)

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

[P2] 恢复尾页让尚未送出的协同机会被记成已交付。 候选只成功返回不含摘要的尾页时,File 和 SQLite 都把尚未出现的建议及原轮次记为已交付。下一真实轮次直接跳到 verify,原 collision 项消失。 由同一分页所有者证明完整摘要或确切条目已经随输出交付。收到 EOF 的尾页本身没有这项证明,游标应继续保留未交付项。 相关代码

动机 / Motivation

用同一 Goal 的普通和恢复轮次发现协同机会的 Peer。 新 M1 将协同摘要自动随 Turn 交付并按实际显示的项目去重。上一轮修复要求只有成功送出的内容能够推进游标。 旧 b92b07d 在输出交付前写游标。新头正常输出失败及不相关选择路径保留游标,明确读取摘要后才推进的两个对照通过。 候选只成功返回不含摘要的尾页时,File 和 SQLite 都把尚未出现的建议及原轮次记为已交付。下一真实轮次直接跳到 verify,原 collision 项消失。 范围为 M0 只读对齐、默认打开的 M1 摘要及其恢复提交。M2/M3、实际长期成本和外部宿主均另待验证。 本次验收依据

改动思路 / Approach

将原先输出前的写入挪到输出后正确解决一类失败。恢复回调还需要按真正送出的摘要决定游标更新。 Core 拥有 peer 投影和 lease 状态,现有 capture reader 拥有实际分页和输出,游标只是 advisory 去重状态。 由同一分页所有者证明完整摘要或确切条目已经随输出交付。收到 EOF 的尾页本身没有这项证明,游标应继续保留未交付项。 范围为 M0 只读对齐、默认打开的 M1 摘要及其恢复提交。M2/M3、实际长期成本和外部宿主均另待验证。

具体改动 / Changes

精确提交 1168d9ffb44b5cc43e049c5efd2a0896188fcd0b 对照 GitHub 目标基线 6915df67db6a8836df344a661f295006873a3ba8。28 个文件增加 4,738 行、删除 29 行。包含双语 RFC、M0 对齐适配、M1 Tier 与预算、普通和恢复输出、游标与两种 provider 的测试。 m0-advisory-boundary 的既有边界通过对照。 m1-actual-delivery 仍待修复。M1 在符合条件的多 Agent Goal 默认开启。单 Agent、禁用和无可显示项的覆盖通过,CLI 预览保留只读边界。

关键代码讲解

  • projectPeerCoordination。M0 约束输出上限和优先级。 源码
  • projectPeerCoordinationDigest。类别和 UTF-8 预算决定实际条目。 源码
  • _emit_and_prune_result。输出成功后才进入普通游标写入。 源码
  • _page_delivers_peer_digest。完整捕获与某些选择在 EOF 时直接通过。 源码
  • commit_recovered_peer_coordination_cursor。合并缓存与原 Turn ID。 源码

对主干的风险 / Risks

Model 重新恢复一个大或部分读取的决定后,仍可能错过原本用来调整工作顺序的协同线索。 File/SQLite 选择摘要作为正控均通过,正常成功返回的无摘要尾页各一例失败。现头核心 pytest 202 项通过、1 跳过,TypeScript 132 项通过。 定向 File/SQLite 回归、TypeScript、类型检查、双语 RFC diff、Git diff 检查均已执行;独立分页夹具共两过两失败。 合成 Goal 和真实 File/SQLite 本地 CLI。未独立测量实服并发、实际模型采纳或长期 5% 开销目标。 远端 CI 保留为异步检查。

我的整体评价 / Verdict

REQUEST_CHANGES。 候选只成功返回不含摘要的尾页时,File 和 SQLite 都把尚未出现的建议及原轮次记为已交付。下一真实轮次直接跳到 verify,原 collision 项消失。 由同一分页所有者证明完整摘要或确切条目已经随输出交付。收到 EOF 的尾页本身没有这项证明,游标应继续保留未交付项。 修复后按同一组 File/SQLite 入口与原正控复验,并保留原生准入或建议边界。

English verdict: REQUEST_CHANGES at 1168d9f. A successful recovery tail page that contains no digest still advances the cursor in both File and SQLite. The following live Turn suppresses the unseen collision opportunity. Require proof of actual item delivery before advancing.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

  • [P2] 普通 quota JSON 写入带缓冲的 stdout,接收端关闭导致之后 flush 失败。 没有字节送达,游标已写入机会 ID 和当前 Turn。 源码

同一提交的尾页问题已在前一条评审提出,本轮另对显式选择尾页复验。 同期独立评审

动机 / Motivation

有多个 Agent 的同一 Goal 会在正常准入输出里看到有限的协作提示,例如待复核的结果或并行改动冲突。 旧提交在产生 quota 决策时提前提交游标,捕获或发布失败可能使下轮漏读提示。 读回同一个大捕获的尾页,或者 CLI stdout 的缓冲写入在 flush 阶段失败。两种情况下接收端都可能还没看到对应机会。 同步捕获和交接失败已经延后游标提交。缓冲输出失败与只读尾页仍会把未看到的机会记为已交付。 独立测试跑真实 quota 与 context-read 的 Python 命令,在隔离 File 和 SQLite Goal 持久读回,测试输出失败由本地隔离的输出流模拟。

改动思路 / Approach

游标写回移到实际输出回调,复用摘要投影与经过摘要校验的保存结果。存储记录保留同一 Turn 的去重身份。 读回页与 stdout 分别负责报告实际交付,现有游标 owner 只记录被交付的摘要机会。 接收端得到摘要后才推进已读游标。 条件默认开启、0 B 省略、最多 300 B 及同一 Turn 幂等,并保持建议无授权。

具体改动 / Changes

精确提交 1168d9f。目标基线 6915df6,复审对照 b92b07d。28 个文件,增加 4,738 行、删除 29 行。评审条件 M0、M1。 原始契约

关键代码讲解

  • _emit_and_prune_result。打印正常 quota 输出后回调持久化游标,当前调用没有保证刷新 stdout。 源码
  • _page_delivers_peer_digest。根据输出页、EOF 和选择器判断摘要是否交付。 源码
  • maybe_commit_captured_peer_coordination_cursor。读回已捕获 Turn 的身份和摘要,把其条目记入已有游标。 源码
  • handle_native_context_command。复用原 context-read 和 context-project 命令输出后处理。 源码
  • projectPeerCoordinationDigest。机会筛选、排序和预算约束仍由 TypeScript 投影负责。 源码

对主干的风险 / Risks

File/SQLite 回归覆盖同步打印失败、磁盘捕获失败、Socket handoff 失败、无关字段、全量恢复与同 Turn 重放。 本机 TS 套件 132 项通过。Python 并行运行 201 项通过、1 跳过、1 个 native refusal 临时文件失败。该判例在旧头和新头定向重跑各 2 项通过,原并行失败原因未归定。 独立顺序重跑 202 项通过、1 项跳过。

语义与 CI 对齐

两种后端上,缓冲 stdout 没送出任何字节,flush 报 BrokenPipeError,游标已记录一个机会和原 Turn。直接恢复裸捕获尾页或跳到显式选择的最后一页时,只得到一个字节,却同样提前记账,下一真实 Turn 漏掉原机会。 本机完成两种权威存储和隔离 stdout 验证,未测多轮运行中低于 5% 的控制面成本目标。

我的整体评价 / Verdict

REQUEST_CHANGES。 原 P2 已覆盖同步输出异常,仍需解决缓冲失败和恢复尾页导致的协作提示缺失。 成功刷新 stdout 后才回调。页读回需要核对实际覆盖摘要的连续字节范围或交付可独立解析的完整摘要。 File/SQLite 各复跑缓冲写入、全文件尾页与显式选择尾页,核对旧游标和下一轮是否仍显示未交付的机会。

English verdict: REQUEST_CHANGES at 1168d9f. A failed stdout flush or a tail-only context read still acknowledges undelivered opportunities.

…readback cursor

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

Copy link
Copy Markdown
Collaborator Author

Addressed both remaining [P2] findings from reviews 6092266970 and 6092203426 on 1168d9ffb44 via clean fast-forward commit 578ea2c389f354dd8211aac94882f41af6a00663 (PR remains OPEN):

  • Buffered stdout flush verification (loopx/cli_runtime.py, quota_result_delivery.py, quota_native_context.py):
    • print_payload(...) now passes flush=True, and both _emit_and_prune_result(...) and context-project / context-read handlers call sys.stdout.flush() before invoking any cursor advancement callback.
    • A buffered pipe/stdout failure such as BrokenPipeError on .flush() raises before cursor commit runs, leaving the prior cursor intact so the subsequent live Turn still receives the unseen opportunity.
  • Pagination-owner contiguous byte-span delivery proof (quota_context_reader.py, peer_coordination_digest_source.py):
    • Added prove_page_delivered_peer_digest(...) using json.JSONDecoder.raw_decode to compute exact UTF-8 byte spans [span_start, span_end) for peer_coordination_digest across both raw capture documents and selections payloads (/peer_coordination_digest, /work_opening/peer_coordination_digest, "", /work_opening).
    • quota_context_reader.py (read_context_capture, _bounded_initial_read, _saved_context_read_page) populates delivery_proof["delivered_digest"] only when the emitted page byte range [offset, offset + len(content_bytes)) completely covers an unbroken, parseable digest span.
    • maybe_commit_captured_peer_coordination_cursor(...) no longer infers delivery from eof=True: bare capture tail-only pages (--offset raw_len - 1), truncated selection head chunks (eof=False), and explicit --select /peer_coordination_digest tail-only pages (--offset total - 1) all keep the cursor untouched.

Post-Edit Local Verification (578ea2c389)

  • pytest (test_shared_goal_alignment.py, test_shared_goal_alignment_cli.py, test_peer_coordination_digest.py, test_quota_decision_capture.py, test_cli_output_budget.py): 206 passed, 1 skipped (0 failed; test_peer_coordination_digest.py 21/21 passed covering both File & SQLite buffered stdout flush failures and raw + selected tail-only pages)
  • Isolated clean-checkout git archive HEAD pytest (test_peer_coordination_digest.py): 21/21 passed
  • npm run typecheck:control-plane & Node TS tests: 132/132 passed
  • ruff check, generate_rfc_status_index.py --check, docs-governance-smoke.py, check_rfc_bilingual.py: PASS
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main: PASS (19 checks selected, 0 failures: Direct 4/4 + ratchet 2000 lines, Catalog 10/10, Risk Smokes 8/8, Public Boundary 1/1)

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

  • [P2] 整根选择里,在摘要之前出现普通多字节文本,本次仅输出摘要的后半段。 普通中文值位于摘要键之前,使用支持的根节点选择读取时,内层返回的片段坐标已是 UTF-8 字节数,外层却把它加到字符下标再编码。File 用例实际摘要是 [18163, 18392),输出从 18198 开始,SQLite 也漏掉前 35 字节。两端都把原碰撞 ID 和 Turn 写入游标,下一 live Turn 只收到另一条待核事项。上一头在同一非尾页保持空游标并再次给出原碰撞。 源码

旧头的单字节尾页和 stdout 刷新问题已在本头复验通过。 旧头评审

动机 / Motivation

同一 Goal 下的多个 Agent 依赖 quota 输出里的碰撞与待复核提示。 上一精确头会在缓冲 stdout 送出零字节或只读恢复尾页后提前记录游标。 在两个后端重放这两条旧路径,再检查带正常中文目标文本的整根选择局部读取。 刷新失败和单字节尾页已保留机会。整根选择仍可能提前消费碰撞提示。 本机运行原生 CLI 入口、实际 File 和 SQLite 持久状态、同一捕获的回读和后续 live Turn。只有 stdout 故障用隔离缓冲流模拟。 未测完整宿主多轮成本目标或重跑完整 Canary。stdout 抛错由隔离的真实缓冲流模拟。

改动思路 / Approach

输出先刷新。本次实际页覆盖完整摘要的证明由 reader 提供,原游标 owner 负责读回与幂等写入。 TypeScript 负责机会语义,Python reader 负责序列化区间,不增加另一份 Todo 权威。 UTF-8 页证明必须按输出字节精确覆盖完整摘要。 保留条件默认启用、单 Agent 与 off 时省略、原 300 B 上限和只读建议。

具体改动 / Changes

精确提交 578ea2c。目标基线 6915df6,复审对照 1168d9f。30 个文件,增加 5,142 行、删除 42 行。评审条件 M0、M1。 原始契约

关键代码讲解

  • _selection_digest_byte_spans。定位选择结果里的完整摘要。整个根节点由嵌套 value 包装,转换时混用了两种坐标。 源码
  • prove_page_delivered_peer_digest。比对实际输出字节和摘要区间,再把证明交给游标写入。 源码
  • _emit_and_prune_result。等 stdout 成功刷新后才运行交付回调。 源码
  • read_context_capture。从本次实际页的内容、起点和选择类型生成证明。 源码
  • projectPeerCoordinationDigest。既有 TypeScript 投影决定提示、去重和容量。 源码

对主干的风险 / Risks

File、SQLite 两端的零字节缓冲失败和裸捕获、显式选择单字节尾页均保留机会,下一 live Turn 仍返回相同碰撞。上一头对应六个探针均失败。完整选中摘要读两次仅留下同一条 Turn 记录,正常 Markdown 内嵌的 JSON 也保留完整提示。 仓库套件 142 项 Python 通过、1 项跳过,40 项 TypeScript 通过。另有 6 项旧问题配对探针和 4 项正控通过,2 项整根选择回归在两个后端独立复现。diff 检查通过。

语义与 CI 对齐

普通中文值位于摘要键之前,使用支持的根节点选择读取时,内层返回的片段坐标已是 UTF-8 字节数,外层却把它加到字符下标再编码。File 用例实际摘要是 [18163, 18392),输出从 18198 开始,SQLite 也漏掉前 35 字节。两端都把原碰撞 ID 和 Turn 写入游标,下一 live Turn 只收到另一条待核事项。上一头在同一非尾页保持空游标并再次给出原碰撞。

我的整体评价 / Verdict

REQUEST_CHANGES。 旧头的两条回放已经通过。另一个已复现的字节区间误判仍会让正常用户漏掉协作提示。 内层返回字符坐标后只在外层最终换算一次,或一直保留字节坐标并以包装 value 的 UTF-8 字节基址平移。 File 与 SQLite 各跑带中文值的根节点选择,验证局部页不能消费碰撞,完整页正常写入,重复完整页只保留一次回执。

English verdict: REQUEST_CHANGES at 578ea2c. The previous flush and one-byte tail cases are fixed. A partial root selection with UTF-8 text before the digest still consumes an undisplayed collision on File and SQLite.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant