Skip to content

Use the selected Goal runtime for Chat task reads and writes - #8717

Open
loopx-agent wants to merge 2 commits into
mainfrom
codex/audit-chat-goal-routing-pr-20261114
Open

loopx-agent wants to merge 2 commits into
mainfrom
codex/audit-chat-goal-routing-pr-20261114

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

Recover the accepted Turn from its original Goal

A Chat confirmation can have a saved receipt and a queued Turn even when its worker never started. Retry now combines the original Turn lookup from #8729 with this PR’s Goal source checks. It verifies the original Todo store and managed claim before resuming the same Session and Turn. A changed source or stopped Goal leaves the existing confirmation available with its failure reason.

原确认已经保存回执、但工作进程尚未启动时,从同一张卡恢复原 Session 和 Turn。重试会先核对原 Todo 库和已提交的认领。来源改变或 Goal 停止时,原卡保留回执并显示拒绝原因。

Validation at d1668e0e9ada

  • Against main 1047f3b4cdf9, 266 Python regressions and 74 TypeScript checks passed. File and SQLite HTTP tests cover a saved but undispatched Turn, concurrent retry, an older confirmation, a changed Goal source, and successful recovery after restoring that source. Replays preserve the original receipt and native state.
  • 399 PostgreSQL authority-store checks and 11 service checks passed on isolated PostgreSQL 16.15. Control-plane and Dashboard typechecks, the Chat wheel build, Ruff on the changed Python files, and the bilingual diff check passed.
  • The standard premerge run passed all six direct checks and 18 of 19 selected checks. The required Monitor poll writeback check fails in the same target-validation case on main and this candidate. Repository-wide Ruff and mypy also reproduce the same pre-existing findings on both revisions, tracked in Restore Python static checks on main #9082. The local quality record cqr_3e65a1da31f43a8ec799 records the blocked gate. This head awaits independent review. Live Feishu, the installed desktop host and an older PostgreSQL Chat upgrade remain unverified.

Visual evidence

The isolated wheel at d1668e0e9ada uses synthetic Tasks and a local upstream fixture. The desktop File case recovers the same Session and Turn and dispatches it once. The narrow SQLite case shows the stopped Goal error and dispatches zero times. Both cases preserve the native provider revision and original receipt.

Desktop before retry Desktop after recovery Narrow after Goal stops
The original confirmation offers Retry original operation The original confirmation shows the recovered task receipt The same confirmation shows that its Goal is no longer active

The full proposal against current main changes 33 files (+1,771/−287). Exact comparison · Earlier independent review

Recover the original creation after a later Todo edit

A 2.3.0 Chat confirmation that created an unassigned Todo can now return its original receipt after the owner edits the Todo. The recovery verifies the original Goal, store, creation receipt and predecessor revision. A confirmation with a pending assignment still checks the current Todo before writing.

旧版 Chat 只创建 Todo 并中断时,后来补写备注仍能从原确认卡取回创建回执。恢复过程核对原 Goal、存储、创建回执和前序版本。原请求确实还有指派待执行时,写入前继续核验当前 Todo。

Validation at db5309ef4f

  • The public 2.3.0 wheel created each fixture through its HTTP confirmation, and its Todo CLI added the note. The previous packaged head returned 409 twice on File and SQLite. This packaged head returns 200 twice on each backend with the exact original receipt, the new note and the unassigned Todo. Recovery leaves the native cursor at 3 across both retries.
  • 84 reviewed-create and 112 adjacent Python tests passed, including mismatched sources and pending assignments. 56 TypeScript checks, typecheck, Ruff and the bilingual diff check passed. The Goal-managed premerge gate passed 6 direct checks and all required checks across 19 selected runs. One maintainability advisory remains. Exact change-quality receipt cqr_2c77a98216275758ac63.
  • The narrow and desktop builds show the verified original result above optional diagnostics. The desktop Goal link returns to the original Goal. The authority readback after the browser retry confirms the original receipt, note and unchanged store again. These checks use isolated macOS wheels. Live Feishu, the installed desktop host and an end-to-end PostgreSQL Chat upgrade remain open.

The complete proposal compares 33 files (+1,701/−281) against main at 5cfd6ae7d5. The update from 4f2251b609 touches three files. Independent finding · Exact comparison

Visual evidence

Each capture uses an installed Chat bundle and a synthetic Goal seeded by the released 2.3.0 wheel. On the same narrow SQLite scenario, the earlier result asked for an unavailable assignment. The recovered creation shows the verified result and the Goal link. The desktop view uses File.

View Previous 4f2251b609 Updated db5309ef4f
Narrow · 390 × 854 Earlier creation-only confirmation asks to verify an assignment The original creation receipt is recovered on the narrow screen
Desktop · 1200 × 854 The desktop shows the verified creation and a link to the original Goal
Earlier comparisons and assignment recovery evidence

Verify assignment on the original Chat confirmation

Chat now requires evidence tied to the original confirmation before reporting assignment success. A saved confirmation checkpoint and a bound native operation still support recovery. An older confirmation without either can show the verified creation and current assignee in its original store. When the Task still matches the create receipt, retry can finish the authorized assignment once.

旧版确认缺少原指派回执时,原卡会显示经核实的创建结果和当前负责人。独立 CLI 指派即使使用同样的理由和负责人,随后再次改派时,原卡也会如实显示现任负责人,并保留原创建记录。现有任务仍处于创建后的原始状态时,可以从同一张卡继续完成指派。

Validation at 4f2251b609

  • Four HTTP regression cases failed on 5326adf5a9 and pass at this head. A 2.3.0 HTTP writer and the exact installed candidate wheel exercised four cases per backend on disposable File and SQLite stores. The saved confirmation returns the original receipt. An unfinished assignment resumes with one commit. Missing evidence and independent reassignment report the current assignee with zero additional commits across two retries.
  • 182 related Python checks, 56 targeted TypeScript checks, typecheck, Ruff and 399 native store checks on isolated PostgreSQL 16.15 passed. The Goal-managed premerge gate passed six direct and 19 selected checks. It reports one maintainability advisory. Exact change-quality receipt cqr_2f11280437ee2baed86d.
  • The packaged browser still shows the current assignee after reload. File and SQLite retain their original cursor. The independent re-review of this head, live Feishu, the installed desktop host and an end-to-end PostgreSQL Chat upgrade remain pending.

The comparison against main at 5cfd6ae7d5 contains 33 files, +1,682 and −281. Independent finding · Exact comparison

Visual evidence

Both narrow captures exercise an independent SQLite assignment followed by reassignment. The desktop capture exercises a saved File confirmation. All screenshots use synthetic Tasks and their built Chat bundles.

View Earlier head 5326adf5a9 Exact candidate 4f2251b609
Narrow · 390 × 854 Earlier confirmation reports success for agent-a after an independent reassignment The original card reports current assignee agent-b and an unverified original assignment after reload
Desktop · 1200 × 854 The File confirmation with saved assignment evidence returns its original verified receipt
Earlier source routing, recovery, and validation at 1cd2eb3 and older

Retained Chat confirmation recovery at 1cd2eb35d0

A retained confirmation can already have committed the assignment or run the original Turn. The original create receipt describes the state before either effect. Recovery now verifies that receipt and its store history, then uses the saved assignment, native managed claim, or the original started Turn as appropriate. The app offers Retry original operation on the same confirmation. An unfinished dispatch rechecks the current Goal, claimant and lease, and a confirmation with a recorded Todo rejects regeneration.

旧确认已有指派或已启动的 Turn 时,原卡可以取回同一个结果。未启动的请求仍检查当前 Goal、认领者和租约。换库时拒绝执行,恢复原来源后可以从同一张卡重试。

Against main at 5cfd6ae7d571f2f97da40982db23f76540723c89, the proposal changes 33 files, +1,626 and −278. Verified comparison Finding at the old head

The branch now includes #8714. The integration preserves both the original Chat confirmation cases and the new concurrent validation and completion receipt cases. The first combined run passed 250 of 251 Python checks. One test saw an empty PID file because the leader looked for the file before the child finished writing it. The final test writes the PID to a temporary file and renames it into place before signaling readiness. The runtime files are identical to the installed integration wheel. Merged #8714

Current validation

  • The final head passed 46 focused Python checks across File and SQLite, including retained confirmations, concurrent completion and original receipt recovery.
  • The installed integration wheel at f621627f6c passed four packaged Chat browser cases at 1200 px and 390 px. Retry used the original proposal and receipt in File and SQLite with zero additional provider writes. The narrow SQLite case rejected a mismatched store and succeeded after the original source was restored.
  • The final head passed 49 targeted TypeScript checks. The optional full TypeScript run stopped under host storage pressure. Before the test-only change, PostgreSQL 16.15 passed 399 store, 11 service and two targeted terminal tests with no skips. The targeted cases verified one commit during same-revision contention and original receipt recovery after a TLS service restart.
  • The local premerge gate passed 6 direct and 19 selected checks. It retains 1 maintainability advisory. Change-quality receipt cqr_d91a46d2d60d7b1dc563. The integrated head awaits independent review. Live Feishu, the installed desktop host and recovery of a retained PostgreSQL Chat confirmation remain unverified.

Visual evidence

Packaged Chat on isolated File and SQLite with synthetic Tasks. The before images are from bb75d31457. The desktop after image is from f621627f6c. The two narrow after images matched the previous capture byte for byte. The integrated wheel reproduces all four browser cases with the same frontend source and shipped active assets.

