Skip to content

fix(coordination): reject bound-Todo foreign claims and unqualified goal_ref on the canonical claim wire - #5248

Merged
loopx-agent merged 85 commits into
loopx-project:mainfrom
LIHUA919:codex/im-ov-room-claim
Nov 25, 2026
Merged

loopx-agent merged 85 commits into
loopx-project:mainfrom
LIHUA919:codex/im-ov-room-claim

Conversation

@LIHUA919

@LIHUA919 LIHUA919 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Related to #5198. Scope per the maintainer reviews (2026-11-20 simplify_now, confirmed 2026-11-24): the room-work channel workflow (five goal-channel work CLI entries, Lark offer/callback/recovery lifecycle, private resume composition, guarded/timed claim wires) is deferred — fully recoverable in branch history, no rebase; revival must re-derive onto main's reviewed managed-claim basis instead of re-aliasing the v3 wire. The merge commits resolve the claim-v3 collision semantically: main's v0–v3 wire semantics are kept exactly.

Current delta vs main: 5 files, +182/−0

Two disclosed hardenings of the canonical Todo claim transaction, active for every caller with the Lark room surface absent:

  1. Bound-Todo foreign claim rejection (todo_claim.ts): a Todo explicitly bound to another Agent rejects a foreign claim with bound_agent_mismatch and zero canonical/receipt/projection effects; the bound Agent claims normally.
  2. Unqualified goal_ref wire rejection (local_authority_runtime.ts entry, typed failure from the owner): an explicit goal_ref on any claim wire version is a protocol failure decided before provider IO (decision_read_from_provider=false) — with main's runtime it was previously silently dropped by the field whitelist, which could make a fresh claim or same-key replay look lifetime-bound without any instance check.

Regression coverage: tests/control_plane/test_claim_owner_guards.py (File and SQLite, the selected provider passed to the initializer with machine-readable source_authority assertions on every readback) and tests/control_plane_ts/goal_ref_claim_compatibility.test.ts (rejects before provider or historical-receipt access). The RFC checkpoint records the deferral decision and this retained surface.

Validation

Check Result
Claim-owner guards, File + SQLite 6/6 passed; SQLite cases run the real SQLite store (82s suite; bug-replay of the dropped provider fails exactly the three sqlite-labelled cases on the source assertion)
Guards red/green neutralizing both guards fails the four guard cases on both backends; restoring passes all six
Full control-plane TypeScript suite 6,792 passed / 0 failed / 91 skipped (at 7b40f5d; the new main merge touches none of the retained files)
Typecheck / Ruff / DCO pass on every commit
Main's reviewed-claim callers after the semantic merge (chat reviewed create / task-start recovery / todo detail) 146 passed — managed-claim and historical-receipt semantics intact
loopx canary premerge --from-git-diff --git-diff-base e116109c5 (current merge-base) passed — 0 failures, 0 manual holds, bilingual RFC + public-boundary included

Unverified: PostgreSQL (not available locally; File/SQLite only), installed-App journeys, independent hosts. A fresh full exact-head review and maintainer merge authority remain required.