Viewport Before Original confirmation after the fix
Desktop · File · 1200 × 854 Previously the Chat view omits the stored confirmation The retained Task is visible with its original retry action
Narrow · SQLite · 390 × 854 Previously the narrow Chat view lacks a direct recovery action The original recovery action is available in the narrow drawer
Verified receipt after the narrow retry The narrow drawer displays the verified original Task result
Installed 2.3.0 upgrade evidence at 4d18dd2
  • Published 2.3.0 wrote retained confirmations through real Chat HTTP on disposable File and SQLite stores with an isolated upstream host fixture. The exact candidate installation returned the same completed Turn and native receipt twice in each store. Each Task dispatched once. A saved assignment without a claim or recorded Turn cannot start a replacement.
Earlier scope and validation at 27302c0

Goal and delivered outcome

Chat Task detail, preview, edit, completion, Monitor updates and Gate resolution use the selected Goal's original registry and runtime. The shared directory points to that authority. Tasks that exist only in the shared store remain outside the selected Goal's write scope.

A Todo can be created before its confirmation returns. A confirmation retained from the older Chat action store recovers the original native create receipt and verifies that the preview revision belongs to that store's history. If the original Todo still matches and the Agent is registered, the same confirmation can finish assignment with a current provider revision. If proof is unavailable or the Todo changed, the action returns the retained creation checkpoint and tells the user how to review assignment on the existing Todo.

Monitor creation carries the reviewed registry digest, routing-directory witness and provider revision to the canonical writer. A last-moment route change is rejected before either store is modified. A native create compares explicit schedule configuration when detecting an existing Monitor and derives an implicit initial due time only for a new record. A retry after a lost Chat response can therefore read back the existing Monitor even after the clock advances.

Historical scope at 27302c0baf

Written by model_agent (OpenAI Codex). The branch includes the previous PR head 289299ebf5b36f252a444b7e7d878f312bbc815f and main f3bdad2387397e078fbc887e7cb7ed80adaf7510. This update addresses the two findings in the latest review. The end-to-end prepared-create checkpoint and related confirmation lifecycle changes are covered by #8725. Goal-level admission follow-through remains in #8727. Latest review Exact comparison

Historical validation at 27302c0baf

Tested revision 27302c0baf6d96096db097d84dd08bb3ecb90483 using disposable File and SQLite authorities. Hosted model and messaging activity use fixtures where those paths require them.

Check Result
Native Chat HTTP, File and SQLite 162 passed across the related Python suite. Ten focused recovery cases pass; all ten fail on 289299ebf5.
Upgrade from main The real previous Chat version leaves a creation checkpoint containing the native Todo identity and the original confirmation receipt. After upgrade, two HTTP retries return that receipt with one Todo and one assignment commit per provider.
Monitor race and delayed response recovery Changing the source at the native writer boundary returns 409 without writing to either store. Advancing the test clock after dropping the response preserves the original Monitor and its due time. Both providers reproduce HTTP 424 on the intermediate version before the scheduling fix.
TypeScript and premerge 41 focused TypeScript checks, type checking, Ruff, bilingual RFC diff, and 19 standard premerge checks pass.
Packaged Chat The Chat bundle builds and loads in the related HTTP suite. The previous head also exercised the existing Task inspector on desktop and at 390px.
Digest ownership The separate ownership test fails on the pinned main and the candidate at the same SHA-256 matcher. The fix is tracked in #8836.
Installed App, real Feishu and PostgreSQL Follow-up validation remains open.

Independent review and hosted CI apply to the new head. Registry source witnesses

@mergify

mergify Bot commented Nov 14, 2026

Copy link
Copy Markdown

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

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

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

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

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

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 14, 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.1-sol · OpenAI · runtime_reported · reasoning_effort=max

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

评审提交 3347c7f8dbb0a20cfe5bda7bfdbb69af69c1ef0c;对照目标基线 78e936f9d1f1a00505c4026ee0a5857de95cee27。

[P2] 创建回执恢复时会把原任务的分配写入新来源。 从共享目录确认创建 Todo。旧来源已持久化创建回执,但请求在分配前中断;目录随后将同一 Goal 指向另一独立来源,那里有同 ID 的不同任务。 重试原 proposal 时,候选用旧创建回执里的 Todo ID 写入新来源,把无关任务分配给 Agent,并返回 applied / projection_verified=true。原任务仍未分配。基线用同一夹具重试时只改原来源。File 和 SQLite 均复现。 恢复后分配

[P2] 全局目录能读到原任务,编辑和完成却查写共享库。 全局目录同时声明 common_runtime_root 和某个 Goal 的 source_registry,两边都有该 Goal,但包含不同的 Agent Todo。 详情从原来源返回 200,带这个 review_basis 编辑返回 400,完成同一 Todo 也返回 400。仅共享库里的任务详情是 404,直接预览和确认却返回 201/200,并确实修改共享库。精确基线同样失败,这是本次承诺修复的路径仍未覆盖。 预览使用的 runtime

动机 / Motivation

通过本机 App 管理多个 Goal 或在故障后恢复任务创建的用户。 用户在 Chat 打开、创建或修改同一 Goal 的任务。有独立来源时,共享目录只能作为入口。创建中断后用户可以重试已经确认的动作。 本次正常创建、Monitor 创建、独立 Todo 预览和用户完成的原生 HTTP 检查通过,覆盖服务 runtime、已注册 runtime 和共享目录;共享目录的无歧义读取及未换源的创建恢复也通过。 独立复现用源码检出的本地 Chat HTTP 和真实隔离 File/SQLite,仅注入中断,没有调用模型。前端渲染未改;安装态、PostgreSQL 与托管 CI 未查。

改动思路 / Approach

Goal 来源解析器选择 runtime;原生 Todo provider 负责权限、CAS 和回执。Chat proposal checkpoint 只保存操作身份、恢复应由这些事实约束。 沿用同一个来源解析及原生操作回执,收拢 Chat 既有操作与创建恢复的来源选择。新一层猜测或只改错误文案都不会改变写入目标。

具体改动 / Changes

goal_read_runtime_root 给全局目录留出 per-Goal 路由,resolver 在无声明时先尊重显式 override。Todo/Monitor 创建与独立 dry-run/apply 改用 loopx/chat/todo_actions.py 的来源选择;既有 Task、Monitor、Gate 只接入了 runtime fallback。检查覆盖 10 个文件(+369/−53,其中生产 +115/−45);其余是两种 provider 的原生创建、完成及任务正文读回夹具。全局目录 显式 override 预览绑定 既有 Monitor

按 原生来源 witness 与历史回执合同,explicit-runtime-selection、normal-create-source 已验证;checkpoint-source-parity、existing-task-source-parity 未满足。

对主干的风险 / Risks

精确基线在换源后仍分配原任务;原任务预览与详情不一致则是基线就有的缺口,属本次交付范围。另对 1cdd9bb 做本地无写入合并演算,两条保留来源逻辑 loopx/chat/todo_actions.py、loopx/chat_actions.py 有冲突。解决冲突后需要对合入候选重跑这两组测试。

语义与 CI 对齐

PASS:70 个 Python 测试、17 个本地 premerge 检查、同源恢复和显式 runtime 优先。FAIL:两种 provider 的换源恢复会写错库,且既有 Task 详情和编辑/完成仍未同源。UNVERIFIED:已安装桌面、PostgreSQL 和托管 CI。 两组反例都通过真实本机 HTTP 及隔离的原生 File 和 SQLite authority。故障只注入在创建 checkpoint 写入之后;观察来自两份实际 provider head 和最终回执。

我的整体评价 / Verdict

请求修改。让创建 checkpoint 绑定原来源的 registry、runtime 和原 provider 操作身份。重试只在原来源仍可恢复并有当前分配权限时续做;否则保留已创建的回执、拒绝新写入,并让用户处理来源变化。 让详情、预览、编辑、完成及共用的 Monitor/Gate 分支解析同一 Goal 来源;拿该来源的 registry witness 和 provider revision 做预览与写入校验。 用真实 HTTP 在 todo_created 落盘后、todo_assigned 前断一次,再改目录指向包含同 ID 不同内容的第二个库:不能修改替代库或报告完整成功;同源重试仍只分配一次。 在 File 和 SQLite 的原库、共享库各灌入不同 Todo;从详情发出 edit/complete,确认写回原库,并证明共享库独有任务走同一预览入口时被拒绝。

English verdict: REQUEST_CHANGES at 3347c7f. Matched File and SQLite HTTP runs prove a new write to the replacement authority during interrupted-create recovery. Existing edit and completion still use the shared store despite source-correct detail. Keep normal routing and bind all reviewed effects to the same source.

Comment thread loopx/chat_actions.py Resolved
Comment thread loopx/chat/todo_actions.py Resolved
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 14, 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.1-sol · OpenAI · runtime_reported · reasoning_effort=max

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

评审提交 41cffe553282a3dbd87c8946334749fcb346d64a,对照目标基线 74ca883d5bd3e4bc64671bac54210eac9e97ed05。

[P2] 同源并发创建后,已确认的任务无法续做分配。 Chat 已持久化 todo_created,提交尚未分配时断开响应。另一条正常 Todo 创建推进了同一 Goal 的 provider revision,原任务内容、注册来源与操作身份都未变。 File 和 SQLite 上重试原确认两次均因旧 provider revision 返回 HTTP 400,原任务一直未分配。主干在相同并发下返回 applied,重放读回同一回执。候选没有并发写入时也通过。 分配时使用原 provider revision

[P2] 监控核验后切换注册来源,确认仍写入旧库。 从共享入口确认监控创建。在 Chat 通过当前来源 fingerprint 核验后、调用 Todo provider 前,将同一 Goal 的注册来源指向另一独立库。 候选返回 HTTP 200/applied 并在旧库增加一条监控。主干在相同竞态写入替代库。两个版本在来源变化时都报告成功,候选改变了错误写入的目标。候选普通 Todo 创建挡住相同换源,两库数据不变。 监控写入入口

动机 / Motivation

在 LoopX Chat 管理注册 Goal 中任务和监控的用户。 用户在共享入口确认创建、分配或编辑任务,服务中断后重试同一确认。监控提交也应遵循用户确认时的 Goal 来源。 主干上,创建成功后若另一个正常任务推进同一来源版本,重试仍能分配原任务。主干的监控在晚换源时会写入新库。 先前两项问题的复现已通过。创建中断后提前换源时,候选拒绝改动替代库。原来源恢复后可以续做。同源详情、编辑、完成、停止监控和处理 gate 都走注册来源,共享库独有的任务无法从该 Goal 操作。 使用源码检出的真实 Chat HTTP 和隔离的 File、SQLite,确认打包构建和客户端 schema 测试。安装态、PostgreSQL 及带启动的任务分配分支没有做本次独立复现。托管 CI 未查询。

改动思路 / Approach

Chat 的 Goal resolver 负责选定来源,Todo authority 持有写入许可、CAS 和回执。恢复时,Chat checkpoint 需要保留原创建与分配的身份。 Keep one source resolver and the original writer. The persisted witness needs a current per-attempt CAS for unperformed assignment and the same write fence for monitoring.

具体改动 / Changes

关键代码讲解

  • resolve_chat_todo_source 收拢注册来源选择。恢复时 require_created_todo 校验原创建操作及任务;后续写入却继续使用创建时的全库版本。来源选择及恢复校验 原分配尝试
  • monitor.create 使用 resolver 的目标库。其既有 add_goal_todo 支持校验 registry digest 和 provider revision,当前确认调用没有传入。监控调用 已有写入边界
  • 19 个文件(+839/−121)。前端仅放宽一个来源字段的解码;HTTP 路径和两类 provider 的差异由测试、隔离复现和 provider 读回核查。现有 Chat 路由检查

按 docs/project-agent-todo-contract.md 验收。same-goal-source 已验证,original-create-recovery 和 monitor-commit-source 未满足。先前的同 ID 替代库与详情、编辑、完成失配已有回归覆盖并通过。原生来源与恢复约束 上次评审

对主干的风险 / Risks

分配失败发生在创建已提交后,用户反复确认仍得不到原先请求的分配。监控在错误来源持久化后会出现在后续调度的候选集中。两库的行数和动作回执均已核对。在每次仍未分配的尝试中读回当前来源和原 create 操作身份、原任务内容及当前分配资格,确认与原意图一致后使用当前 provider revision 做 CAS。持久化本次分配的请求身份并用原回执恢复,保留 registry 及目标任务校验。 让监控创建把已审阅来源的 registry digest 和 provider revision 交给原生创建 API,在写入边界校验。末次换源应停写并要求用户刷新确认。

语义与 CI 对齐

候选通过 92 个 Python 测试、40 个 TS 测试、19 项本地标准预合并检查和打包构建。两个反例各在 File 和 SQLite 重现。两处最小因果改动的隔离对照合计通过 8 个用例。全量 TS typecheck 在两版都报既有测试的 TS2345。托管 CI 未查询。

我的整体评价 / Verdict

请求修改。在 File 和 SQLite 分别令创建 checkpoint 持久化后中断,创建无关 Todo,再重试同一确认两次。断言仅分配原任务一次,读回同一回执,且新版内容或换源仍拒绝。 在 File 和 SQLite 的同一个真实 HTTP 入口重复换源,核对两库行数和内容。来源变化应返回失败,独立对照接入现有 native CAS 后两库均无写入。

English verdict: REQUEST_CHANGES at 41cffe5. A concurrent unrelated Todo write strands the original confirmed assignment on both local providers. A late registry switch allows Monitor creation to commit in the obsolete store. Both earlier reported reproductions pass on this head.

Comment thread loopx/chat_actions.py Resolved
Comment thread loopx/chat_actions.py Resolved
@mergify

mergify Bot commented Nov 15, 2026

Copy link
Copy Markdown

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

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

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

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

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

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 15, 2026
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 15, 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.1-sol · OpenAI · runtime_reported · reasoning_effort=max

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

评审提交 289299ebf5b36f252a444b7e7d878f312bbc815f,本地和 GitHub 比较以当前 main f3bdad2387397e078fbc887e7cb7ed80adaf7510 为参考,实际 merge base f7e3f427197bab6c66ab535e26613a7f9c2fdbe0。净改动 25 个文件(+1157/−218)。GitHub PR 面板的 197 个文件沿用较早的 74ca883d5b。 精确比较

[P2] 恢复主干遗留的已创建确认

在基线运行实际 Chat HTTP,确认创建并指派一个 Todo。在 provider 提交和 todo_created checkpoint 持久化后、指派前注入一次中断。用候选代码重启同一隔离服务,保留同一 registry、provider、Todo 和 proposal,读回原 native create receipt,再对原确认提交两次。 File 和 SQLite 都能读回唯一的原 create receipt,原 Todo 内容保持一致。候选两次都返回 HTTP 400,任务始终未指派,provider cursor 不变。主干原版本重开同一场景,两次返回 200 和同一回执,只提交一次指派。 从原 proposal 的旧操作 ID、原创建回执和可验证的原存储谱系核对同一 Todo,保留当前注册与 CAS 校验。来源证据不足时,读回可证实的已创建结果,并显式引导对同一个 Todo 重新审阅指派。 代码

[P2] 把已审阅的 Monitor 来源交给 native create

在实际 HTTP 确认的最后一跳调用 native writer 前,改同一个 registry 文件的 common_runtime_root,分别读回原库和替代库。原 Goal ID 和已登记 Agent 保持一致。 File 和 SQLite 均返回 200/applied,原库各新增一条 Monitor,替代库零写入。基线同序列写入替代库。普通 Todo 创建在四个基线和两个候选对照中全部拒写,两个库均保持原状。 该调用传递可选的目录 witness,遗漏了原源摘要。把原摘要和 provider revision 一起传给现有 source-bound create,按相同 HTTP 调度顺序复验零写入。#8725 已独立复测此竞态返回 409。 代码

动机 / Motivation

面向在 Chat 查看、编辑和指派已注册 Goal 任务的使用者。 主干能复用旧创建回执续做指派。候选把已更新来源格式的任务接回原库,并在无关写入后继续。 真实 Chat HTTP 的 File 和 SQLite 已验证来源详情、编辑、完成、停止 Monitor、处理 Gate、legacy Todo 确认入口和原任务恢复。四个无关写入/零写入对照均只提交一次指派,两次重试回读原 receipt。 本地 File 和 SQLite 独立验证,实际安装 App、实时飞书和 PostgreSQL 服务待验证。 既有来源契约 恢复验收

改动思路 / Approach

统一选定 Goal 的 registry/runtime,为写入挂接来源摘要,并在创建回执仍有效时刷新指派的 provider revision。 将来源解析及时收敛到现有 Todo owner 有价值。#8725 的同序列反例已通过,可提取它交给 add_goal_todo 的源摘要及 revision 绑定。历史确认需要可信读回或保留可用的同任务接续。 Chat 保留确认和界面状态,native Todo owner 处理权限、比较并交换(CAS)与命令回执,隔离 provider 状态用同一入口读回。 同一原操作要求

具体改动 / Changes

关键代码讲解

  • resolve_chat_todo_source 按选定 Goal 解析源 registry/runtime,投影来源身份和附加目录 witness。 详情和审阅写路径共用来源。 代码

  • _apply_created_todo_assignment 先沿原分配 ID 重放,在确定旧 revision 被拒后结合原 create receipt 和当前 Todo 刷新 CAS。 File 和 SQLite 能恢复同源无关提交,也拒绝改动过的任务。 代码

  • _apply_todo_create 当前分配需要 checkpoint.source,旧主干正常保存的已提交确认只保存 canonical_receipt 和 todo_id。 主干留下的确认无法取得原回执或完成指派。 代码

  • _apply_monitor_create 同源目录可选 witness 下发到 native create,当前 call 仍采集下一次源读时的 digest。 注册文件换源后,原库仍新增 Monitor。 代码

验收覆盖 same-goal-source 已验证,current-create-recovery 已验证,retained-confirmation 未达到,monitor-commit-source 未达到。25 文件覆盖 Goal runtime 解析、Chat 各任务入口、native create/claim/update/terminal 的 source witness、前端 decoder、文档与回归。 来源契约 上一轮评审

对主干的风险 / Risks

当前修复让已有来源的任务编辑和同源指派继续执行。Monitor 的晚变更仍会触发未经当前来源核对的写入。 打包 Chat 构建和其 HTTP 加载通过。#8717 的 UI 变更只扩展 decoder。当前工作没有单独重走该提交的渲染交互。 任务恢复契约

语义与 CI 对齐