@LIHUA919 LIHUA919 changed the title feat(goal-channel): compose canonical local room work (#5198) feat(goal-channel): compose scoped room claims and callbacks (#5198) Sep 28, 2026
@mergify

mergify Bot commented Sep 28, 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, @LIHUA919.

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 Sep 28, 2026
@LIHUA919 LIHUA919 changed the title feat(goal-channel): compose scoped room claims and callbacks (#5198) feat(goal-channel): compose scoped claims and private reconnect context (#5198) Sep 28, 2026
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Sep 28, 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 · gpt-6.2-sol · OpenAI (runtime_reported, max)

Reviewed head 60d59d6c3beabf202391095054cbe88b9985d81e

[P2] 共享运行目录里的房间恢复会互相覆盖重试游标。 两个 collector 使用同一个运行目录,各自只恢复自己配置的房间。两个范围都有原卡更新持续失败的记录。 File 和 SQLite 各让房间 A、B 交替执行三轮。限额为 1 时,A 每轮都重试同一张失败原卡,后面的有效原卡得到零次尝试。单独运行 A 的对照在第二轮读回原回执。 游标路径

动机 / Motivation

获准的房间成员在领取已提交后,需要在发起领取的同一张卡上看到 LoopX 回执。 上一轮同一个 collector 持续重试失败的前缀。当前版本让单个范围轮转,两个不同范围共用运行目录时仍会互相改变起点。 单个范围能恢复原回执。两个范围交替时,已经领取的有效回执仍可能送不到原卡。 本次交付限定在受控领取与私有恢复。Agent 工作选择中的发现、执行及向原请求返回结果由既有管家流程接续。 维护者确认的交付范围

改动思路 / Approach

Todo owner 负责接受领取。投递重试沿用 collector,游标只负责本范围的扫描顺序。 本次范围包含 Agent CLI、受限房间回调和私有续接。管家自动委派走现有入口。 可信的原领取意图经过 TypeScript Todo 事务,按 actor、source、revision 和原期限提交一次。Lark 回调把已接受的 receipt 保存在发起交互的记录。回调传输失败时,collector 校验当前权限后再尝试更新同一张卡。继续复用这一过程,只需让已生效的房间范围各自推进轮转。 原交互恢复规范

具体改动 / Changes

基点为 6a0f8bc17b439f1e5fa1d389ad5a87faf7d73b25,完整提案 32 个路径、+3468 / −33。从 8307eab7e 以来变动集中在恢复循环、回归用例和说明。其余 29 个路径核对无差异。当前主干与提案重叠在 effect handler 注册表,静态合并预演通过。 前轮评审

按 docs/architecture/rfcs/agent-im-openviking-collaboration-v0.md 的 Reconnect And Replay 与 Smallest Useful Slice 核对验收。

条目 当前证据
canonical-ownership CLI 与回调都调用现有 Todo CAS,新版本的测试仍覆盖两个本地进程竞争。
uncertain-send-retry 同意图重放读回已接受的原消息和回执。
callback-committed-receipt 提交后的投影读失败用例继续读回原卡的同一回执。
current-scope 当前绑定、用户身份和有效期在领取或私有续接时复核。
bounded-result-recovery 单范围的原反例已通过。共享运行目录中的两个范围仍会阻塞有效回执。
live-reconnect 真实飞书、两个鉴权主机与 daemon 续接留待联调。

关键代码讲解

  • executeClaimAttempt 用现有 Todo CAS 解释来源及期限,保留 managed v2 入口,沿用 v3 和 v4 的受控 wire。 领取入口
  • run_goal_channel_work 从原领取意图获得稳定的投递身份,允许在回包丢失后定位原结果。 CLI 路径
  • recover_room_claim_results 在锁内过滤失效或已送达记录。计数只在实际传输前增加,游标保存上一轮最后尝试的文件名。当前游标固定在整个运行目录下。 轮转恢复
  • run_room_resume 从现行来源与当前身份读回私有上下文,能够衔接现有 quota 和 Recall 验证。 私有续接

对主干的风险 / Risks

File 和 SQLite 各让房间 A、B 交替执行三轮。限额为 1 时,A 每轮都重试同一张失败原卡,后面的有效原卡得到零次尝试。单独运行 A 的对照在第二轮读回原回执。 两个范围的合成传输都收到了自己的失败卡尝试。实际 File/SQLite 快照表明已领取归属和 revision 在恢复期间相同。第二个范围写回共享游标后,第一个范围下轮从第二个范围的位置开始扫描,转回自己原来的前缀。配置允许不同房间范围使用同一个运行目录。 生产恢复调用

让游标随 collector 的有效投递范围隔离,保留每轮尝试上限和现有权限复核。 在 File、SQLite 上交替运行两个房间的恢复,断言 A 的有效消息收到原回执,B 保留自己的恢复进度,并核对两边的 canonical 状态和每轮上限。

语义与 CI 对齐

  • PASS — 当前完整相关套件 245 个 Python 与 11 个 TypeScript 用例通过,变更范围 Ruff 和 RFC 双语检查通过。 单范围在限额 1 与默认限额 20 下都读回后面的原卡回执,持续失败卡继续可重试。
  • FAIL — 两个真实本地 provider 的交替范围反例均复现。当前使用私有排序状态,影响现有原卡回执的恢复保证。
  • FAILED — 预合并 6 项直接检查通过,19 项所选检查通过 18 项。CLI 输出预算 smoke 在本轮超时,失败原因待定位。

我的整体评价 / Verdict

请求修改。当前提交解决了原单范围阻塞,多个 collector 实际相互覆盖游标的问题影响原卡回执的长期可见性。修复可以留在当前投递 owner 中,使用现有配置划分范围,并以交替恢复的同一反例验收。

通过合成飞书传输核对原卡内容与回执读回。 真实飞书渲染、独立鉴权主机、daemon 重连、安装版与 PostgreSQL 仍待验证。

English verdict: REQUEST_CHANGES at 60d59d6. The single-collector fix works. Collectors sharing one runtime root still overwrite each other's recovery cursor, starving eligible result cards. Isolate the cursor by delivery scope and retain the attempt cap.

Comment thread loopx/extensions/lark/room_claim.py Outdated
# failures are never terminal: their record, card and receipt evidence
# stay untouched, and only a verified delivery exits the retry queue.
# The cursor is an ordering hint; losing it only repeats this order.
cursor_path = runtime_root / "room-claim-offers" / ".recovery-cursor.json"

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.

[P2] 恢复游标需随投递范围隔离。 两个合法房间范围使用同一个运行目录时,会在同一路径保存重试位置。File 和 SQLite 各提交三次实际领取,交替恢复三轮。A 每轮只重试同一张失败卡,健康卡得到零次尝试。单独运行 A 时第二轮读回原回执。沿用现有作用域与每轮上限,为各范围保留自己的恢复位置,并补上两个范围交替的回归。

The rotation cursor lived at one fixed path under the shared runtime
directory. Configuration allows different room scopes to share that
directory: two collectors each recover only their own configured chats, but
every finished round wrote the same cursor, so each scope's next round
started from the other scope's position and rotated back into its own dead
prefix — with limit=1, scope A retried the same failing card every round
while its valid cards behind it received zero attempts (reproduced on File
and SQLite by alternating the two scopes over three rounds; scope A alone
recovered on round two).

The cursor is now keyed by the collector's effective delivery scope — Bot
app id, sender profile and the sorted allowed chat ids — using the existing
configuration division. Collectors with identical scopes keep sharing one
cursor; different scopes keep independent rotation. The per-round cap and
the in-lock eligibility rechecks are unchanged, and single-scope behavior is
identical (the cursor file name changes once; an old cursor is an ordering
hint whose loss merely repeats the prior order for one round).

Regression (File and SQLite): four committed claims across two room scopes
in one runtime directory, each scope's first-sorted card persistently
unpatchable, alternating recoveries under limit=1 — round 1 fails each
scope's own dead prefix, round 2 delivers each scope's valid receipt onto
its original message in its own room, dead records keep their evidence, the
per-round cap holds on every call, and the canonical revision never
advances. Red/green proof: reverting only the cursor path to the shared
unkeyed file makes both backends fail exactly as the reviewer's alternating
reproducer described.

Signed-off-by: Lihua <[email protected]>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Fixed on a new head d783ab158 (single DCO-signed commit on top of 60d59d6c3). The single-scope rotation fix from the previous round is untouched.

Root cause, as your alternating reproducer showed. The rotation cursor lived at one fixed path under the shared runtime directory. Two collectors with different room scopes each recover only their own configured chats, but every finished round wrote that shared cursor — so each scope's next round started from the other scope's position and rotated back into its own dead prefix. With limit=1, scope A retried the same failing card every round while its valid cards received zero attempts; scope A alone recovered on round two.

Fix — cursor keyed by the collector's effective delivery scope. The cursor filename is now derived from the existing configuration division: Bot app id + sender profile + sorted allowed chat ids (sha256, 16 hex chars, still a dotfile the rc_* glob never matches). Collectors with identical scopes keep sharing one cursor; different scopes keep independent rotation. The per-round cap and the in-lock eligibility rechecks are unchanged; single-scope behavior is identical (the cursor file name changes once — an old cursor is only an ordering hint whose loss repeats the prior order for one round). The room-work reference (EN + 中文边界) now documents the scope-keyed cursor.

Alternating dual-scope matrix (File and SQLite; four committed claims across two room scopes in one runtime directory; each scope's first-sorted card persistently unpatchable; recoveries alternate A, B, A, B under limit=1):

Round Scope A (room A) Scope B (room B)
1 attempted=1, delivered=0, failed=1 (own dead prefix) attempted=1, delivered=0, failed=1 (own dead prefix)
2 attempted=1, delivered=1 — valid receipt lands on its original message in room A attempted=1, delivered=1 — valid receipt lands on its original message in room B
after dead record keeps card+receipt, unverified; cap respected every call; canonical revision never advances same

Red/green proof: reverting only the cursor path to the shared unkeyed file makes both backends fail exactly as your reproducer described (scope A's valid card starved behind the cross-scope cursor writes); restoring the scope key turns both green. All prior regressions stay green: single-scope rotation (limit 1 and default-20/21-records), revoked-record starvation, committed-receipt retention, restart recovery — 216 related Python cases pass in total.

CLI output-budget smoke attribution. I could not reproduce the timeout. Standalone with the same base the canary injects (LOOPX_CLI_OUTPUT_BASE_REF=LOOPX_CLI_OUTPUT_MAIN_REF=<merge-base 6a0f8bc17>): passed in ~28s wall (the wrapper allows 600s; the child bounds each of its two probes at 240s). The same smoke also passed inside my round-5 premerge at the previous head (60d59d6c3, 19/19 selected checks) — the only delta between those heads is the Lark recovery rotation, which this smoke does not exercise (it diffs agent-facing CLI output sizes between base and head). My earlier bare invocation failed only because this clone has no origin remote (the smoke's default base ref), confirming it is environment-shaped. Conclusion: the observed failure looks like an environment/load-sensitive timeout of a 240s-bounded child probe rather than anything in this diff; if it recurs on your side, the child's stderr tail in the premerge output would pin which probe exceeded the bound.

Validation on d783ab158: room claim-callback/work/resume + outbound-guidance suites 216 passed / 0 failed; Ruff on the changed Python passes; after refreshing main past the steward memory-routing and quota-backlog changes the merge-base is still 6a0f8bc17, and loopx canary premerge --from-git-diff --git-diff-base 6a0f8bc17 passes with 34 changed files, 0 failures, 0 manual holds, bilingual and public-boundary checks included. TypeScript surfaces untouched. PostgreSQL, real Lark card rendering, installed App, independent authenticated hosts and daemon reconnect remain unqualified; maintainer merge authority and a fresh exact-head review are still required.

@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, max)

Reviewed head d783ab158e5e3b6c7dc3a3ace2ffefbb83f5c87c

动机 / Motivation

获准的房间成员领取工作后,需要在发起领取的原卡上看到回执,Agent 也需要按当前权限恢复私有上下文。 早先两个房间共用运行目录时,一个房间会覆盖另一个房间的重试位置。持续失败的旧卡会挡住排在后面的有效回执。 当前 collector 各自继续原来的扫描顺序,仍有效的回执能回到原卡,已确认的归属保持稳定。 本次交付受控 Agent CLI、房间领取回执和私有续接。管家自动委派仍是默认链路。 真实飞书房间渲染、多主机鉴权、daemon 重连、当前发布版和 PostgreSQL 留待集成验收。 原评审 · 维护者确认的范围

改动思路 / Approach

保留 canonical Todo 主控与现有 Lark 投递。作用域游标只给当前 collector 保存恢复顺序。 本次范围包含 Agent CLI、受限房间回调和私有续接。管家自动委派走现有入口。 现有 Todo CAS 处理领取、期望 revision 和原操作回执。显式启用的 collector 负责把回执送回原消息。游标从 Bot app、profile 与允许房间集合派生,因此两组获准的投递在共享目录内各自推进。本次沿现有投递 owner 修复等待,无须增加独立队列或调度服务。 恢复代码

具体改动 / Changes

相对 6a0f8bc17b439f1e5fa1d389ad5a87faf7d73b25 共 32 个路径,新增 3551 行、删除 33 行。上一头 60d59d6c3 到当前头只有四个路径变化,集中在作用域游标、测试传输及房间说明。完整差异覆盖 CLI、typed claim、回调、投递恢复、私有续接和验证。当前主干 8e9a28a86 与这组改动的静态合并预演成功。

依据 docs/architecture/rfcs/agent-im-openviking-collaboration-v0.md 的 Reconnect And Replay 与 Smallest Useful Slice,按 6a0f8bc17b439f1e5fa1d389ad5a87faf7d73b25 核对本次交付。 接受的 RFC

条目 当前证据
canonical-ownership 真实 CLI 与受控回调共用现有 Todo owner。同 revision 竞争只提交一次,独立读回确认归属。
uncertain-send-retry 首次已送达但回应丢失后,同意图读回同一回执与原消息。期间新增无关 Todo 的对照也通过。
callback-committed-receipt 提交后的投影读失败时,原卡继续显示已确认的回执号。
current-scope 领取和私有续接复核当前绑定、来源、调用身份与执行前提。阻塞 provider 读取跨过 offer 截止时拒绝领取。
bounded-result-recovery File 和 SQLite 的交替范围复验在第二轮把有效回执送回原卡,仍失败的记录保留重试资格。
live-reconnect 真实飞书和多宿主 daemon 续接留待集成。

关键代码讲解

  • executeClaimAttempt 复用 canonical owner 的 CAS。受控 v4 在 provider 读取后复核截止,已接受状态按原回执重放。 领取事务
  • run_goal_channel_work 按原领取意图读取或送回结果。独立的 projection 保留当前 revision 和归属。 CLI
  • handle_room_claim_callback 核对授权 principal 和原消息,再把接受回执交给现有投递;recover_room_claim_results 在当前作用域内补送原卡。 回调 · 游标
  • run_room_resume 通过当前 quota 和已有 Turn Recall 恢复私有上下文,authority 变化时拒绝沿用旧观察。 私有续接

对主干的风险 / Risks

前轮在同一运行目录交替恢复时,File 和 SQLite 都只重试失败的首张卡,A 房间有效卡在三轮中没有得到尝试。 当前以相同夹具交替运行 A、B,各范围每轮最多尝试一次。File 和 SQLite 中 A 房间的有效卡都在第二轮收到同一回执,B 继续处理自己的失败记录。完整 canonical 快照保持相同。 原顺序的单范围、默认限额 20、撤销前缀和重启补送也在相关套件复核。 交替恢复回归

共享领取 owner 保留 managed v2。v3/v4 承载守护来源和截止时间,语义沿原 claim contract 扩展。File/SQLite 的合法直接领取和同 key 重放保持原序列,本地对照确认一次写入。与 bound Agent 不符及缺少合格生命周期身份的旧请求显式拒绝。新登记 Agent 在建立自己的房间连接前仍无法从可选入口领取。 直接领取与当前身份

语义与 CI 对齐

当前提交通过 241 项相关 Python 测试、2 项独立双房间复验、14 项独立领取与回执对照及 22 项 TypeScript 测试。Ruff、RFC 双语与本地标准 premerge 通过。 前轮曾超时的 CLI 输出预算 smoke 在本次标准预合并通过。实际 File/SQLite 领取与真实持久回执通过当前 CLI 和回调路径验证。只替换飞书传输,验证更新请求的 message ID、回执正文及读回。 过期、撤销、错误绑定及来源变化保持拒绝。提交后的读失败保留原回执,未知发送响应按原操作查回原卡。

我的整体评价 / Verdict

同意此精确 head 的代码评审。沿维护者确认的范围,后端与 Agent CLI 可独立验收。正常工作选择中的自主发现、完整执行和原请求结果返回由既有 owner 接续。 长程上各投递范围能继续恢复,保留每轮上限与真实拒绝。用户在原卡上读取已接受的回执,默认管家链路保持原行为。本次验收覆盖 CLI 和现有 Lark 卡片的回执后端。对照 apps 与 examples 无改动,回执字段通过原消息 payload 和 readback 核对。 真实飞书房间渲染、多主机鉴权、daemon 重连、当前发布版和 PostgreSQL 留待集成验收。

English verdict: APPROVE at d783ab1. Scope-keyed recovery restored the original receipt in the isolated File and SQLite counterfactuals and preserved canonical state and the per-round cap. Live multi-host adoption remains unqualified.

@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, max)

Reviewed head d783ab158e5e3b6c7dc3a3ace2ffefbb83f5c87c

[P2] 原领取卡是 Card JSON 2.0,提交后的结果更新使用了 1.0。 飞书用户在受控原卡上点击领取,Todo 已接受,回调尝试更新发起领取的消息。 飞书文档对既有 2.0 卡片更新为 1.0 列出错误 200830。 在 File 与 SQLite 的实际领取上,捕获的首次 POST 与重试 PATCH 都以 1.0 payload 更新 2.0 原卡。按飞书版本约束拒绝该请求时,领取照常提交,原卡看不到回执,两种存储的恢复结果均为 attempted=1、delivered=0、failed=1。 飞书卡片回调错误码 结果卡构造

动机 / Motivation

房间成员点击领取后,需要在原卡确认工作已被接手并看到回执。Agent 重连后也要能读回同一份领取记录。 上一版本在两个房间共用一个目录时会互相覆盖恢复位置,这轮的游标修复已复验。 按房间轮转的本地反例已通过。原卡和结果卡的版本错配使飞书送达验收仍卡住。 维护者确认先交付 Agent CLI、受控回调和私有续接,保留管家默认自动委派。 交付范围 前轮游标问题

改动思路 / Approach

继续使用现有 Todo owner、领取回执和投递会话。collector 以当前 Bot、发送 profile 和房间集合划分恢复位置。 受控卡片仅在明确启用时工作。Agent CLI 可独立查验领取、回执与私有续接,归属仍由同一 Todo owner 写入。 授权有效时提交一次领取。失败后由 collector 校验同一消息的投递范围和权限,再重试原消息。结果卡的结构需要与已经发送的原卡契约兼容。

具体改动 / Changes

基点 6a0f8bc17b439f1e5fa1d389ad5a87faf7d73b25,完整提案 32 个文件、+3551 / −33。上轮到这一头四路径变化,其中一个生产文件,其他 28 路径与已评审提交的 blob 一致。与确认的主干静态合并预演通过。对照 docs/architecture/rfcs/agent-im-openviking-collaboration-v0.md 的 Reconnect And Replay 与 Smallest Useful Slice。 RFC

条目 当前证据
canonical-ownership CLI 与回调共用 Todo CAS,同一 revision 竞争只接受一次。
uncertain-send-retry CLI 发送后丢响应,期间有无关 Todo 更新仍读回原消息和同一回执。
callback-committed-receipt 结果已有原 receipt,提供给两种飞书更新接口的 1.0 JSON 与 2.0 原卡不兼容。
current-scope 提交与续接各自校验当前来源、身份和授权,超期或失效样本拒绝。
bounded-result-recovery 两房间各自轮转,合成传输的正常结果在第二轮回原消息。兼容性问题会让不可接受的结果一直失败。
live-reconnect 本轮验收到本地 CLI/回调数据,真实环境待验证。

关键代码讲解

  • build_room_claim_card 发出的原卡有 schema: "2.0" 和 body.elements。 原卡
  • handle_room_claim_callback 提交后把 build_work_card 的结果保存到 last_result_card 并用于回调更新。结果使用顶层 elements。 构造和保存 结果结构
  • recover_room_claim_results 的投递范围和扫描位置已隔离,PATCH 仍携带同一结果 JSON。 恢复及读取 交替回归
  • run_room_resume 使用当前绑定和原有 Recall/权限检查,续接返回仅供当前 Agent 读取。 续接

对主干的风险 / Risks

在 File 与 SQLite 的实际领取上,捕获的首次 POST 与重试 PATCH 都以 1.0 payload 更新 2.0 原卡。按飞书版本约束拒绝该请求时,领取照常提交,原卡看不到回执,两种存储的恢复结果均为 attempted=1、delivered=0、failed=1。 测试内仅将结果改成 2.0 结构,同一 Bot、原 message ID 与回执通过 PATCH 和读回,canonical 快照一致。 为回调的成功与拒绝结果生成与原卡兼容的 2.0 payload,将同一结构用于首次更新和已提交回执恢复。 在回调和恢复运输 fixture 中校验原卡与更新的 JSON 版本,核对同一回执回到原 message ID,并确认没有第二次领取。 飞书更新要求

两房间共享目录时,File 与 SQLite 都能在每轮各限一次的交替恢复中跨过失败前缀,第二轮读回各自原回执。错误 Bot、profile 或房间的尝试为零。这部分测试的 transport 接受任意版本,支持的是轮转和权限结论。 同提交的并行评审也验证了这些恢复条件。本轮另核对了飞书的版本约束。 同提交评审

语义与 CI 对齐

正常测试 259 个 Python、22 个 TypeScript,控制面 typecheck 和预合并 6 项直接、19 项所选检查均通过。变更范围 Ruff 与双语 RFC 检查通过。 按供方约束检查更新格式的两项独立反例失败。全局 Ruff 的 F401 和配置 mypy 的 arg-type 与当前主干逐字一致,仍是合入检查缺口。托管 CI 状态未读。 v3/v4 扩展现有 claim 的来源与期限字段,managed v2 及默认关闭下的既有直接调用覆盖已跑。 静态检查修复

我的整体评价 / Verdict

请求修改。游标隔离已经达到本地恢复的范围要求,原始消息上的结果仍会被版本约束拦住。将两种更新的结果改为兼容 2.0,再核对原回执和权属。飞书消息版本在新路径上有变化,未取得同一原卡从领取到回执的实际呈现。 飞书真实卡片渲染与同一消息读回待复验。 测试使用实际 File/SQLite 权威及合成 Lark transport,版本拒绝依据飞书文档。已安装 App、真实飞书房间送达与渲染、多主机、daemon 续接和 PostgreSQL 尚待验收。 Agent 自主发现、受控执行及结果返回原请求由管家与工作选择链路接续验收。

English verdict: REQUEST_CHANGES at d783ab1. The scoped rotation fix passes. A successful room claim sends a 1.0 replacement to a 2.0 card on both callback update and recovery. An independent File/SQLite reproduction enforces Feishu's documented version constraint and leaves the original card without its receipt. Keep the update compatible with the original 2.0 schema.

Comment thread loopx/extensions/lark/room_claim.py Outdated
# the durable offer. The native owner checks after its reads.
raise RoomClaimCallbackError("offer_expired")
committed_receipt = claimed.get("receipt") if isinstance(claimed.get("receipt"), Mapping) else None
card = build_work_card(claimed) if (

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.

[P2] 原领取卡是 Card JSON 2.0,提交后的结果更新使用了 1.0。 在 File 与 SQLite 的实际领取上,捕获的首次 POST 与重试 PATCH 都以 1.0 payload 更新 2.0 原卡。按飞书版本约束拒绝该请求时,领取照常提交,原卡看不到回执,两种存储的恢复结果均为 attempted=1、delivered=0、failed=1。 飞书文档对既有 2.0 卡片更新为 1.0 列出错误 200830。 为回调的成功与拒绝结果生成与原卡兼容的 2.0 payload,将同一结构用于首次更新和已提交回执恢复。 测试内仅将结果改成 2.0 结构,同一 Bot、原 message ID 与回执通过 PATCH 和读回,canonical 快照一致。 飞书错误码 原卡

The scoped offer card is a Card 2.0 payload (schema 2.0 with body.elements),
but the committed-receipt result card still used the 1.0 form (top-level
elements). Lark rejects updating an existing card with a payload of a
different schema (error 200830), so on a real room the confirmation and every
recovery patch were refused: the claim committed, the original card never
showed the receipt, and recovery logged attempted=1, delivered=0, failed=1 on
both File and SQLite (the reviewer's counterexample; only the structure was
at fault — switching the result payload to 2.0 made patch and readback pass).

One shared Card 2.0 builder now serves every room-facing card: the
committed confirmation, the honest unconfirmed hint (both callback result
branches), the first in-place update and the recovery patch — the same
structure the original offer card carries, so an update always matches its
original card. Unified decision on the CLI side: run_goal_channel_work's
new-message delivery POSTs the same 2.0 confirmation — new interactive
messages accept the current 2.0 schema (the offer card already sends 2.0
through that transport), and one card builder for every room write avoids a
second structure for the same receipt.

The test transport now enforces Lark's version constraint: an update or
patch whose schema differs from the target message's existing card is
rejected with error 200830, and every accepted update payload is recorded.
With the gate installed, the previous code fails 20 callback-suite cases
exactly as the counterexample described; after the fix all pass. A new
regression (File and SQLite) asserts the schema match (2.0 with
body.elements) on the original offer card and on the recovery-patched
payload, the same receipt landing on the original message id exactly once,
and no second canonical claim.

Signed-off-by: Lihua <[email protected]>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Fixed on a new head 59f2ca99c (single DCO-signed commit on top of d783ab158). The cursor isolation from the previous round is untouched.

Root cause, exactly your counterexample. The scoped offer card is a Card 2.0 payload (schema: "2.0" + body.elements), but the committed-receipt result card still used the 1.0 form (top-level elements). Lark rejects updating an existing card with a payload of a different schema (error 200830), so on a real room the confirmation and every recovery patch were refused: the claim committed, the original card never showed the receipt, and recovery logged attempted=1, delivered=0, failed=1 on both backends — only the structure was at fault.

Fix — one shared Card 2.0 builder for every room-facing card. A single _room_card constructor (schema: "2.0", config.update_multi, header, body.elements markdown) now serves:

  • the committed confirmation card (immutable acceptance facts, unchanged content semantics),
  • the honest unconfirmed hint (the callback's other result branch — prescription 1's rejection path),
  • the first in-place update and the recovery patch — the same structure, stored once in last_result_card, so an update always matches its original card.

Unified decision on the CLI side (prescription 2). run_goal_channel_work's new-message delivery POSTs the same 2.0 confirmation. Rationale: new interactive messages accept the current 2.0 schema — the repo's own offer card already sends 2.0 through that same transport — and keeping one card builder for every room write avoids a second structure for the same receipt. No other build_work_card consumer exists (verified: the callback path and the CLI delivery are the only callers).

Version validation in the transport (prescription 3). The test fixture now enforces Lark's constraint at both write sites — card/update and messages patch reject any payload whose schema differs from the target message's existing card (returning error 200830), and every accepted update payload is recorded. With the gate installed and before the fix, 20 callback-suite cases fail exactly as your counterexample described (update/refusal cascading through every recovery regression); after the fix all pass.

New regression (test_result_updates_match_the_original_card_schema, File and SQLite): original offer card and every update/patch payload carry schema == "2.0" with body.elements; the first update loses its transport response, the claim commits, and recovery delivers the same receipt onto the original message id exactly once; a second recovery is idle; the canonical revision advances only for the one claim.

Backend Version gate on update/patch Result card Outcome
File enforced 1.0 (before fix) callback suite fails the gate (20 cases incl. recovery regressions) — mirrors 200830
SQLite enforced 1.0 (before fix) same
File enforced 2.0 (after fix) 64/64 callback cases pass; receipt on original message; single claim
SQLite enforced 2.0 (after fix) same

The room-work reference (EN body + 中文边界) now states the card contract: all room-facing cards are Card 2.0, the first update and the committed-receipt recovery share one structure matching the original card, and the CLI's new-message delivery uses the same confirmation.

Validation on 59f2ca99c: room claim-callback/work/resume + outbound-guidance suites 218 passed / 0 failed with the version gate active; Ruff on the changed Python passes; merge-base re-confirmed as 6a0f8bc17 after refreshing main; loopx canary premerge --from-git-diff --git-diff-base 6a0f8bc17 passes with 34 changed files, 0 failures, 0 manual holds, bilingual and public-boundary checks included. The global Ruff F401 / mypy arg-type findings you saw remain verbatim from main-side #9082 and are untouched here. TypeScript surfaces untouched. PostgreSQL, real Lark card rendering, installed App, independent authenticated hosts and daemon reconnect remain unqualified; maintainer merge authority and a fresh exact-head review are still required.

@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, max)

Reviewed head 59f2ca99cb204968676d4974a58154227bef5609

[P2] 领取回执把合法 Agent 标识渲染成另一个字符串。 登记的 Agent 标识含有合法下划线,例如 agent-ops,领取已提交并生成房间回执。 真实 File 和 SQLite 均把任务交给 agent-ops,但以飞书声明支持的 CommonMark 规则渲染 2.0 回执时,显示为 agent-ops。 上一提交的纯文本结果保留 agent-ops。同一份 2.0 payload 只对标识应用现有转义时,渲染也保留原串。 原消息无法据此准确核对接手者。在共享结果卡构造处保留动态标识的字面义,复用现有 _card_text 转义,并保留 Card JSON 2.0。 结果卡 飞书富文本契约

动机 / Motivation

使用受控领取的房间成员需要在原消息确认接手者和回执号。 上一提交以 1.0 格式更新 2.0 原卡,领取提交后原卡仍无法显示回执。 当前提交在 File 和 SQLite 上都能把 2.0 回执送回原消息,首次回调和失败后恢复均成立。 这次提供 Agent CLI、受控卡片回调和私有续接,默认的管家自动委派沿用原有入口。 真实飞书渲染、独立鉴权主机与 daemon 续接,以及 Agent 常规发现任务和结果回到原请求,仍待各自验收。 维护者确认的交付范围

改动思路 / Approach

卡片 schema 和文字解释由 Lark adapter 负责。canonical 归属、当前范围和私有续接由已有的 Todo、授权和 Recall 入口负责。 本次结果卡调整覆盖原消息和 CLI 新消息,回执仍绑定实际接受的领取。 领取与续接继续经过当前身份、期限及来源校验。房间投递在提交后生成确认,收到响应时核对原消息。响应丢失时,collector 在当前 Bot、发送 profile 和房间范围重试同一份回执。 投递入口 恢复

具体改动 / Changes

完整提案 32 个文件,+3630 / −33,基点 6a0f8bc17b439f1e5fa1d389ad5a87faf7d73b25。本轮变更四个路径,其他 28 处的 blob 和模式均与上次评审一致。已核对同一比较基点、变动的 provider 调用与文档,再对当前的主干 8e9a28a866da06cc6fd63e78709910fe35dad564 做静态合并预演。普通领取在相同 Todo CAS 上运行,投递失败仍可读回原接受事实。 上一轮评审 新提交

依据 docs/architecture/rfcs/agent-im-openviking-collaboration-v0.md 在 6a0f8bc17b439f1e5fa1d389ad5a87faf7d73b25 的 Reconnect And Replay 与 Smallest Useful Slice。

验收项 当前提交证据
canonical-ownership 两个独立 CLI 进程共用同一 CAS,同 revision 仅一项取得权属。
uncertain-send-retry CLI 丢响应后复用同一接受、投递键和回执。
callback-committed-receipt 两种后端的 POST 和 PATCH 均通过 2.0 更新约束,并读回原消息。
current-scope 原身份、Bot、房间、来源和有效期在执行或恢复前复核。
bounded-result-recovery 同一 2.0 记录恢复后不再尝试,领取状态保持一致。
live-reconnect 当前验证限本地后端和合成消息传输,真实环境待验。

RFC 验收

关键代码讲解

  • build_work_card 为原接受事实或实时预览构造卡片,收据中仍独立使用不可变 ID。新模板把动态标识插入 Markdown。 构造
  • handle_room_claim_callback 通过现有权威提交一次,保存同一 2.0 结果 JSON,首次更新使用原消息和当前 callback token。 回调
  • recover_room_claim_results 在投递范围内找待更新的原消息,复用已保存 payload。 恢复
  • run_room_resume 通过当前 scope 读取私有上下文,并持续沿用既有 Quota 和 Recall。 续接

对主干的风险 / Risks

原反例的两个后端各含首次更新和恢复两个场景。父提交四例的 1.0 更新均被模型化的版本约束拒绝。当前四例均以 2.0 读回同一消息和回执,恢复不推进 canonical 状态且后续尝试为零。 这解决了上轮报告的卡片版本错配。合成传输从原消息读回的 JSON 相同,因此状态为 verified。复验时应在两个后端核对 JSON 和渲染后的标识。 上轮版本问题 既有转义

飞书支持 2.0 新消息。7.20 前的客户端会显示升级提示,这个渲染边界也适用于新 CLI 房间卡片。房间的默认关闭、直接领取和旧 managed v2 的测试保持原范围。 飞书 2.0 说明 发送接口

语义与 CI 对齐

三组房间测试 162 例、Recall 与 outbound guidance 81 例通过。预合并 6 项直接检查、19 项所选检查均通过。 22 个 TypeScript 用例及控制面 typecheck 通过。 变更范围 Ruff 与 Git 差分通过。 首次批量 Python 校验因磁盘空间不足退出,分批重跑后完成。两个独立显示用例仍为 FAIL。全局 Ruff 和配置 mypy 复用了上轮与同一主干一致的失败证据,本提交的诊断源文件 blob 一致。它们仍是合入检查缺口。CI 策略为本地验证。既有 v3/v4 增量表达来源与截止时间。这次 2.0 格式由 Lark provider 消费,沿用原有 wire 和权限逻辑。 同主干静态修复

我的整体评价 / Verdict

请求修改。领取提交和原卡回执恢复已达到本地验收。可见 Agent 标识要与实际接手者一致,才能靠同一张卡确认领取。通过标准 Markdown 解析实际发送的 payload,核对可见标识与 canonical 归属。 真实飞书客户端和已安装 App 的显示效果仍待验证。 保留 2.0 结构,在结果构造器保留标识字面义。独立主机、daemon 续接与 PostgreSQL 仍待验证。

English verdict: REQUEST_CHANGES at 59f2ca9. Both stores pass Card JSON 2.0 callback and recovery, with the same receipt on the original message. The new Markdown result renders a valid registered Agent ID differently from the committed owner. Escape dynamic identifiers while preserving the 2.0 schema, then rerun the literal-ID and recovery checks.

and the recovery patch, so an update always matches its original card."""
return {"schema": "2.0", "config": {"update_multi": True},
"header": {"title": {"tag": "plain_text", "content": title}},
"body": {"elements": [{"tag": "markdown", "content": body}]}}

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.

[P2] 领取回执把合法 Agent 标识渲染成另一个字符串。 登记的 Agent 标识含有合法下划线,例如 agent-ops,领取已提交并生成房间回执。 在两种本地后端,任务均交给 agent-_ops_。按飞书支持的 CommonMark 渲染规则,当前回执显示为 agent-ops,上一提交的纯文本保留原标识。使用既有 _card_text 的转义对照保留同一原串。保留 2.0 结构,并在两种后端同时核对原卡回执和渲染标识。 飞书 2.0 富文本说明

Card 2.0 markdown elements parse CommonMark, so the raw interpolation of a
legal Agent id such as agent-_ops_ rendered as agent-ops: the underscores
were consumed as emphasis markers and the readable card could no longer name
the claiming agent (the pre-2.0 plain-text card and the escaped offer card
both preserved the literal string).

Every dynamic identifier interpolated into the shared result card's Markdown
body — Goal id, Agent id, Todo id, receipt id and source revision, in both
the committed-confirmation and the orientation branch — is now escaped with
the existing _card_text rules (numeric character references), reusing the
same owner the offer card already uses. The Card JSON stays 2.0; only the
interpolated values change form. The unconfirmed hint carries fixed prose
and needs no escaping.

Regression (File and SQLite): a registered agent-_ops_ claims through the
scoped callback; both the recovery patch (after a lost first update) and the
direct first update are checked at the rendering layer, not just payload
equality — a minimal CommonMark oracle consumes raw emphasis runs and then
decodes character references, and the rendered text must contain the exact
original identifier (and receipt id) on the original message. Neutralizing
only the escaping fails both backends exactly as the reviewer described;
restoring it passes. Legal identifier charsets admit '_' but not '*', so the
star case is covered by an escape-to-render roundtrip assertion on the
shared rules. The 2.0 version gate and all prior regressions stay green.

Signed-off-by: Lihua <[email protected]>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Fixed on a new head e8e674252 (single DCO-signed commit on top of 59f2ca99c). The Card 2.0 unification from the previous round is untouched.

Root cause, exactly your rendering counterexample. Card 2.0 markdown elements parse CommonMark, so the raw interpolation of a legal Agent id such as agent-_ops_ rendered as agent-ops — the underscores were consumed as emphasis markers and the readable card could no longer name the claiming agent (the pre-2.0 plain-text card and the escaped offer card both preserved the literal string).

Fix — reuse the existing _card_text escaping at the shared result-card constructor. Every dynamic identifier interpolated into the Markdown body now goes through _card_text (numeric character references), the same owner the offer card already uses. Applied fields, per your prescription to check beyond the Agent id:

  • committed-confirmation branch: Goal id, Agent id, Todo id, receipt id;
  • orientation branch: Goal id, Agent id, selected Todo id, source revision (counts are integers; the freshness-alert prefix and static labels are fixed prose).

The Card JSON stays 2.0 — only the interpolated values change form. The unconfirmed hint carries fixed prose and needs no escaping. One card-text escaping seam, both callback result branches and the CLI orientation/confirmation, matching the shared-builder decision from the last round.

Rendering-level assertions, not payload equality. The new regression uses a minimal CommonMark oracle: consume emphasis runs on raw delimiter characters only, then decode numeric character references (which CommonMark treats as literal characters, never delimiters). For a registered agent-_ops_ claiming through the scoped callback, both the recovery patch (first update loses its transport) and the direct first update must render the exact original identifier — and the receipt id — on the original message. The offer card (already escaped) is checked the same way.

Backend Scenario Escaping Rendered identifier
File recovery patch after lost first update neutralized (red proof) agent-ops — test fails as your counterexample
SQLite recovery patch after lost first update neutralized same failure
File recovery patch + first update + offer card applied agent-_ops_ literal, receipt id literal, on the original message
SQLite same applied same

On the * metacharacter: legal identifier charsets (normalizeTodoAgent: [a-z][a-z0-9_.:@-], todo/Goal ids similar) admit _ but not *, so a star cannot occur in a real identifier; the test still covers the shared rules with an escape→render roundtrip assertion (&#42; → literal *). One adjacent main-side observation, disclosed not fixed (single-purpose rule): _card_text's sequential character replacement corrupts its own entities for inputs containing * ~ [ ] ( ) (e.g. * → &&#35;42;) — unreachable through any legal room-work identifier, but other callers of that main-owned helper may want its owning task to switch it to single-pass escaping.

The 2.0 version gate from the last round stays active in the transport, and all prior regressions remain green (identifier, schema-match, dual-scope rotation, dead-prefix rotation, revoked starvation, committed receipt, restart recovery). The room-work reference (EN + 中文边界) now documents the literal-identifier rule.

Validation on e8e674252: room claim-callback/work/resume + outbound-guidance suites 220 passed / 0 failed; Ruff on the changed Python passes; merge-base re-confirmed as 6a0f8bc17 after refreshing main; loopx canary premerge --from-git-diff --git-diff-base 6a0f8bc17 passes with 33 changed files, 0 failures, 0 manual holds, bilingual and public-boundary checks included. TypeScript surfaces untouched. PostgreSQL, real Lark card rendering, installed App, independent authenticated hosts and daemon reconnect remain unqualified; maintainer merge authority and a fresh exact-head review are still required.

loopx-agent
loopx-agent previously approved these changes Nov 20, 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 · gpt-6.2-sol · OpenAI (runtime_reported, max)

Reviewed head e8e674252a776084985b1149d9f779faed1e654e

动机 / Motivation

使用受控领取的房间成员需要在发起领取的原消息核对实际归属和回执。 上一评审头的合法 agent-_ops_ 在 Card 2.0 正文变成了 agent-ops。这次在实际发送的 Markdown 中保留了字面值。 只读预览、CLI 新卡和原卡回调均显示登记标识,丢响应恢复读回同一已接受回执。 本次覆盖 Agent CLI、受控回调和私有续接,Steward 自动委派沿用既有入口。 真实飞书客户端、独立鉴权跨主机续接及常规 Agent 发现和回传仍待验收。 维护者确认的范围 上一轮评审

改动思路 / Approach

build_work_card 复用 offer 卡的 _card_text,将 Goal、Agent、Todo、receipt 和 source revision 按字面交给 Markdown 渲染。回调从 canonical 领取的已接受事实构造结果,把同一 Card 2.0 正文写回原消息。恢复复用原回执和投递范围。结果卡和只读预览共享现有 provider 2.0 结构和字面转义。 卡片构造 既有转义 原消息更新 恢复

具体改动 / Changes

基点 6a0f8bc17b439f1e5fa1d389ad5a87faf7d73b25。32 个文件 +3722/-33。GitHub 文件列表与同基点的全量差分一致。本轮改动限 3 个路径 +101/-9,其他 29 处的 blob 与模式相同。当前 main 静态合并预演无冲突。 当前 main 8e9a28a866da06cc6fd63e78709910fe35dad564 的静态预演核对了合并树。 本轮差分 RFC 验收

验收项 当前提交证据
canonical-ownership 两个 source CLI 进程对同 revision 竞争,File 和 SQLite 均只接受一次。
uncertain-send-retry CLI 丢响应后按原领取和原投递键读回同一回执。
callback-committed-receipt POST 和恢复 PATCH 匹配原 Card 2.0,原 Agent、Todo 和 receipt 字面值可见。
current-scope 领取或续接前复核当前 Agent、期限、来源及房间。
bounded-result-recovery 已接受的同一结果回到原消息,恢复期间的 canonical 快照相同,读回后无需再投递。
live-reconnect 此项在接受范围中后置,仍需真实飞书与独立鉴权主机验收。

handle_room_claim_callback 复用既有 Todo CAS 并保存发送正文。 recover_room_claim_results 从原记录重试投递。 run_room_resume 在有效 scope 中沿用 Quota 和 Turn Recall。 回调 恢复 续接

对主干的风险 / Risks

真实 File 和 SQLite 领取后,独立 CommonMark 解析器从 CLI 新卡、首次回调、丢响应恢复的原卡及只读预览读到原样标识。回调和恢复使用相同的 2.0 正文、原消息和原回执,恢复前后 canonical 快照一致。 错误范围或过期的领取请求被拒绝,File 与 SQLite 的原 Todo 状态保持一致。未启用 collector 时,原直接 Todo CLI 与默认 Steward 路由沿既有规则可用。 回归用例

语义与 CI 对齐

当前提案在真实 File/SQLite 与合成 Lark transport 上通过 255 个选定 Python 用例(含独立渲染对照)、22 个 TS 用例及控制面 typecheck;quick 预合并 6 个直接门、4 个选定检查通过;变更范围 Ruff 和 RFC 成对差分通过。 首轮批测遇到本机 ENOSPC,清理本轮测试目录后通过完整选定范围。与同一主干的历史全局静态检查缺口继续由 #9082 跟踪。本轮按本地证据评审。 静态检查修复 飞书 Card 2.0 契约

我的整体评价 / Verdict

批准此提交。上一处显示回归已解决,独立测试同时验证了原卡恢复及可见归属。在本地 CommonMark 渲染页目视核对了长 Agent ID 的只读预览和原消息恢复回执。下划线保留,Goal、归属、Todo 和回执号均可见。 实际飞书客户端排版、已安装 App、跨主机 daemon 续接和 PostgreSQL 未验证。 这次交付覆盖约定的受控领取和回复,常规 Agent 自动发现及结果回传另行验收。

English verdict: APPROVE at e8e6742. Real local File and SQLite checks preserve literal identifiers in the scoped Card 2.0 paths and recover the same accepted receipt on the original message without another work transition. The render check covered the actual payload in a local CommonMark browser view. Live Feishu clients and cross-host qualification remain unverified.

@mergify

mergify Bot commented Nov 20, 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, @LIHUA919.

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

Reviewer: model_agent · GPT-6 · OpenAI · self_reported

REQUEST_CHANGES · e8e674252a776084985b1149d9f779faed1e654e — 请先收缩新增 CLI 和渠道领取流程,再证明必要增量。

这是维护者本轮明确要求的范围与设计调整。10 月 18 日的评审 允许最小后端/CLI 组合;本次进一步审视这组公共入口是否必要,不声称旧 RFC 禁止新增 CLI,也不重新提出此前已修复的卡片问题。

动机 / Motivation

受影响的是把工作交给管家的用户,以及在日常工作回合中承接任务的 Agent。

当前管家已经能够委派、启动受控执行、接收接收方结论并回复原对话;对于无人领取的任务,也已有候选选择和普通领取机制。5248 增加渠道展示、领取回执和私有上下文续接,但没有在通用入口补齐从发现候选到主动承接的行为。

希望得到的可观察增量是:合适的 Agent 沿既有入口承接授权范围内的任务,继续执行并返回结果;确有房间交互需要时,只增加必要的渠道适配。

本轮不要求完成整个多 Agent 路线图、真实多主机或 OpenViking 集成,也不要求重新增加前端。

这里需要纠正基线:已有能力不等于所有默认入口的发现、唤醒和选择都已充分验收,但也不能把尚未完整验收写成“缺少委派/回收能力”。当前还没有对照证据证明普通 Agent 会因缺少这五个新命令而无法承接任务,因此应先定位真实缺口,避免让新配置、命令和恢复生命周期成为通用协作的使用成本。

改动思路 / Approach

共享底层 Todo authority 是正确方向,但不能单独证明五个新的公共命令及其渠道生命周期都有必要。

本 PR 应收缩到有明确调用需求的最小渠道适配;通用领取和续接复用现有 owner,无已证明需求的 offer/revoke 生命周期暂缓。

当前实现确实没有第二套 Todo 数据库:CLI 仍把领取交给 canonical owner,TypeScript 保留原子比较、归属和回执,Python 负责渠道和 provider IO。问题在公共工作流的增量:work claim 执行前要求 exact enabled Agent channel 并验证投递;work resume 在原 Recall 外增加房间、quota 和状态复核。这些约束对受控房间操作可以合理,却不能成为普通 unclaimed task 承接的必要前提。不要机械拆成几条 shell 命令而丢失事务约束;应在同一个 typed owner 上合并入口,明确哪些是领取的必要条件,哪些只属于渠道操作。

已有能力 当前 PR 的实际增量 修改方向
管家 handoff、Delegations.start、接收方 adoption、manager-inbox report 和原对话返回 此链路没有由 5248 新建 明确保留默认路线
quota 候选、Agent 显式选择、todo claim、执行前准备 房间筛选投影、带渠道校验的领取及回执发布 先复用既有选择/领取 owner,逐项证明新增入口
scoped Turn Recall quota/房间状态复核与私有上下文返回 明确它是 context refresh,不是执行或会话重启
已有 Goal Channel 投递和 callback 基础设施 限定 principal 的 offer、撤销、过期、私有记录与恢复游标 有具体外部领取需求才保留完整生命周期

对通用主动领取的改进,应由现有 selection、wake、claim、execution preparation 和 result-return owner 承担。当前 action_portfolio 的 explicit choice 是 Agent 的选择,不是新增用户审批;不应为了“自动”取消这一承诺边界,也不应加入第二套 scheduler 或高频轮询。

具体改动 / Changes

相对 merge-base 6a0f8bc17b439f1e5fa1d389ad5a87faf7d73b25,完整差异为 32 个文件、+3722/-33。这个数字描述维护表面,不是行数否决线。生产改动包括五个 CLI 入口、TS 房间投影/claim request/resume 校验、canonical source/deadline/归属约束、Lark callback 和恢复、Recall 与 heartbeat identity 兼容;其余包含测试、参考文档、RFC checkpoint 和 TS 构建入口。新增 UI 已从当前提案撤回,不再要求重复删除。

关键代码讲解

  1. CLI 注册 一次暴露 project|claim|offer|revoke|resume。请逐一给出真实调用者、既有入口无法满足的差异和最小保留边界;命令能运行和有测试不等于这组产品表面必要。
  2. run_goal_channel_work 先校验身份/渠道和投递,再调用既有 claim_canonical_todo_if_promoted;领取与投递失败分别保留事实,同一 key 恢复原回执。保留这些不变量,但不要把渠道前置条件推广到普通 Agent 工作。
  3. 房间投影 复用领取判定筛选候选,selected_todo 取 available[0]。这是房间只读摘要,不能证明已完成通用优先级选择、唤醒或自主承接。
  4. run_room_resume 在 retrieval 前后复核 scope、projection、quota,最终调用已有 Turn Recall;不启动执行、不领取 lease、不返回私有上下文到房间。请证明为何需要独立公共 resume,或收敛到原 Recall 的渠道适配。
  5. offer/callback/recovery 增加私有 offer 记录、principal 授权、撤销/过期和结果重试。它表达不能从 Todo 推导的外部授权意图,不能用派生投影替代;但如果本轮没有这类真实调用需求,应整体暂缓,而非留下孤立记录或删掉安全校验。

依据是上述维护者范围评审(spec_revision=5563545930)以及变更前 Agent IM / LoopX / OpenViking RFC。下列是对既有要求的对应标签,不冒充 RFC 原有编号:default-delegation 已保留;no-new-frontend 已落实;reuse-existing-owners 底层有复用,但公共入口必要性仍待本轮收缩;autonomous-adoption 仍是既有工作选择 owner 的验收缺口;live-multi-host 不在本轮要求内。本次“重新论证并收缩五个入口”是维护者当前方向,不从 PR 新写的文档反推旧验收。

对主干的风险 / Risks

[P1] 新公共领取工作流的范围与当前需要解决的问题不成比例。 定位:loopx/cli_commands/goal_channel.py:234–258。触发场景是 Agent 要在正常回合承接一个未领取任务:已有通用候选/选择/claim 路径,而当前新增入口把房间连接、provider 验证、回执展示和可选外部授权组织成另一组操作,未建立普通回合发现与承接的新增行为。即使全部专用测试通过,也不能证明这组入口能改善该场景;长期需维护命令、版本、回执及失败恢复,而用户关心的默认承接路径仍可能没有改善。

最低修改:先用当前 main 列明基线和真实缺口;合并或移除重复的 work project|claim|resume,仅对有明确渠道语义差异的部分保留薄适配;offer/revoke 只有在明确限定 principal 的领取交互确有需求时保留,否则连同专用记录/恢复整体后置。保留的路径应展示实际调用与独立验收,避免仅用手工 CLI 或 fixture 证明需求。通用主动承接若需后续补齐,明确现有 owner 和可观察验收,不把整个路线图压进本 PR。

回归验证应覆盖:正常 Agent 入口在既有授权内发现/选择/独占领取并沿原链路执行返回;无 Lark 时普通领取仍可用;多个 Agent 竞争、错误或撤销身份、bound Agent、陈旧 revision、期限在 IO 中失效、lease/quota/gate 拒绝、丢响应后同 key 恢复,均保留原约束。渠道产物继续只含公开安全摘要;不能为减量删掉 source witness、事务期限、权限、幂等和私有上下文隔离,也不能把现有人工确认型 operation card 强套到普通领取上。

语义与 CI 对齐

当前 main f80e6c4412783a9d5c157e0769cebc872eef5bf7 的 reviewed managed claim v3,与本 PR guarded claim v3 使用同一个 wire schema 字符串,却承载不同请求语义。静态合并预演在 local_authority.py、local_authority_runtime.ts 和 heartbeat_receipt_identity.ts 冲突。请在收缩范围后统一协议 owner/版本,保留已有 managed claim 和历史回执语义,重新验证所有受影响 caller;这属于当前集成问题,不是已部署回归,也不是本条范围 finding 的替代。

本轮 PASS:exact-head 文档/关键源码和既有 owner 对照、完整差异清单、静态合并预演(确认冲突)。本轮 UNVERIFIED:运行时正负例、feature-off 全表面行为对照、File/SQLite/PostgreSQL 实跑及真实飞书渲染;未重跑测试。同 head 的此前批准 中的测试属于原评审证据,不计作本轮执行。远端 CI 同时有通过、失败及跳过,本轮未做失败因果归因,也不以红 CI 作为本条设计要求的依据。修订后至少重跑相关 Python/TS 用例、真实受影响存储路径和 uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main,保留失败与未验证的区别。

我的整体评价 / Verdict

请求修改。底层复用和安全修复有价值,但无法代替对整组新 CLI/生命周期必要性的证明。当前结论是 simplify_now:先交付有真实调用者、可独立验证的最小适配,再讨论可选范围。长期效果与效率目前 not_yet_proven;通用主动承接、命令/模型成本和人工介入是否改善,都需要沿实际入口验证。现有默认管家委派应继续保留,不能把领取回执或 recalled context 等同于执行完成和结果回收。

本轮只审阅卡片构造源码,未重新检查实际渲染。未验证范围包括真实飞书客户端、默认/恢复卡片的长内容布局,以及已安装产品旅程。这些是本轮技术资格的边界,不把此前已修复的卡片错误重新列为当前缺陷。

协议层既复用现有 authority,也扩展了 claim wire 和本地渠道记录;当前主干出现的同名 v3 必须按语义解决,不能仅靠文本合并或为减行数删除历史恢复支持。本次发布的是维护者明确授权的范围调整及静态证据,不是新一轮全量运行时资格结论。完成收缩和集成后,应以新的完整 exact head 重新评审。

English verdict: REQUEST_CHANGES at e8e6742. Narrow and justify the five new CLI entrypoints against the existing delegation, claim, execution and recall owners; retain only evidenced channel-specific workflows and preserve authority, privacy and recovery invariants. Resolve the current-main claim-v3 collision. This is maintainer-directed scope feedback supported by source analysis, not a fresh runtime qualification; tests were not rerun.

@LIHUA919

Copy link
Copy Markdown
Contributor Author

Baseline/gap analysis for the maintainer-requested scope revision (review of 2026-11-20T07:12:49Z), prepared against current main ddc2f687d (fetched fresh; the earlier reviewed f80e6c441 is an ancestor). This comment states the disposition before I push the shrunk implementation, so the取舍 can be corrected. A follow-up comment will carry the implementation result and validation matrix.

Baseline on current main (verified by reading main, not assumed)

  • todo claim (CLI loopx/cli_commands/todo.py → mutation_api.claim_only): witnessed v1 / managed v2 claims, --claim-operation-id idempotency + receipt replay, lease TTL, execution preparation, dry-run; managed execution is auto-selected for a self-claim without explicit lease proof. Real callers: the CLI, todo_recovery.py receipt-bound recovery, and chat _start_confirmed_task — the only caller of the reviewed managed claim v3 (a2a1ea4f8), which binds expected_provider_revision + expected_registry_sha256 + a routing registry witness.
  • Candidate selection/execution: action_portfolio (quota decision) + turn_selection + execution_preparation — the Agent's explicit choice boundary.
  • Recall: agent-turn-recall CLI/capability owner (session refs, refresh).
  • Goal Channel (accepted RFC goal-channel-collaboration-v0): setup/configure/doctor/sync/notify-gate, Lark Kanban sync, human-gate operation cards; no in-room task-claim interaction exists or is requested there.
  • Canonical claim owner hardening on main: excluded_agents, foreign-owner transfer grants, handoff modes — but no bound_agent guard on claims and no rejection of an explicit goal_ref on the claim wire (both were added by this PR as disclosed shared-contract tightenings and validated as intentional in earlier review rounds).

Entry-by-entry disposition

PR entry Real caller today Difference the existing owner cannot satisfy Disposition Rationale
work project none (its only consumer, the manual claim UI, was withdrawn on 10-18) room-scoped read-only projection with claim-eligibility filtering + freshness envelope 后置 (remove) Claim-eligibility selection duplicates the selection owners; room projection of todos is already served by goal-channel sync/Kanban; no caller remains.
work claim none beyond fixtures/CLI probes channel-conditioned claim + in-room receipt card 后置 (remove) todo claim already owns claiming, idempotency and receipts without requiring an enabled Lark channel; the in-room receipt display only matters together with the deferred offer/callback interaction. The two genuinely owner-level gaps it surfaced are retained (below).
work resume none beyond fixtures quota/binding rechecks around Turn Recall, no-ingest refresh 后置 (remove) Per the review: it is a context refresh, not execution/session restart; the existing agent-turn-recall owner plus a channel adapter (deferred with the room work) covers it; no independent public-entry need is evidenced.
work offer / work revoke (+ room_claim.py callback, result recovery, rotation cursors, guarded v3 / timed v4 claim wires, admit_before machinery, multi-source registry guards, resume heartbeat helper) none — no principal-limited in-room claim interaction is requested this round external authorization intent that cannot be derived from Todo state 整体后置 (defer the whole lifecycle) Exactly the review's branch: without an evidenced principal-limited interaction, the private offer records/recovery stay out; they remain fully recoverable in branch history (no rebase/force-push). None of their safety checks are deleted from the shared owner — they move with the deferred surface.
Canonical claim owner hardening: bound_agent_mismatch + goal_ref_claim_contract_unqualified every claim caller (CLI, recovery, chat task start) main accepts a claim on a Todo bound to another agent, and silently ignores an explicit goal_ref 保留 (keep) Small, disclosed, owner-level guards with no channel precondition; earlier rounds validated them as intentional tightenings ("也适用于未启用房间的 caller"). They are the entire retained production surface.

Recommendation on the borderline item (offer/revoke): defer. I found no current-main caller or accepted-contract slot for principal-limited in-room claiming, so per the review's own rule the whole lifecycle (records, callback, recovery, wires) is deferred rather than left as an orphaned record store. If a concrete in-room claim interaction is scheduled, reviving is a checkout of the branch-history commits plus re-derivation onto main's reviewed-claim basis — noted below.

claim-v3 collision — semantic resolution (not a text merge)

Main's todo_claim_request_v3 is the reviewed managed claim (single chat task-start caller; binds caller revision + registry digest + routing witness; earlier wires deliberately do not bind caller-supplied revisions). This PR's guarded v3 / timed v4 wires expressed room-facade-only semantics (multi registry witnesses, offer deadline). Resolution: the shared owner keeps main's v0–v3 exactly; the PR's v3-guarded/v4-timed wires, the admit_before deadline machinery and the multi-source registry guard are withdrawn together with the deferred room surface (their only caller), so no wire string carries two meanings and main's managed-claim and historical-receipt semantics are untouched. The three conflicted files (local_authority.py, local_authority_runtime.ts, heartbeat_receipt_identity.ts) resolve to main's semantics; no hunks were force-carried onto the refactored owner. When the room interaction is revived, its deadline need must be re-derived on top of main's reviewed-claim basis (or a new wire), not by re-aliasing v3.

Retained delta after the shrink (preview)

Production: todo_claim.ts only — the bound_agent claim guard and the goal_ref wire rejection (the admit_before parts of the current diff are removed with the deferred work). Tests: direct owner-level regressions for both guards on File and SQLite, plus room-off parity (ordinary unclaimed self-claim behavior unchanged). Everything else (CLI entries, Lark modules, TS room modules, room suites, room-work reference doc, RFC checkpoint prose) is removed in appended commits and stays recoverable in branch history.

…facade

Merge upstream/main ddc2f68. The three textual conflicts
(local_authority.py, local_authority_runtime.ts,
heartbeat_receipt_identity.ts) are semantic: main's
todo_claim_request_v3 is the reviewed managed claim (caller-bound
provider revision + registry digest, single chat task-start caller),
while this branch's v3/v4 were the room facade's guarded/timed wires.
Resolution keeps main's owner and wire semantics exactly and withdraws
the branch's claim-wire extensions together with their only caller.

Per the maintainer scope revision (2026-11-20 review, simplify_now),
the room facade is deferred in full, recoverable in branch history:
the five 'goal-channel work' CLI entries, the Lark room
offer/callback/recovery lifecycle and its cursors, the room TS
modules (projection/claim request/resume), the admit_before deadline
machinery, the multi-registry-source guard, the recall read-only
ingest flag and the resume heartbeat helper, the room suites and the
room-work reference doc. Shared files touched only by the deferred
surface are restored to main's shape.

Retained for this PR: the canonical claim owner's two disclosed
guards (bound_agent mismatch, unqualified goal_ref wire rejection)
with owner-level regressions to follow.

Signed-off-by: Lihua <[email protected]>
The retained production surface of this proposal is the canonical Todo
claim transaction's two disclosed guards, now covered by direct
owner-level File/SQLite regressions instead of room-facade suites:

- a Todo bound to another Agent rejects a foreign claim
  (bound_agent_mismatch) with zero canonical, receipt or projection
  effects, while the bound Agent claims normally;
- an explicit goal_ref on any claim wire is a protocol failure decided
  before provider IO (decision_read_from_provider=false), rather than
  being silently dropped by the runtime adapter's field whitelist —
  the guard therefore lives at the wire entry in
  claimLocalCoordinationTodo, reusing the owner's typed failure;
- parity: an ordinary unclaimed self-claim applies once and the same
  key replays the historical receipt without advancing the revision.

Red/green: neutralizing both guards fails the four guard cases on both
backends; restoring passes all six. The RFC checkpoint now records the
maintainer scope decision: the room workflow is deferred (recoverable in
branch history, to be re-derived onto main's reviewed managed-claim
basis), and this proposal ships only the owner hardening.

Signed-off-by: Lihua <[email protected]>
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 24, 2026
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Implementation complete on a new head 7b40f5d77 (two appended DCO-signed commits on top of e8e674252; no rebase, no force-push — the deferred room implementation stays recoverable in branch history). PR is conflict-free against current main ddc2f687d. The disposition table and rationale were posted before the push in the baseline analysis comment; this comment carries the result.

Commits.

  • ea489bc0d — merge of current main; the three conflicts resolve semantically, not textually: the shared owner keeps main's v0–v3 exactly (v3 = reviewed managed claim with its single chat task-start caller and its historical-receipt semantics), and this branch's guarded v3 / timed v4 wires, the admit_before deadline machinery, the multi-registry-source guard and the room facade that was their only caller are withdrawn together — no wire string carries two meanings. Per the scope decision, the merge commit also removes the deferred surface: the five goal-channel work CLI entries, the Lark offer/callback/recovery lifecycle and cursors, the room TS modules, the room suites and the room-work reference doc; shared files touched only by that surface are restored to main's shape.
  • 7b40f5d77 — the retained surface, now with direct owner-level regressions instead of room suites. One integration-driven correction discovered during the merge: with main's runtime adapter, an explicit goal_ref was silently dropped by the field whitelist before reaching the owner, so the guard now lives at the wire entry in claimLocalCoordinationTodo (reusing the owner's typed failure, decided before any provider IO). The bound_agent guard stays in the owner's eligibility check.

Final delta vs main: 5 files, +171/−0.

Path Content
loopx/control_plane/coordination/todo_claim.ts the two disclosed guards: bound_agent_mismatch on foreign claims of a bound Todo; goal_ref_claim_contract_unqualified typed failure
loopx/control_plane/coordination/local_authority_runtime.ts goal_ref rejected at the claim wire entry before the field whitelist (decision_read_from_provider=false)
tests/control_plane/test_claim_owner_guards.py File/SQLite owner regressions: bound-Todo foreign claim rejected with zero canonical/receipt/projection effects while the bound Agent claims normally; explicit goal_ref (null or object) rejected pre-provider; parity — ordinary unclaimed self-claim applies once, same key replays the historical receipt without advancing the revision
tests/control_plane_ts/goal_ref_claim_compatibility.test.ts TS-level: goal_ref-bearing legacy claims reject before provider or receipt access
docs/architecture/rfcs/agent-im-openviking-collaboration-v0.md checkpoint rewritten: room workflow deferred per the maintainer scope review (revival must re-derive onto main's reviewed-claim basis, not re-alias v3); this proposal ships only the owner hardening

Validation on 7b40f5d77 (failures and unverified kept distinct):

Check Result
Claim-owner guard regressions (File + SQLite) 6 passed; red/green proof: neutralizing both guards fails the 4 guard cases on both backends
Full control-plane TypeScript suite 6,792 passed / 0 failed / 91 skipped
Control-plane typecheck pass
Recall + outbound-guidance suites 87 passed (restored to main shape; rename and ingest flag reverted)
Main's reviewed-claim callers after the merge (chat reviewed create / task-start recovery / todo detail) 146 passed — main's managed-claim and historical-receipt semantics are intact
Ruff (changed Python) / DCO pass / both commits signed off
loopx canary premerge --from-git-diff --git-diff-base ddc2f687d (current merge-base) passed — 6 changed files, 0 failures, 0 manual holds, bilingual RFC and public-boundary checks included

Unverified this round: PostgreSQL (not available locally — the guards' suites and main's reviewed-claim suites above ran on File/SQLite only), real Lark rendering (moot for the deferred surface; no Lark code remains in the diff), installed-App journeys, and independent hosts. The CLI output-budget smoke passed within premerge as before. A fresh full exact-head review is expected per the review's own closing note; merge authority remains with the maintainers.

@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] SQLite 回归实际运行在 File。 标记为 sqlite 的三个测试实际均返回 file_v0。authority 没有传出 request.param,_seed 也没有向初始化器传 provider,因此默认选 File。请把实际参数传给初始化器,并在权威读回断言 provider。按此修正的隔离副本已通过三项真实 SQLite 用例和三项 File 用例。 定位到初始化调用

动机 / Motivation

通过普通 Todo 领取入口接续任务的 Agent,依赖任务已记录的绑定和原回执。 旧版本接收了与任务绑定不一致的领取输入,也会忽略旧领取请求中显式写入的 GoalRef。 本提交在真实 File 与 SQLite 上返回对应的拒绝,合法领取与原操作重放都能读回。随 PR 提交的 SQLite 用例实际仍使用 File。 本次交付限于共享领取入口的两项输入检查。房间领取、撤回和重连已从当前差异移除。

验收依据是 Agent IM / LoopX / OpenViking RFC,固定版本 ddc2f687d1ea2cb1e4a7cac1fadee548aca54c80。direct-agent-claim 保留普通领取,scoped-transition 在现有事务执行范围检查,withdraw-room-facade 的房间交互仍留在后续。

改动思路 / Approach

保留普通领取入口,在现有 claim owner 检查绑定,在 wire 入口拒绝该协议尚未支持的 GoalRef。 本 PR 只增加共享领取校验,并复用现有回执和状态所有者。 不匹配的绑定已经在生命周期 owner 有对应拒绝词汇。当前领取入口复用规范化逻辑并补齐读取权威后的检查。 原有 UI、offer 生命周期和同名 v3 扩展已从当前差异撤回。可用真实 provider 读回来保证测试覆盖这两个后端。

具体改动 / Changes

  • 净差异 5 个文件、+171 行。原始 local wire 在抽取字段前检查 goal_ref 是否存在。已有 v0–v3 格式和回执结构保留。 本地入口
  • 共享事务使用当前权威 Todo 的 bound_agent 判定新领取,合法绑定与无绑定两条路径继续按当前操作身份提交或读回。 共享判定
  • 保留现有成功、拒绝和重放用例。测试夹具必须携带真实 provider 和机器可读的来源断言。当前 PR 描述仍大段描述已撤回的房间 CLI 与 v4 期限处理,可同步为本次实际差异。 当前交付说明

对主干的风险 / Risks

用相同的对照夹具分别初始化 File 与 SQLite。主干四个拒绝断言得到 applied,当前头六项通过。两版普通 CLI 各 17 项通过,覆盖领取、受管执行和回执。提交的 SQLite 参数均实际使用 File,缺少持久的 SQLite 防回归检查。TypeScript 类型检查和标准预合并的 5 项直接检查、14 项选定检查均通过。 验证范围是隔离源码环境的 File/SQLite、普通 CLI 和类型检查。PostgreSQL、安装版和远端 CI 本轮未验证。

我的整体评价 / Verdict

请求修改。两项生产检查在真实 File 和 SQLite 上通过。请让仓库中的回归测试选中实际 SQLite,并断言读回来源,再复核准确提交。本 PR 只增加共享领取校验,并复用现有回执和状态所有者。

English verdict: REQUEST_CHANGES at 7b40f5d. The two claim guards work in independently verified File and SQLite runs. The committed SQLite-labelled cases currently open File; pass the selected provider and assert the native provider readback.


def _seed(runtime: Path, todos: list[dict], state: Path) -> None:
projection = build_todo_runtime_shadow_projection(goal_id=GOAL, todos=todos, handoff_mode="soft_claim")
initialize_canonical_authority(runtime, GOAL, projection, state_path=state)

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.

[P2] SQLite 回归实际运行在 File。 标记为 sqlite 的三个测试实际均返回 file_v0。authority 没有传出 request.param,_seed 也没有向初始化器传 provider,因此默认选 File。请把实际参数传给初始化器,并在权威读回断言 provider。按此修正的隔离副本已通过三项真实 SQLite 用例和三项 File 用例。

@huangruiteng

Copy link
Copy Markdown
Collaborator

@LIHUA919 同意这条减量方案。房间 CLI 和配套流程整体后置,本轮只保留 bound_agent 和显式 goal_ref 的两项通用领取校验。

谢谢你在 7b40f5d77 上推送精简实现并贴出验证矩阵。现在 main 已前进,请同步最新 main 后推送,并按新提交更新验证矩阵,保留 File / SQLite 与未启用房间时的普通领取回归。也请同步更新 PR 标题和正文,聚焦这两项 todo_claim 校验。

Clean auto-merge; the five retained files are untouched on the new
main (94 commits: research date-range, runtime freshness/queue
qualification, chat ingress re-ratchet, admission fixes). No conflict
resolution was required.

Signed-off-by: Lihua <[email protected]>
The authority fixture never passed request.param to the initializer
and _seed omitted the provider, so the three sqlite-labelled cases
silently initialized File stores (the reviewer's P2: every case
reported file_v0).

The selected provider now reaches initialize_canonical_authority, and
every authoritative readback asserts its machine-readable source:
claim results and the canonical snapshot must report file_v0/sqlite_v0
matching the parametrization, so a future provider-selection
regression fails the assertion instead of relabelling File coverage.

Evidence: replaying the dropped-provider bug fails exactly the three
sqlite-labelled cases on the source assertion (2.3s File-speed run);
the fixed suite passes 6/6 in 82s with the sqlite cases on the real
SQLite store.

Signed-off-by: Lihua <[email protected]>
@LIHUA919 LIHUA919 changed the title feat(goal-channel): canonical room-work Agent CLI, offer expiry admission and private reconnect context fix(coordination): reject bound-Todo foreign claims and unqualified goal_ref on the canonical claim wire Nov 24, 2026
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Fixed on a new head 756e35df8 (two appended DCO-signed commits on top of 7b40f5d77; fast-forward push, history intact). Also refreshed main first (see below) and rewrote the PR description/title to the actual delta.

Fixture fix, exactly your P2. The authority fixture never passed request.param forward and _seed omitted the provider argument, so the three sqlite-labelled cases initialized File stores. Both are fixed: the selected parametrization now reaches initialize_canonical_authority, and — per your requirement for a durable, machine-readable guard — every authoritative readback now asserts its source: claim results and the canonical snapshot must report file_v0/sqlite_v0 matching the parametrization, so a future provider-selection regression fails an assertion instead of silently relabelling File coverage as SQLite.

File/SQLite evidence:

Run Result
Bug replay (provider dropped again, assertions kept) exactly the three [sqlite] cases fail on the source_authority assertion, 2.3s File-speed run — the mislabel can no longer pass
Fixed suite, [file] x3 pass, readbacks report file_v0
Fixed suite, [sqlite] x3 pass on the real SQLite store, readbacks report sqlite_v0 (suite runtime 82s vs 2.3s in the bug replay)

The guard semantics are unchanged from the head you verified (the two production checks were independently confirmed by you on real File and SQLite; the red/green proof from the previous round still holds — neutralizing both guards fails the four guard cases on both backends).

Main refresh. Fetched current main e116109c5 (94 commits beyond our previous merge; the five retained files are untouched there) and merged with --signoff as e1615ae1d — clean auto-merge, zero conflicts, no resolution needed.

PR description is rewritten to the actual delta (5 files, +182/−0: the two claim-owner guards, their File/SQLite owner-level regressions with source assertions, the TS goal_ref compatibility case, and the RFC checkpoint recording the deferral decision); the stale room-CLI/v4-deadline prose is gone.

Validation on 756e35df8: guard suite 6/6 (File + SQLite as above); TS goal_ref compatibility 1/1; control-plane typecheck passes; loopx canary premerge --from-git-diff --git-diff-base e116109c5 (current merge-base) passes — 6 changed files, 0 failures, 0 manual holds, bilingual RFC and public-boundary checks included. Unverified this round: PostgreSQL (unavailable locally; File/SQLite only), installed-App journeys, independent hosts, and the full TS suite re-run at this exact head (it passed 6,792/0 at 7b40f5d77 and the retained TS surface is unchanged since; the new-main merge touches none of the five files). Fresh exact-head review and maintainer merge authority remain required.

@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

Agent 或调用方在已登记的 Goal 下领取任务,尤其是准备接续一个已有负责范围的任务时。 原领取入口可能接受与已有绑定不符的申请,或者丢弃自己无法验证的生命周期字段,给调用方留下不可靠的领取结果。 原来输入的边界与实际领取结果可能不一致。新版从权威 Todo 核对接收者,并在访问存储前拒绝这个旧入口无法承认的生命周期要求。 成功领取只来自已有权威规则,拒绝可读回且没有额外写入,同一普通请求重试保持原回执。 本次仅交付现有 canonical Todo 领取路径的两项加固和明确的范围记录。房间工作流、按钮、回调、记忆接续均仍待后续验证。 完整的房间接续、跨宿主取得并验证投影及飞书用户旅程留在 #5198。 任务来源

改动思路 / Approach

沿用 canonical 领取事务与现有块级拒绝。字段完整性先在请求入口处理,实际 Todo 的现任绑定在共享决策层判断。两个入口复用同一个生命周期拒绝构造器。 本次仅交付现有 canonical Todo 领取路径的两项加固和明确的范围记录。房间工作流、按钮、回调、记忆接续均仍待后续验证。 不再为房间新建第二套领取命令。维护者要求保留的部分直接保护现有多个调用方。 原领取合同

具体改动 / Changes

准确头 756e35df82a3524ec0fd08dd858a99b58c209095,合并基线 e116109c532ae5cf9e6d64bab77c6a07bd690e84。完整 diff 为五个文件、增加 182 行。按基线 RFC,CLAIM_AUTHORITY 与 FRESHNESS_AND_REPLAY 得到验证,ROOM_JOURNEY 保留在当前任务的后续验收。前次指出的 SQLite 用例误走 File 已修。测试使用实际 provider 参数并断言权威结果来源。 基线 RFC

关键代码讲解

  • claimLocalCoordinationTodo。在解析其余字段和打开 provider 之前判断输入完整性。 准确提交
  • unqualifiedGoalRefClaimFailure。本地 wire 与共享 owner 使用同一生命周期拒绝。 准确提交
  • rejectIneligibleTodo。根据当前 Todo 自身的角色和绑定核对接收者。 准确提交
  • remote claim 调用端。真实远程服务仍调用相同的 canonical 事务。 准确提交
  • File/SQLite 初始化和读回。把 provider 参数传到初始化器,并比较权威读回的来源。 准确提交

对主干的风险 / Risks

真实 File 和 SQLite 中,绑定 Agent 正常领取,无绑定 Agent 正常领取并按原键读回。旧键重试的权威版本保持。 已绑定其他 Agent 的请求返回既有错误形状,Todo 保持无领取人并且没有新增回执。未获支持的生命周期要求在读取 provider 或历史回执之前返回明确拒绝。 变更有意收紧旧入口不具备资格的输入。拒绝保持 typed,用户无需把提示误读为已领取或得到执行权限。两项判断位于共有边界,Lark 房间未参与执行。此 PR 继续依赖主干原来的 CAS、租约、registry 验证和回执重放。

语义与 CI 对齐

准确头 6 项 File/SQLite 实存储回归全部通过,SQLite 三项逐一断言真实来源。Node 线协议 1 项通过。相同现有调用端基线与准确头均通过 146 项。隔离 PostgreSQL 16.15 权威存储 401 项、服务 11 项和认证远程命令 53 项通过。TypeScript 类型检查、定向 Ruff、RFC 配对检查和标准 premerge 通过。 提供的是隔离真实 provider 与本地调用端的验证。已安装 App、真实飞书房间和跨宿主完整旅程尚未执行。

我的整体评价 / Verdict

本次修复把两条已接受的领取约束放回共有 owner。实际 File、SQLite 和隔离 PostgreSQL 的结果覆盖了新入口行为与现有领取恢复。当前准确头可批准。共享领取约束经原有调用端已有独立价值,房间交互需要单独验证外部交互和原路回执。 提供的是隔离真实 provider 与本地调用端的验证。已安装 App、真实飞书房间和跨宿主完整旅程尚未执行。

English verdict: APPROVE at 756e35d. The retained claim guards preserve supported claims and replay. The SQLite scenarios now use the actual SQLite provider, and the existing PostgreSQL authority and remote command suites passed in a disposable environment.

@loopx-agent
loopx-agent merged commit 3347302 into loopx-project:main Nov 25, 2026
44 of 50 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.

4 participants