Python 总共 124 项通过。其中 112 项在首轮通过,首次尚未构建 chat bundle 时的 12 个 HTTP 404 全部在原提交就地构建后通过。TypeScript 同范围 59 项通过、1 项跳过。构建、合流树和 diff 检查通过。 三个精确版本的 Python 摘要归属检查均出现同一历史失败,关联 #8836。托管 CI 未查询。终结验证和共享目录的替代任务拒绝,覆盖 App HTTP 的十二个用户完成用例。外部会话启动测试使用 fixture transport。 摘要归属修复

我的整体评价 / Verdict

请求修改。从原 proposal 的旧操作 ID、原创建回执和可验证的原存储谱系核对同一 Todo,保留当前注册与 CAS 校验。来源证据不足时,读回可证实的已创建结果,并显式引导对同一个 Todo 重新审阅指派。 将 Monitor 已审阅的源摘要与 provider revision 一起交给现有 native create。 用实际 HTTP、File 和 SQLite 从旧版本持久化后的同一记录重放两次,验证原回执、目标归属和单次写入。同一测试矩阵还需证明最后一跳换源时两库零写入。

English verdict: REQUEST_CHANGES at 289299e. Old persisted Chat confirmations cannot finish their original assignment on either local provider. A late source switch also allows the Monitor to write to the old store.

Comment thread loopx/chat/todo_actions.py Resolved
Comment thread loopx/chat_actions.py Resolved

@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.1-sol · OpenAI · runtime_reported · reasoning_effort=max

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

[P2] 已指派的旧确认在升级后无法读回。 我在主干的真实 Chat HTTP 上先创建并指派任务,在 todo_assigned checkpoint 保存后、确认回执返回前中断。File 和 SQLite 均保留一条原创建回执、已指派的 Todo 和两个 checkpoint。候选在同一注册表和同一库上重试两次,均返回 409 并把卡片标为 gated。主干重开相同场景,两次返回 200 和同一回执,两库均无额外写入。创建回执中的 Todo 早于指派,恢复分支把预期的状态变化当作来源不明。继续校验原库和原操作,使用已经保存的指派或启动 checkpoint 及原生读回恢复成功结果。 历史创建恢复

动机 / Motivation

在 Chat 给 Agent 创建和指派 Goal 任务的人需要在重开确认后看见原结果。任务已经写入、确认未返回时,重新填写信息会让人失去对原卡片的可信判断。候选能恢复中断于指派之前的旧确认,也能在 registry 来源变化时挡住 Monitor 写入。已完成指派的旧确认还有上述回归。验证范围为本地实际 HTTP、File 和 SQLite、源码构建的 Chat bundle。

改动思路 / Approach

Chat 从 Goal 的源 registry 与 runtime 解析任务,再复用现有 Todo 写入、来源校验和 provider revision。保留确认属于 Chat 的恢复状态,原生回执证明已提交结果。旧 todo_created 仍可通过操作 ID 和同一库的前序 revision 验证。同一工作流完成自己的指派后,后续读回需要区分已提交阶段与还要写入的阶段。最小修复只补原确认恢复分支,保留已通过的换源防护和对真实外部编辑的拒绝。 来源协议

具体改动 / Changes

  • resolve_chat_todo_source 统一任务详情、预览、编辑、完成、Monitor 与 Gate 的来源。前端只扩展 source_identity 的可选解码,展示布局沿当前实现。 来源解析
  • _apply_todo_create 能为缺少来源字段的旧 checkpoint 验证原创建操作并续做一次指派。新恢复分支先要求当前 Todo 等于创建时的记录。原指派 checkpoint 已保存也会进入此比较。 恢复调用
  • _apply_monitor_create 交给原 native create 的两项值分别是源 registry 摘要和 provider revision。把 registry 的 runtime 在写入前换到另一库,File 和 SQLite 都返回 409 stale,两边行数和 revision 保持原值。 Monitor 写入
  • executeCoordinationTodoCreate 在确定是新记录后计算隐式到期时间,重复匹配先看请求配置。改测的确认失响应、稍后重试覆盖原 due time 和原条目。 首次调度

本次按 docs/project-agent-todo-contract.md 的 f3bdad2387397e078fbc887e7cb7ed80adaf7510 版本及主干 R1 对照。Canonical registry source witnesses 已在真实换源反例中验证。R1 的持久确认及恢复结果仍有 [P2]。26 文件共 +1312/−240,覆盖 Chat API、native 本地写入、管理路由、字段解码、文档和测试。 主干 R1

对主干的风险 / Risks

验证 结果 观测
创建后未指派的旧确认 PASS 两个 provider 上候选各返回两次 200 和原创建回执,每组仅提交一次指派。上一评审提交同样种子两次 400
Monitor 允许提交及最后一跳换源 PASS 双库当前验证通过,来源变化时原库和替代库均零写入
指派后失去确认响应 FAIL 主干两次 200,候选两次 409。原指派已经持久化,provider revision 无额外变化
定向回归与构建 PASS 108 项 HTTP 和恢复测试、28 项完成相关测试、35 项 TypeScript provider 测试通过。Chat bundle 构建并验证
Python 摘要归属 FAIL 同一测试在主干与候选均为 243 通过、1 失败。三处完全相同的规则位于未改变的文件,由 #8836 跟进

语义与 CI 对齐

本地合流树与 diff 检查通过。复验使用两个独立持久化后端观察行、原回执与 provider cursor。候选回退发生在正式恢复分支,故障注入只截断原 HTTP 确认,原生写入和读回走真实实现。托管 CI 依本任务策略保持未查询。 摘要归属修复

我的整体评价 / Verdict

请求修改。旧确认如果在指派前中断,当前的新路径已经能接上。把同一个真实 HTTP 对照扩到已指派和已启动两种合法阶段,证明重试只读回原事件。来源不可证或当前任务被外部编辑时,继续拒绝需要新授权的写入。展示层变更限于可选字段解码,本地构建已验证。实际安装 App、实时飞书及 PostgreSQL 使用仍待验证。

English verdict: REQUEST_CHANGES at 27302c0. Legacy pre-assignment recovery and the Monitor source fence pass. An already-persisted assignment still returns 409 after upgrading on File and SQLite.

Comment thread loopx/chat/todo_source.py Resolved
@mergify

mergify Bot commented Nov 18, 2026

Copy link
Copy Markdown

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

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

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

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

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

@mergify mergify Bot added needs-rebase Mergify: the pull request has merge conflicts with its base branch and removed needs-rebase Mergify: the pull request has merge conflicts with its base branch labels Nov 18, 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, max)

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

[P2] 保留旧确认中已经写入的原生指派

在主干真实 Chat HTTP 上创建任务并完成原生指派,再于 Chat 写入 todo_assigned 前中断。File 和 SQLite 都保留原 Todo、原创建回执和已提交指派。用当前 head 重开同一个库,原确认各重试两次都返回 409 gated,provider cursor 均未前进。只要能从原库证明原生指派,就应从原卡读回。证据不足时也能显示已验证的创建与当前指派状态。 相关代码

动机 / Motivation

从 Chat 给 Agent 指派任务的人,需要在重开确认时看到原 Todo 和实际完成的阶段。 本次把任务详情、任务编辑和 Monitor 变更接回选中 Goal 的来源,原卡也能读回已记录指派。失去原响应可能发生在原生写入与 Chat 保存阶段之间。 原卡应显示从正确存储验证过的结果,恢复时保留原 Todo,只在仍需写入时核对当下授权。 这次评审聚焦本地 Chat 的单次确认与恢复,以及原 CLI 来源选择。真实飞书、安装态桌面和其他运行环境仍需各自验收。

改动思路 / Approach

Chat 保留提案、操作 ID 和阶段记录。Goal 来源解析与 native Todo owner 分别负责定位、校验和提交。界面用现有 review plan 显示可恢复的原卡,拒绝给已记录 Todo 生成另一份确认。 33 个文件横跨 Chat、共享来源解析、原生写入和展示。可独立验收的内容是沿当前 Goal 读写并从同一确认取回效果。 沿用类型化来源 witness 和原生事务,能避免为 Chat 再造一套写权限。重要差别是用户看的确认进度落后于原生提交。不要通过重做指派填补旧记录缺口,应先读回能够证明的结果。

具体改动 / Changes

精确 head 1cd2eb35d015ece24c6b9634a6ecf8e73c87d803,diff base 5cfd6ae7d571f2f97da40982db23f76540723c89,33 个文件 +1626/-278。逐项复核 selected-goal-source、saved-assignment、interrupted-native-commit、exact-retry-surface。验收约定

关键代码讲解

  • Task 详情、单项 Todo 与 Gate 走选中 Goal 对应的 registry 和 runtime。单独目录提供路由时,写入同时验证两份源摘要。源码
  • 新创建在原 Todo 上复用稳定的指派和 claim ID。已保存的旧指派能读回,缺旧阶段时仍按原创建快照判断。源码
  • 历史路径检查原创建回执与同一库的前序 revision。新反例在已合法写入指派之后到达这一处,原创建快照与当前 Todo 已有差异。源码
  • Monitor 创建在实际 native 写入前绑定来源和 provider revision。延后重试读回首次选定的到期时间。源码
  • review plan 用原卡片提供重试,已有 Todo 后禁止重新生成,抽屉将重试放在诊断信息之前。源码

对主干的风险 / Risks

同一中断点的主干对照在两个库均两次返回 200,第一次重试新增一次 provider commit。把中断移到 Chat 保存指派之后,新提交在两后端均能读回原回执,provider cursor 没有前进。56 项 TypeScript 验证和类型检查通过。Base 与 head 各通过 14 项来源路由验证。匹配源码与打包 Chat 的 178 项 Python 验证通过。

语义与 CI 对齐

原卡恢复是 R1 的交付条件。保留已采用的当前来源、权限和 CAS 约束,把这次旧确认的已提交指派与仍需授权的新写入区分开。首轮沙盒缺少源码 fixture 和 Chat bundle,复跑已用同一提交补齐这些输入。附图观察与真实 HTTP 反例一起界定了本地旅程。

我的整体评价 / Verdict

请求修改。请在原确认上核对同库提交历史,取回能证明的原指派。无法归因时也应展示可验证的原创建和当前指派状态,让用户知道工作已经写入哪一步。用同一旧库和同一张卡重试两次,确认读回准确且零新增 provider commit。

复看 PR 的 1200px 桌面与 390px 窄屏图。桌面时间线和抽屉都显示原任务,窄屏抽屉把重试放在诊断信息上方,成功页能回到更新后的 Goal。已比对图对应的源码,最终提交只调整 Python 测试。 图中是单条合成任务。多条长任务混排、诊断完全展开以及本次 409 失败后的界面读回尚待复核。

English verdict: REQUEST_CHANGES. At 1cd2eb3, an older assignment committed before its Chat checkpoint still returns 409 on retry on File and SQLite. Recovery after a saved assignment checkpoint passes on both.

Comment thread loopx/chat/todo_source.py Resolved

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

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

[P2] 独立指派会被记作原 Chat 确认的成功结果

在真实旧 Chat HTTP 中断于创建后、指派前,随后通过正常授权发起独立的 CLI 指派。候选用相同更新内容和理由归因给原确认。此后把任务合法转给 agent-b,原卡在 File 与 SQLite 各重试两次都返回 200、agent-a 和 projection_verified=true,并补写 todo_assigned。原确认从未提交指派,两次重试均未新增 provider commit。 相关代码

动机 / Motivation

维护者从 Chat 指派 Todo,断线后需要知道原确认完成了哪一步、现在由谁负责。 上一头在原生指派已有回执、Chat 阶段尚未保存时阻止原卡读回。新头恢复这个场景,并增加当前指派的部分结果。 只有原确认留下的指派证据应生成原操作成功。其他入口的独立指派可以从当前 Todo 如实读回。 此次以本地真实 HTTP 和 File/SQLite 验证原确认。安装态、真实飞书和旧 PostgreSQL 升级仍待验。

改动思路 / Approach

Chat 记录提案与阶段,来源解析核验原注册库,native Todo owner 负责原生回执和写入。新增日志回读能找到同一库里的更新。写入 todo_assigned 仍需要证明该更新属于原确认。 复核从主干到当前的 35 个文件。与上一已评 head 严格对照,29 个文件字节相同,新增差异集中在历史读取、原卡阶段和抽屉反馈。 用两种中断点区分已提交原指派与仅完成原创建。把独立指派和之后换负责人注入正常 native 写入,核对原卡与实际库。

具体改动 / Changes

精确 head 5326adf5a95db462a5df6ac5084255285949c408,diff base 5cfd6ae7d571f2f97da40982db23f76540723c89,35 个文件 +1760/-285。逐项复核 source-bound-read、genuine-commit-recovery、original-provenance、verified-partial-view。验收约定

关键代码讲解

  • 创建历史仍绑定原 Todo、原前序 revision 与同一来源。此前的跨库保护和原创建回执复用保留。源码
  • 新增扫描用规范化 update 摘要匹配,但摘要含可填写的理由,没有原 Chat 确认身份。源码
  • 同一确认会把命中的独立更新记录为 todo_assigned,并返回原确认验证成功。源码
  • 缺少可靠指派证据时,抽屉已有原创建与当前负责人的反馈入口。源码

对主干的风险 / Risks

两个后端上,真实原指派在丢失 Chat 阶段后都能读回,说明上轮问题已修。独立 CLI 指派后,当前的匹配分支仍会恢复从未发生的原指派。再把 Todo 合法转给 agent-b,原卡两次返回 200 和 agent-a 的已验证结果,provider 仍读到 agent-b。74 项 Python 与 56 项 TypeScript 验证通过。

语义与 CI 对齐

普通来源追踪、已保存的原操作和部分反馈应继续生效。应核对独立操作的来源与原确认关系。可填写的权威理由和一致的目标、人员只描述它做了什么。当前实测未涉及真实飞书、安装态或 PostgreSQL 升级。

我的整体评价 / Verdict

请求修改。沿用已验证的创建读回。只有回执能绑定原确认时保存指派成功。历史证据不足时在同一张卡显示创建和当前负责人,再通过现有授权路径处理仍需执行的指派。

复看 PR 的 390px 和 1200px 首屏。新的窄屏抽屉在重试上方给出原创建和当前负责人的事实。桌面成功态有回到 Goal 的入口。 图中未覆盖此次误报成功的序列、长任务混排或展开后的诊断。新反例由真实 HTTP 读回复现。

English verdict: REQUEST_CHANGES. REQUEST CHANGES at 5326adf. Genuine recovery passes, but a separate authorized update can fabricate the original assignment checkpoint on File and SQLite, even after the canonical assignee changed.

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

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

[P2] 仅创建的旧确认在合法补写备注后误入指派阻塞

旧版实际 HTTP 确认只创建且未选择负责人,原 todo_created 保存后中断。普通 Todo CLI 随后只补写备注。File 和 SQLite 在当前头各两次返回 409,原卡提示原指派无法验证。相同当前主干对照返回原创建回执,双方均零新增提交。 相关代码

动机 / Motivation

维护者在 Chat 确认创建 Todo,负责人可留空。确认中断后从原卡取回已提交的结果。上一头会把独立更新误报为原指派。当前头修了这一点,仍需验证原确认只创建的情况。后续合法补备注时读回原创建回执,同时保留当前记录。本轮验证真实本地 HTTP、File 和 SQLite。真实飞书、正式桌面和 PostgreSQL Chat 升级另需证据。

改动思路 / Approach

Chat 保存原确认与阶段,原生 Todo owner 核验 Goal 来源、存储、创建回执和前序 revision。当前行校验决定仍需执行的写入是否安全。主干比较共 33 个净路径。29 个与上轮已审头字节相同,其余四个集中在原确认归因、文档和测试。在旧版实际 HTTP 创建后注入中断,通过 native CLI 合法补备注,再核对原卡与两个后端的回执和提交。独立改派和未编辑的创建作为对照。

具体改动 / Changes

精确 head 4f2251b609337a75a2a026eba8c53c2db509f876,diff base 5cfd6ae7d571f2f97da40982db23f76540723c89,33 个文件 +1682/-281。逐项复核 create-only-readback、independent-assignment、source-fencing。验收约定

关键代码讲解

  • 原回执和前序 revision 仍共同校验同一个存储。源码
  • 无指派阶段时,当前行比较也会拦住从未请求指派的原确认。源码
  • 调用方可以用原参数判断是否选择了 Agent。源码
  • 原确认允许只提交任务内容和 Goal。源码

对主干的风险 / Risks

原指派误报在当前头已修。File 和 SQLite 上,仅创建的旧卡补写备注后重试均两次返回 409,原回执仍在。当前主干两次返回 200 并读回原回执,双方均零新增提交。未修改备注的对照也能恢复。68 项 Python 和 61 项 TypeScript 通过,一项 PostgreSQL TypeScript 跳过。

语义与 CI 对齐

当前行匹配应约束待补写入。对于已经完成的纯创建,原存储和原创建事务足以证明历史结果。正式桌面、飞书和 PostgreSQL Chat 升级的验证仍独立。

我的整体评价 / Verdict

请求修改。只创建时读回已核验的原回执并保留后续备注。仅对原确认中确实存在的待补指派继续检查当前行、来源和 revision。

复看 390px 新旧首屏和当前 1200px 成功态。旧截图误报 agent-a,当前窄屏显示现任 agent-b 和原指派不确定,桌面保留回到 Goal 的入口。 仅创建后补写备注的失败通过 HTTP 复现,尚未复看该状态的浏览器及长列表或诊断展开。

English verdict: REQUEST_CHANGES. The earlier false assignment is fixed. Creation-only recovery still returns two 409s after a valid note edit on File and SQLite; exact main returns the original receipt.

Comment thread loopx/chat/todo_source.py Resolved

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

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

动机 / Motivation

用户在 Chat 确认创建 Todo 时可以留空负责人。确认中断后,从同一张卡取回已提交的结果。上轮候选会在普通 Todo 编辑补写备注后拒绝恢复,理由是缺少原指派。此次目标是取回原创建回执、保留后续备注。原确认确有待补指派时,仍按当前任务及来源核验后执行。本轮交付判断依据 R1 的创建、恢复和结果回读;平台迁移与上线继续单独验收。

改动思路 / Approach

Chat 先取原确认与已完成阶段。规范 Todo owner 验证原存储、创建事务和此前 revision。只有还需指派的确认会核对当前行后再写入。完整差异涉及 33 个路径,其中 30 个与上轮候选的文件内容及模式一致。新增复核集中在三个文件。按 R1 走一遍从创建确认、中断、合法后续编辑到原卡重试的完整路径,同时验证保存过的指派和独立改派。

具体改动 / Changes

精确 head db5309ef4f5aac52c14c01312a68ab5cc8e77bef,diff base 5cfd6ae7d571f2f97da40982db23f76540723c89,33 个文件 +1701/-281。逐项复核 create-only-readback、independent-assignment、source-fencing。验收约定

关键代码讲解

  • recover_legacy_creation 先校验原收据、创建事务和前序存储版本。源码
  • _apply_todo_create 用原参数和已证阶段决定是否还有指派。源码
  • ContextDrawer 以 typed gate 展示当前负责人,成功态保留返回 Goal 的入口。源码
  • 回归套件覆盖仅创建补备注、同源恢复和替换来源。源码

对主干的风险 / Risks

独立构造 File 和 SQLite 的真实本地 HTTP 场景。仅创建的旧卡补写备注后各重试两次,均返回 200 和原创建回执。负责人仍为空,备注保留,规范游标无新增提交。原确认有待补指派时,新指派只提交一次。独立改派保留现任负责人并两次返回 409,零写入。已保存指派两次回读也零写入。另有 130 项 Python 和 56 项 TypeScript 检查通过。作者发布的 2.3.0 升级实包结果与本轮独立源码对照一致。

语义与 CI 对齐

创建回执和原存储身份证明已发生的事。真正待执行的指派继续受当前行和 revision 约束。只保存 Todo 生命周期、当前负责人或客户端状态都不足以归因。现有来源、读取与变更权限继续经原 owner 核验。

我的整体评价 / Verdict

同意这个精确头。上轮仅创建补备注后误报 409 的问题已修复,独立改派与合法待补指派的反例仍得到预期结果。

复看该版打包 Chat 的 390px 和 1200px 首屏及下部操作区。创建成功时,原结果和返回 Goal 的入口在诊断折叠区之前。独立改派的窄屏仍展示实际负责人、阻塞原因和下一步,沿用上轮字节相同的前端。 视觉核验基于作者发布的已打包本地截图。高级诊断布局本轮沿用原组件。真实飞书、正式桌面宿主和 PostgreSQL 升级仍待验。

English verdict: APPROVE. At db5309e, File and SQLite recover the original unassigned creation twice after a note edit with zero writes. A pending assignment writes once and an independent assignment stays gated.

@huangruiteng
huangruiteng force-pushed the codex/audit-chat-goal-routing-pr-20261114 branch from db5309e to daee5a4 Compare November 19, 2026 08:26
@mergify

mergify Bot commented Nov 19, 2026

Copy link
Copy Markdown

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

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

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

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

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

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 19, 2026
Signed-off-by: huangruiteng <huangrt01@163.com>
@loopx-agent
loopx-agent force-pushed the codex/audit-chat-goal-routing-pr-20261114 branch from daee5a4 to 0d9ec0e Compare November 19, 2026 15:11
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 19, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gemini · Google · self_reported

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

动机 / Motivation

通过本机 Chat 工作区或全局目录管理多个独立 Goal 的用户与维护者,会在查看任务详情、预览及确认 Todo 或 Monitor 写入、以及在确认中断后从原卡片恢复操作时遇到来源错位风险。此前在全局目录同时配置 common_runtime_root 与独立 Goal 的 source_registry 时,任务创建、Monitor 创建与既有任务操作会退回共享或服务 runtime;在主干 ff90543766 上实测 monitor.create 会直接写入替代库而非 Goal 源库,且中断后的旧版确认恢复缺少创建回执谱系与独立指派区分。本次变更为 Chat 任务详情、创建、更新、Monitor、Gate 及中断确认恢复建立统一的 Goal 来源解析与原生 witness 校验,仅创建确认在后续合法补写备注后也能两次幂等取回原创建回执,同时保留未验证指派的门控提示而不重新生成新提案。本次不改动默认后端选型、promotion 边界、PostgreSQL service-owned 认证语义,也不在本次范围验证真实飞书、正式桌面安装包或在线 PostgreSQL 升级流程。

改动思路 / Approach

入口层统一由 resolve_chat_todo_source 解析目标 Goal 的 source_registry 与 source_runtime_root,并同时签发源 registry 与外层路由目录的双重 SHA-256 witness;决策与事务边界仍由原生 TypeScript coordination/todo owner 承担(todo_create.ts、todo_claim.ts、authority_source.ts),在准入与提交前同步核验来源摘要与 provider_revision,拒绝跨库或过时写入。该架构选择将来源解析与跨层校验集中于单一路由类型和既有原生 witness 协议,不引入第二套持久化状态或后台同步进程;旧版未携带 source 绑定的确认卡通过原库 operation_receipt 与前序 todo_source 历史验证真实创建谱系,仅在仍有待执行指派时核验当前 Todo 快照与创建快照一致,从而避免阻断仅创建任务的合法备注编辑。

具体改动 / Changes

精确审核 head 0d9ec0e904ffe776154fd88a2f76fb62fdcf9c42(已洁净变基至 origin/main ff905437669054465a4d7aa8c70ba3396aaf9182),共 33 个文件(+1702/-283),保留了主干 #9074 在 monitor.create 与 monitor.update 新增的 task_repository 转发参数以及 #9072 对 action_review_plan.ts 的注释精简。按 docs/project-agent-todo-contract.md 在基线 ff905437669054465a4d7aa8c70ba3396aaf9182 的约定逐项映射:C1(Write Contract 原卡恢复与禁止已记录 Todo 重新生成)为 implemented,对应 compileActionReviewPlan、ContextDrawer 与 _apply_todo_create;C2(同源来源解析与 routing_registry 双重 witness 校验)为 implemented,对应 resolve_chat_todo_source、authority_registry_source 与 registryAuthoritySourceCheck;C3(仅创建恢复保留后续备注且待执行指派继续核验快照/revision)为 implemented,对应 recover_legacy_creation 与 _apply_created_todo_assignment;C4(无可靠证据的独立指派如实展示现状并保持门控)为 implemented,对应 has_managed_task_claim 与 retainedTodoGate。PR 对 docs/project-agent-todo-contract.md 的新增说明仅补充本次已实现的中断恢复与 v3 wire 边界,与代码一致。

关键代码讲解

  • resolve_chat_todo_source 与 recover_legacy_creation:先在全局目录或源 registry 读取前后核对字节快照未变,计算 source_identity 并附带 routing_registry_witness;恢复旧版 todo_created 时通过原生 operation_receipt 与前序 cursor 校验同一物理 store,且仅在 assignment_pending=True 时要求当前 Todo 等于创建快照,使纯创建任务编辑备注后仍可只读恢复。
  • _apply_todo_create:统一处理创建、todo_created 断点恢复、并发推进后的指派 revision 刷新(current_assignment_revision)及 start_execution 受管认领启动;在缺失可靠指派/认领回执时返回带当前实际负责人的 canonical_authority_required gate,不篡改或伪造指派成功。
  • _apply_monitor_create:绑定源库 expected_registry_sha256、expected_provider_revision 与 routing_registry_witness,同时完整保留主干 #9074 传入的 task_repository 参数,并在 provider_revision_mismatch 或 authority_source_changed 时安全转入 stale 而不写入替代库。
  • compileActionReviewPlan 与 ContextDrawer:为已记录 todo_created 的提案设置 prohibitRegeneration: true,允许无扩展来源字段的旧版纯创建/受管卡从原卡片以 todo_creation_retry 恢复,并在 retainedTodoGate 时隐藏重新生成按钮与冗余字段,避免误导用户重新提交重复任务。

对主干的风险 / Risks

当前实现把创建与指派严格拆分为绑定来源的幂等步骤,跨目录切换、store 替换、取消 Agent 注册或并发修改原 Todo 内容时均会失败关闭或停留在诚实的 canonical_authority_required 门控;本地验证通过如下路径,所有更改均无新增阻塞缺陷:

  • 本地定向回归:pytest 执行 test_chat_reviewed_create.py、test_chat_task_start_recovery.py、test_native_user_completion_update.py、test_chat_todo_detail.py、test_steward_generic_monitor_todo.py 共 185 项全部 PASS;另跑 8 个相关 Chat/来源路由测试文件 106 项 PASS(其中 tests/test_chat_operation_actions.py 4 项 Goal activation metadata requires upgrade 失败在 origin/main ff90543766 同命令独立复现且报错一致,归因 pre_existing_unrelated)。
  • 变基后实测行为对照:在真实本地 ChatHTTPServer + 隔离 File 与 SQLite 后端上对照基线 ff90543766 与本 head 0d9ec0e904:ff90543766 下 monitor.create 将 task_repository 写入 decoy(source_todos=0, decoy_todos=1);本 head 下 File 与 SQLite 均精确写入 source_registry 对应库(cursor=3, decoy_untouched=true)并正确转发更新 task_repository。
  • TypeScript 与前端构建:npm run typecheck:control-plane、控制平面 TS 测试(87 项 PASS 及 90 项 PASS / 1 项 PostgreSQL SKIP)、dashboard tsc --noEmit、vite build --config vite.chat.config.ts 及 action-review-plan-smoke.ts SSR 冒烟全部 PASS。
  • 静态检查与门禁:改动 Python 文件 ruff check PASS,项目配置 mypy(17 个严格检查文件)PASS,check_rfc_bilingual.py、git diff --check、loopx check(33 文件公开边界扫描)、semantic-vocabulary-drift-smoke.py 及 monitor-scheduler-contract-smoke.py 均 PASS;change-quality exact-scope receipt cqr_7d7865bc391c54eec969 已校验通过,canary premerge --tier quick --goal-id personal-loopx-maintenance 返回 merge_gate_passed=true(其中 control-plane-maintainability-ratchet-smoke.py 的 1 条 interaction_contract.py 咨询项与 origin/main ff90543766 完全一致,归因 pre_existing_unrelated)。

语义与 CI 对齐

本次仅扩展 ActionReviewReason(新增 "todo_creation_retry")与局部 v3 wire schema 常量并复用现有 canonical_authority_required 与 authority_source_changed 契约,semantic-vocabulary-drift-smoke.py 与 docs/project-agent-todo-contract.md 同步更新且通过校验,无未登记词汇漂移或默认行为静默变更。托管远程 CI 依策略未等待或轮询(wait_for_ci: false)。

我的整体评价 / Verdict

同意合并方向并批准当前变基后的精确 head 0d9ec0e904ffe776154fd88a2f76fb62fdcf9c42。本 PR 在长程运行维度改善了中断恢复幂等性与跨目录来源隔离,在用户体验维度让原确认卡片如实反馈创建回执、当前负责人及恢复入口,且未增加冗余兼容包袱。代码体量(+1702/-283)中生产与测试边界清晰,v3 wire 与旧版回执兼容仅作用于持久化的恢复读取且可独立演进;前端视觉核验复用同源码字节一致的 db5309ef4f 打包 Chat 390px 与 1200px 截图并经当前 head Vite 构建与 SSR 冒烟复核,确认恢复卡片、门控信息与返回 Goal 入口层级清晰。高级诊断折叠展开态、多条长任务混排,以及真实桌面宿主、实时飞书与在线 PostgreSQL 升级流程在本轮中保持未实测。无阻塞性缺陷。

English verdict: APPROVE. Rebased cleanly onto origin/main at 0d9ec0e preserving task_repository forwarding and comment cleanup; 185+ Python tests, 177 TS tests, dashboard chat build, real HTTP File/SQLite Goal-routing probes, and Goal-bound premerge quick checks pass.

@mergify

mergify Bot commented Nov 19, 2026

Copy link
Copy Markdown

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

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

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

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

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

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 19, 2026
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 19, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)

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

[P2] 允许原确认卡在无关 Goal 编辑后继续

已确认卡的首次重试在同库查到原创建及认领回执后,仍把创建时整个 registry 的 SHA-256 传给 managed claim。只改同一 registry 里另一个 Goal 的标题,任务所属 Goal、Todo store 和租约逐项相同,File 和 SQLite 的原卡仍连续两次返回 400。原 Turn 留在 queued,启动次数为零。 在已确认卡的恢复分支先绑定原存储、原认领及执行代次,再用当前可核验的 registration witness 读回原认领,保持原操作和请求身份。在提交前仍核对当前源、Stop 和 lease。 相关代码

动机 / Motivation

在同一个 Chat 工作区管理多个 Goal 的用户,会从原确认卡继续未启动的任务。任务已经入队、工作进程还未启动时,编辑另一个 Goal 的标题会更新共享 registry。该提交随后拒绝原卡继续启动自己的任务。恢复应取回原确认,并在当前 Goal、存储、认领和 Stop 都通过后只启动原 Turn 一次。本轮核对当前提案的 Chat 路由与恢复。发布和在线安装采用由各自流程验收。

改动思路 / Approach

路由、存储身份及执行认领已有各自的权威。Chat 可用原卡上的创建回执确定存储,从原 operation receipt 确定认领,再由现有事务校验当前注册和 lease generation。本 PR 的评审边界是 Chat 的来源路由、同一确认卡恢复和阻止错误派发。当前问题可集中修在已确认卡的重试预条件。通过源路径和 Store 绑定可以知道任务属于哪个目标,再按历史凭证与当前注册证据判断是否可以继续。

具体改动 / Changes

精确 head d1668e0e9adabebe430c5fe9aa316da4d07af9e9,diff base 1047f3b4cdf90e8912f7d8457d6d4e8d3e3542c9,33 个文件 +1771/-287。逐项复核 Write Contract、Reviewed canonical edits and recovery、Canonical registry source witnesses。验收约定

关键代码讲解

  • 原确认卡先读已接纳的排队 Turn,再定位创建与认领,保留收据和已启动结果的原身份。源码
  • 已确认卡恢复的 claim 调用仍带创建时 registry 全文件摘要。共享 registry 中无关标题的变动会触发同一个失败。源码
  • 同样的源路径和 runtime 只定位同一 authority。store identity 再约束原记录的物理来源。源码

对主干的风险 / Risks

独立 File/SQLite HTTP 验证了正常接续、legacy checkpoint、重复点击和改换 Todo store 后恢复。可接续时只启动原 Turn 一次,Stop 或换库时不启动,原回执与原存储保持。 在相同 File 和 SQLite HTTP fixture 中,目标 main 修改无关 Goal 后两次原卡 apply 均为 202。原 Turn 启动一次并完成,回执与存储状态保持。 已确认卡的首次重试在同库查到原创建及认领回执后,仍把创建时整个 registry 的 SHA-256 传给 managed claim。只改同一 registry 里另一个 Goal 的标题,任务所属 Goal、Todo store 和租约逐项相同,File 和 SQLite 的原卡仍连续两次返回 400。原 Turn 留在 queued,启动次数为零。

语义与 CI 对齐

精确 head 重建 Chat bundle,192 项 Python、56 项 TypeScript、控制面和 Dashboard typecheck、改动 Python Ruff 与 diff 检查通过。 同一 Monitor poll writeback smoke 在 base 和 head 均因目标检查的相同断言失败。 它是同基线可复现的本地 premerge 限制。独立运行本机重建的 Chat bundle、loopback HTTP 和合成上游。线上飞书、installed desktop host 与旧 PostgreSQL Chat 升级未独验。

我的整体评价 / Verdict

请求修改。在已确认卡的恢复分支先绑定原存储、原认领及执行代次,再用当前可核验的 registration witness 读回原认领,保持原操作和请求身份。在提交前仍核对当前源、Stop 和 lease。 复验普通编辑后原任务能继续,并保留换库、Stop、旧卡和重复点击的测试。

浏览器检查了原确认卡的两条路径。桌面 File 从重试按钮转到任务回执。390×854 的 SQLite Stop 提示、原卡和重试按钮均可见,原 Turn 保持排队。 高级诊断展开、正式桌面部署和线上飞书不在此次独立浏览器验证内。

English verdict: REQUEST_CHANGES. Resume the original accepted Task after unrelated registry edits while retaining current source, Stop, and lease validation.

else:
# Replay the accepted claim using the same intent. A stale
# basis cannot authorize another claim on an applied card.
claim = apply_claim(source, steps.get("todo_assignment_basis", binding)["provider_revision"])

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.

这里的 applied-card retry 仍通过 apply_claim 使用创建时整个 registry 的摘要。File/SQLite 各自对照,仅改其他 Goal 标题后,目标 main 的原 Turn 启动一次,新 head 连续 400。请在原 Store 和原认领均可追溯后使用当前已验证的 registry witness,保持原 operation identity 和 Stop/lease 校验。

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · Gemini · Google DeepMind · self_reported

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

动机 / Motivation

在共享工作区 registry 或全局目录中管理多个独立 Goal、并在 Chat 中查看任务详情、发起带执行的任务创建确认、或在确认中断后从原卡片恢复的任务发起人与操作者。 此前当全局目录同时配置 common_runtime_root 与 Goal 的 source_registry 时,Chat 的任务详情读取、Todo 创建与 Monitor 写入可能路由到错误的共享 runtime;此外当任务创建确认已经保存回执并提交了排队 Turn 但工作进程尚未启动时,原卡需要按原 Goal 来源与受管认领凭证恢复同一个 Session 与 Turn。集成 PR #8729 后,本 PR 在目标 Goal 停用、更换源库或更换存储目录时能够正确拒绝启动并保留原回执;但在同文件共享 registry.json 中仅修改另一个无关 Goal 的标题后,已确认待派发卡(以及 todo_created 后中断未完成认领的确认卡)在重试时仍沿用创建时整份 registry 的 SHA-256,导致在 File 与 SQLite 后端均连续返回 400 而无法恢复原 Turn。 同库正常恢复、Stop 拒绝、换源拒绝与并发互斥已在回归路径上跑通;但因创建时整库 registry_sha256 绑定过宽,同文件共享 registry 中无关 Goal 的常规编辑会阻断原任务恢复。 不改变默认存储后端、不自动触发 provider promotion、不修改 PostgreSQL service-owned 认证边界,也不覆盖线上飞书或正式桌面安装宿主。 需要在已验证原存储、原认领与当前 Goal/Agent 状态后改为以当前已核验 registry witness 读回既有认领,并补齐共享 registry 无关 Goal 编辑后的恢复回归。

改动思路 / Approach

入口统一由 todo_source.resolve_chat_todo_source 解析 Goal 的 source_registry 与 source_runtime_root 并携带 routing_registry_witness;创建/认领/更新事务与回执幂等仍由 TypeScript local_authority_runtime(todo_create.ts、todo_claim.ts、authority_source.ts)承担。 本 PR 边界为 Chat 任务详情与动作路由到 Goal 源目录及断点恢复幂等;问题集中在 todo_actions.py 在断点恢复阶段对创建时 whole-file registry_sha256 的复用。 具体流程上,预览与写入先经 resolve_chat_todo_source 获取源 registry.json 与外层路由目录的双重字节摘要(routing_registry_witness)以及 source_identity,再在 todo_actions.py 的 _apply_todo_create、_recover_applied_task 与 _start_confirmed_task 中串联 todo_created 断点、受管认领及 ChatRuntimeController 的原 Session/Turn 恢复,并在 submit_turn 的 _goal_commit 阶段加锁二次校验来源、Goal 状态、Agent 端点与租约。前端通过 action_review_plan.ts 投影 prohibitRegeneration 与 task_execution_dispatch_pending,让已记录创建的卡片保留在原卡片重试而非重新生成重复任务。将来源身份和存储身份交由 source_identity 与 store_identity 约束本身是合理的,但在已保存回执或已创建 Todo 的重试分支把整份 registry.json 的历史 SHA-256 传给 v3 claim/update wire 的 expected_registry_sha256,把对单 Goal 来源与注册有效性的约束错误放大成了整份多 Goal 配置文件字节完全冻结的约束。

具体改动 / Changes

精确审核 head d1668e0e9adabebe430c5fe9aa316da4d07af9e9(diff base 1047f3b4cdf90e8912f7d8457d6d4e8d3e3542c9),共 33 个文件(+1771/-287)。依据 docs/project-agent-todo-contract.md 在基线 1047f3b4cdf90e8912f7d8457d6d4e8d3e3542c9 接受的契约逐项映射:Write Contract 与 Reviewed canonical edits and recovery(原卡重试、禁止已创建确认重新生成及旧确认区分)为 implemented,见 compileActionReviewPlan、ContextDrawer、recover_legacy_creation;Canonical registry source witnesses(多目录来源与 routing_registry 字节校验及同源多 Goal 独立恢复)为 not_met,因 todo_actions.py 在恢复分支复用创建期整库 registry_sha256 导致同库无关 Goal 编辑后无法恢复原排队 Turn,详见下方发现。PR 在 docs/project-agent-todo-contract.md 同步补充了 v3 source-bound 创建/认领与旧确认恢复说明。

关键代码讲解

  • resolve_chat_todo_source 与 ChatTodoSource.require_created_todo:解析 Goal 的实际 source_registry 与 source_runtime_root,并在前后字节比对后签发 source_identity、registry_sha256 与 routing_registry_witness;require_created_todo 同时校验 source_identity、source_authority 与 store_identity,阻止跨目录或换库恢复。
  • _recover_applied_task 与 _start_confirmed_task:定位已接受但尚在 queued 且未产生 started_at/upstream_turn_id 的原 Turn,并重新校验来源、Goal 活跃状态、Agent 资格及受管认领;但在第 459 行(以及 applied_execution is None 路径的第 448 行和普通指派路径第 170 行)仍将创建期 binding["registry_sha256"] 传给 update_goal_todo。
  • registryAuthoritySourceCheck 与 claimLocalCoordinationTodo:v3 认领与创建请求校验 expected_registry_sha256 == witness.sha256 并重读源 registry 与 routing_registry,因此在 todo_claim.ts 返回历史回执前就会因 expectedDigest 与当前文件摘要不等而失败退出。
  • compileActionReviewPlan 与 ContextDrawer:依据 todo_created 断点设置 prohibitRegeneration: true,并在 task_execution_dispatch_pending 为真时保持 task_start_retry 可重试状态。

对主干的风险 / Risks

[P2] 共享 registry 中无关 Goal 的修改会永久阻断原 Task 确认卡恢复

  • 触发条件与路径:同一份共享 registry.json 下存在两个 Goal(如 report 与 other-goal)。report 的带执行任务创建确认在提交了 todo_created、受管认领、Session 与 queued Turn(或仅完成 todo_created 后中断,此时前端已启用 prohibitRegeneration: true 禁止重新生成)之后,用户仅修改 other-goal 的 title 导致 registry.json 的整文件 SHA-256 变化,随后重试原确认卡。
  • 独立复现证据:在本机隔离环境运行 ChatHTTPServer 对照探针,在 file 与 sqlite 两种 hard_lease 后端上分别测试 applied_before_dispatch 与 after_todo_created 两类断点后修改 other-goal 标题,连续两次 POST /api/actions/<proposal_id>/apply 均返回 HTTP 400(Todo authority registration changed; review the current state before continuing),原 Turn 停留在 queued,turn/start 调用次数为 0(对照代码检查显示,基线 1047f3b4cdf90e8912f7d8457d6d4e8d3e3542c9 的 todo_actions.py 第 205–209 行在 _start_confirmed_task 中并未向 update_goal_todo 传递 claim_expected_registry_sha256)。
  • 风险与影响:在多 Goal 共享 registry.json 的日常工作区中,任何其他 Goal 的常规标题或状态编辑都会使待启动的 Task 确认卡永久失效(无法恢复也无法重新生成)。
  • 最小修复:在 todo_actions.py 的 _recover_applied_task -> _start_confirmed_task 路径(以及确认 todo_created 已落地后重试 apply_claim / apply_assignment 的 :448、:170 处),在已完成 source.require_created_todo(binding, authority)、Goal 活跃/未停用检查及当前 Goal Agent 注册检查后,使用当前已读取核验的 current_source.registry_sha256(即 source.registry_sha256)作为本次读回/提交请求的 registry witness,同时保留 binding 的 source_identity、store_identity、原 operation_id、provider_revision 与 _confirmed_task_commit 锁内二次校验;并补充在共享 registry.json 修改无关 Goal 标题后 File/SQLite 均可恢复原 Turn 的回归测试。

本地验证矩阵

  • Chat 与控制面 Python 测试:在隔离工作树运行 test_chat_reviewed_create.py、test_chat_task_start_recovery.py、test_native_user_completion_update.py、test_chat_todo_detail.py、test_chat_operation_actions.py 共 235 项,219 passed, 16 failed;其中 test_chat_reviewed_create.py、test_chat_task_start_recovery.py、test_chat_todo_detail.py 全数通过,12 项 test_packaged_chat_http_user_completion 失败因隔离工作树未构建内置资产目录(GET /chat 返回 404),4 项 test_chat_operation_actions.py 因测试夹具触发 ProjectRegistryProtocolError: Goal activation metadata requires upgrade 失败(仅在当前 head 运行,未在基线对照)。另有 test_semantic_vocabulary_drift.py 124 passed。
  • TypeScript 与前端构建:npm run typecheck:control-plane PASS;action_review_plan.test.ts 21 passed;local_authority_provider.test.ts 35 passed;authority_source.test.ts + todo_create_reviewed.test.ts + chat_turn_acceptance.test.ts + unsettled_host_turn_recovery.test.ts 71 passed, 1 skipped;authority_store.test.ts + sqlite_authority_store.test.ts 809 passed;Dashboard tsc --noEmit、vite build --config vite.chat.config.ts 与 personal-workspace-contract.test.mjs(4 passed)全部 PASS。
  • 静态检查与边界:改动 Python 文件 ruff check PASS,check_rfc_bilingual.py PASS,loopx check 公开边界扫描 134 个文件 0 错误 PASS。托管 CI 按 Goal 策略 wait_for_ci: false 未等待。

语义与 CI 对齐

本次仅扩展 ActionReviewReason(新增 todo_creation_retry)与 v3 source-bound create/claim 请求协议并复用既有 canonical_authority_required 与 authority_source_changed 契约,test_semantic_vocabulary_drift.py(124 passed)与文档同步通过,无未登记词汇漂移。

我的整体评价 / Verdict

请求修改(Request Changes)。虽然多目录路由隔离、store_identity 约束、legacy 纯创建保留备注及并发恢复互斥等核心链路工作正常,但 todo_actions.py(以及 :448 / :170)在恢复阶段继续沿用创建期整库 binding["registry_sha256"],经 File 与 SQLite 实测会在共享 registry.json 中编辑任意无关 Goal 后导致原任务恢复连续返回 400、Turn 永不启动,构成长程运行(long_horizon)与用户体验(user_experience)的阻塞性回归。前端视觉复核标记为 not_yet_proven(基于 PR 描述中提供的 d1668e0 隔离打包桌面/窄屏截图(正常恢复卡片与 Stop 门控提示),并经本轮独立 Vite 构建与 ActionReviewPlan 契约测试核对,未发现新增前端布局或门控回归;真实浏览器交互、已安装桌面宿主及诊断展开态未在本轮本地无头复审中实机点击;unverified_scope: 独立无头浏览器交互、诊断展开态、已安装桌面宿主与真实飞书。)。请在修复恢复路径的 registry witness 绑定并补充共享 registry 无关 Goal 编辑的 File/SQLite 回归测试后重新提交复审。

English verdict: REQUEST_CHANGES. At exact head d1668e0, editing an unrelated Goal in a shared registry.json causes todo_actions.py recovery (applied-card Turn retry at line 459 and post-todo_created retry at lines 448/170) to fail with HTTP 400 (authority_source_changed) on both File and SQLite because it replays the creation-time whole-registry binding["registry_sha256"]; bind existing recovery to current_source.registry_sha256 after verifying source_identity, store_identity, active Goal, and registered Agent, and add File/SQLite regression tests.

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.

2 participants